|
|
|
@ -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({
|
|
|
|
|