diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index badbffa08..e271857ba 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -148,8 +148,17 @@ class NewMyShixunModel extends Component { //初始化 componentDidMount() { - - + const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; + const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; + let {defaultActiveKey} = this.props; + var defaultActiveKeys=defaultActiveKey; + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ + defaultActiveKeys="0" + }else{ + defaultActiveKeys="1" + } + this.callback(defaultActiveKeys); let url = `/users/get_navigation_info.json`; axios.get(url, {}).then((response) => { // ////console.log("开始请求/get_navigation_info.json"); @@ -180,6 +189,24 @@ class NewMyShixunModel extends Component { } }); } + + componentDidUpdate(prevProps) { + if(prevProps.current_user !== this.props.current_user) { + debugger + const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; + const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; + let {defaultActiveKey} = this.props; + var defaultActiveKeys=defaultActiveKey; + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ + defaultActiveKeys="0" + }else{ + defaultActiveKeys="1" + } + this.callback(defaultActiveKeys); + } + } + //公共和我的 callback = (key) => { this.setState({ diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index b65127c8d..680916d77 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -285,7 +285,7 @@ class Paperreview extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" diff --git a/public/react/src/modules/testpaper/Intecomponents.js b/public/react/src/modules/testpaper/Intecomponents.js index 0d452a890..fc0dadd4a 100644 --- a/public/react/src/modules/testpaper/Intecomponents.js +++ b/public/react/src/modules/testpaper/Intecomponents.js @@ -242,7 +242,7 @@ class Intecomponents extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index efcb45496..449de0219 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -227,7 +227,7 @@ class Paperlibraryeditid extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: ""