Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hss
caicai8 5 years ago
commit c730fbfe95

@ -1,11 +1,12 @@
class Users::QuestionBanksController < Users::BaseController class Users::QuestionBanksController < Users::BaseController
before_action :require_login before_action :require_login
before_action :private_user_resources! skip_before_action :check_observed_user_exists!
# before_action :private_user_resources!
before_action :check_query_params! before_action :check_query_params!
before_action :check_user_permission! before_action :check_user_permission!
def index def index
service = Users::QuestionBankService.new(observed_user, query_params) service = Users::QuestionBankService.new(User.current, query_params)
question_banks = service.call question_banks = service.call
@count = question_banks.count @count = question_banks.count

@ -1,35 +0,0 @@
#coding=utf-8
module SessionExtenstions
module EntryExtension
def compressed?
@compressed
end
def value
if @value
begin
Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
rescue TypeError
compressed? ? Zlib::Inflate.inflate(@value) : @value
end
end
end
def size
if @value.nil?
0
else
@value.bytesize
end
end
end
end
ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)

@ -55,12 +55,14 @@ Rails.application.routes.draw do
get :homepage_info get :homepage_info
end end
get :question_banks, on: :collection, to: 'users/question_banks#index'
scope module: :users do scope module: :users do
resources :courses, only: [:index] resources :courses, only: [:index]
resources :shixuns, only: [:index] resources :shixuns, only: [:index]
resources :projects, only: [:index] resources :projects, only: [:index]
resources :subjects, only: [:index] resources :subjects, only: [:index]
resources :question_banks, only: [:index] # resources :question_banks, only: [:index]
resource :experience_records, only: [:show] resource :experience_records, only: [:show]
resource :grade_records, only: [:show] resource :grade_records, only: [:show]
resource :watch, only: [:create, :destroy] resource :watch, only: [:create, :destroy]

@ -62,7 +62,7 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results. // We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment. // You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版 // devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : 'source-map',//测试版 devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code. // In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs], entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: { output: {

@ -100,6 +100,7 @@ class NewWorkForm extends Component{
const courseId = this.state.course_id || this.props.match.params.coursesId ; const courseId = this.state.course_id || this.props.match.params.coursesId ;
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if(err && err.personNum) delete err.personNum;
console.log(values) console.log(values)
const mdContnet = this.contentMdRef.current.getValue().trim(); const mdContnet = this.contentMdRef.current.getValue().trim();
console.log(mdContnet) console.log(mdContnet)
@ -135,7 +136,7 @@ class NewWorkForm extends Component{
} }
// const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet // const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet
if (!err) { if (!err || Object.keys(err).length == 0) {
if (this.state.isEdit) { if (this.state.isEdit) {
this.doEdit(courseId, values) this.doEdit(courseId, values)
} else { } else {
@ -451,12 +452,12 @@ class NewWorkForm extends Component{
> >
{getFieldDecorator('personNum', { {getFieldDecorator('personNum', {
validateTrigger: 'onNone', validateTrigger: 'onNone',
rules: [{ // rules: [{
// required: true, // required: true,
// message: '人数不能为空' // message: '人数不能为空'
// validator: this.personNumValidator // validator: this.personNumValidator
// required: true, message: '请输入最小人数和最大人数' // required: true, message: '请输入最小人数和最大人数'
}], // }],
})( })(
<div> <div>
<p className="clearfix"> <p className="clearfix">

@ -216,7 +216,9 @@ class Bullsubdirectory extends Component{
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state;
let{myname,mydescription,id}=this.props; let{myname,mydescription,id}=this.props;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
console.log("Bullsubdirectory");
console.log(this.props.isAdmin());
console.log(this.props.yslbool);
return( return(
<React.Fragment > <React.Fragment >
<div > <div >
@ -239,10 +241,13 @@ class Bullsubdirectory extends Component{
<div> <div>
<span className="fr yslbianji" style={{marginRight:"17px"}}> <span className="fr yslbianji" style={{marginRight:"17px"}}>
{ {
this.props.isClassManagement() === true ? this.props.isAdmin() === true ?
(this.props.yslbool===false? (this.props.yslbool===false?
<Tooltip placement="bottom" title={<div>
编辑
</div>}>
<i className="iconfont icon-bianji1 newbianji1" onClick={()=>this.bianji(true)}></i> <i className="iconfont icon-bianji1 newbianji1" onClick={()=>this.bianji(true)}></i>
</Tooltip>
: :
"" ""
) )
@ -251,10 +256,13 @@ class Bullsubdirectory extends Component{
</span> </span>
<span className="fr yslbianji" style={{marginRight:"22px"}}> <span className="fr yslbianji" style={{marginRight:"22px"}}>
{ {
this.props.isClassManagement() === true ? this.props.isAdmin() === true ?
(this.props.yslbool===false? (this.props.yslbool===false?
<Tooltip placement="bottom" title={<div>
删除
</div>}>
<i className="iconfont icon-shanchu newbianji1" style={{ color: "#4CACFF"}} onClick={()=>this.setModeltrue(true)}></i> <i className="iconfont icon-shanchu newbianji1" style={{ color: "#4CACFF"}} onClick={()=>this.setModeltrue(true)}></i>
</Tooltip>
: :
"" ""
) )

@ -89,7 +89,7 @@ class GroupPackage extends Component {
</p> </p>
:datas&&datas.group_info&&datas.group_info.base_on_project===0? :datas&&datas.group_info&&datas.group_info.base_on_project===0?
<p> <p>
<span className="ysltextcolor66">基于项目实施</span> <span className="ysltextcolor66">基于项目</span>
<span className="ysltextcolor05">无需在平台创建项目任意小组成员均可以提交作品</span> <span className="ysltextcolor05">无需在平台创建项目任意小组成员均可以提交作品</span>
</p> </p>
:"" :""

@ -16,6 +16,7 @@ class AboutUs extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "关于我们";
this.getContent(); this.getContent();
} }

@ -16,6 +16,7 @@ class Agreement extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "服务协议";
this.getContent(); this.getContent();
} }

@ -17,6 +17,7 @@ class ContactUs extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "联系我们";
this.getData(); this.getData();
} }

@ -21,6 +21,7 @@ class Cooperatives extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "合作伙伴";
this.getCooperatives(); this.getCooperatives();
} }

@ -13,6 +13,10 @@ class Feedback extends React.Component {
super(props); super(props);
} }
componentDidMount() {
window.document.title = "意见反馈";
}
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (prevProps.current_user !== this.props.current_user) { if (prevProps.current_user !== this.props.current_user) {
if(!this.props.checkIfLogin()) { if(!this.props.checkIfLogin()) {

@ -16,6 +16,7 @@ class HelpCenter extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "帮助中心";
this.getContent(); this.getContent();
} }

@ -31,8 +31,8 @@ class InfosBanner extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity; let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id; let targetuserid=this.props.data&&this.props.data.id;
// console.log(is_current) // console.log(is_current)
// console.log(current_user) // console.log(current_user)
// console.log(current_user.is_teacher) // console.log(current_user.is_teacher)
// console.log(current_user.admin) // console.log(current_user.admin)
return( return(
@ -124,7 +124,7 @@ class InfosBanner extends Component{
</li>} </li>}
{/*自己的主页且不是学生显示题库按钮*/} {/*自己的主页且不是学生显示题库按钮*/}
{((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) {(is_current && current_user)
&&<li className={`${moduleName == 'topics' ? 'active' : '' }`}> &&<li className={`${moduleName == 'topics' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'topics'})} onClick={() => this.setState({moduleName: 'topics'})}

@ -103,7 +103,7 @@ class InfosCourse extends Component{
} = this.state; } = this.state;
let is_current=this.props.is_current; let is_current=this.props.is_current;
console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
return( return(
<div className="educontent"> <div className="educontent">
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>

@ -31,33 +31,34 @@ class InfosTopics extends Component{
} }
componentDidMount(){ componentDidMount(){
let types=this.props.match.params.topicstype; // let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification; // let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
//
if(professional_certification===false&&types==="publicly"){ // if(professional_certification===false&&types==="publicly"){
this.setState({ // this.setState({
isshowprofes:true // isshowprofes:true
}) // })
}else{ // }else{
this.updataslist() // this.updataslist()
} // }
} this.updataslist()
componentDidUpdate(prevProps) {
if(prevProps.current_user!=this.props.current_user){
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
console.log(professional_certification)
if(professional_certification===false&&types==="publicly"){
this.setState({
isshowprofes:true
})
}else{
this.updataslist()
}
}
} }
// componentDidUpdate(prevProps) {
//
// if(prevProps.current_user!=this.props.current_user){
// let types=this.props.match.params.topicstype;
// let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
//
// console.log(professional_certification)
// if(professional_certification===false&&types==="publicly"){
// this.setState({
// isshowprofes:true
// })
// }else{
// this.updataslist()
// }
// }
// }
updataslist=()=>{ updataslist=()=>{
let types=this.props.match.params.topicstype; let types=this.props.match.params.topicstype;
let { category,course_list_id,sort_by,sort_direction,page}=this.state; let { category,course_list_id,sort_by,sort_direction,page}=this.state;
@ -65,39 +66,12 @@ class InfosTopics extends Component{
} }
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{ searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
// if(this.props.current_user.login!=this.props.match.params.username){
// return
// }else{
//
// }
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
if(professional_certification===false&&types==="publicly"){
}else{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
let types=this.props.match.params.topicstype;
let user_id="";
if(types==="publicly"){
user_id=this.props.current_user&&this.props.current_user.login;
}else{
user_id=this.props.match.params&&this.props.match.params.username;
}
if(user_id===undefined){
user_id=1
}
let {per_page}=this.state; let {per_page}=this.state;
let url=`/users/${user_id}/question_banks.json`; let url=`/users/question_banks.json`;
axios.get(encodeURI(url),{params:{ axios.get(encodeURI(url),{params:{
type, type,
@ -109,19 +83,33 @@ class InfosTopics extends Component{
per_page per_page
} }
}).then((response) => { }).then((response) => {
this.setState({ if(response){
data:response.data, if(response.status){
checkBoxValues:[], if(response.data.status == -2){
isSpin:false this.setState({
}) isshowprofes:true,
isSpin:false
})
}else if(response.data.status === 403||response.data.status === 401||response.data.status === 500){
this.setState({
isSpin:false
})
}else{
this.setState({
data:response.data,
checkBoxValues:[],
isSpin:false
})
}
}
}
}).catch((error) => { }).catch((error) => {
this.setState({ this.setState({
isSpin:false isSpin:false
}) })
}); });
}
} }
searchCategory=(type)=>{ searchCategory=(type)=>{

Loading…
Cancel
Save