|
|
|
@ -152,18 +152,28 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
|
|
|
|
|
//初始化
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
let { defaultActiveKey } = this.state;
|
|
|
|
|
var data = {
|
|
|
|
|
discipline_id: this.state.discipline_id,
|
|
|
|
|
sub_discipline_id: this.state.sub_discipline_id,
|
|
|
|
|
tag_discipline_id: this.state.tag_discipline_id,
|
|
|
|
|
public: defaultActiveKey,
|
|
|
|
|
page: 1,
|
|
|
|
|
per_page: 10,
|
|
|
|
|
item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id),
|
|
|
|
|
};
|
|
|
|
|
this.getdata(data);
|
|
|
|
|
let isysladmins=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(this.props){
|
|
|
|
|
if(this.props.current_user){
|
|
|
|
|
if(this.props.current_user.admin){
|
|
|
|
|
isysladmins=true;
|
|
|
|
|
}
|
|
|
|
|
else if(this.props.current_user.business){
|
|
|
|
|
isysladmins=true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
@ -198,17 +208,27 @@ 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"
|
|
|
|
|
if(prevProps.current_user !== this.props.current_user) {
|
|
|
|
|
let isysladmins=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(this.props){
|
|
|
|
|
if(this.props.current_user){
|
|
|
|
|
if(this.props.current_user.admin){
|
|
|
|
|
isysladmins=true;
|
|
|
|
|
}
|
|
|
|
|
else if(this.props.current_user.business){
|
|
|
|
|
isysladmins=true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
|
|
|
|
|
defaultActiveKeys="0"
|
|
|
|
|
}else{
|
|
|
|
|
defaultActiveKeys="1"
|
|
|
|
|
}
|
|
|
|
|
this.callback(defaultActiveKeys);
|
|
|
|
|
}
|
|
|
|
|