diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 712b7909c..01e9fe5d3 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -164,23 +164,24 @@ class TPMIndex extends Component { componentDidUpdate(prevProps, prevState) { if (prevProps!=this.props) { - + if(this.props.user&&this.props.user.user_id){ let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) - if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ - this.setState({ - openknows:true - }) - }else{ - this.setState({ - openknows:false - }) - } - + if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ + this.setState({ + openknows:true + }) + }else{ + this.setState({ + openknows:false + }) + } + } } } getcomponentdidmount=()=>{ + let userid=this.props.user&&this.props.user.user_id; let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) let id = this.props.match.params.shixunId; @@ -202,7 +203,6 @@ class TPMIndex extends Component { // }).catch((error) => { // console.log(error) // }); - let Url = `/shixuns/` + id + `.json`; axios.get(Url).then((response) => { if (response.status === 200) { @@ -232,18 +232,21 @@ class TPMIndex extends Component { is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter, }); - - if(response.data.identity <4){ - if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ - this.setState({ - openknows:true - }) - }else{ - this.setState({ - openknows:false - }) + if(userid){ + if(response.data.identity <4){ + if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ + console.log() + this.setState({ + openknows:true + }) + }else{ + this.setState({ + openknows:false + }) + } } } + } }).catch((error) => { this.setState({ @@ -380,6 +383,8 @@ class TPMIndex extends Component { let url = window.location.href; let flag = url.indexOf("add_file")>-1; + + console.log(this.state.openknows) return (
{/*头部*/} @@ -444,7 +449,7 @@ class TPMIndex extends Component { { this.state.is_jupyter===false? 排行榜 :""} - {this.state.identity >4||this.state.identity===undefined ? "": + {this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true? @@ -457,7 +462,7 @@ class TPMIndex extends Component { visible={this.state.openknows} > - } + :""} {this.state.identity >4||this.state.identity===undefined ? "": diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js index a98f68223..e1316623e 100644 --- a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js +++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js @@ -94,7 +94,7 @@ export default class Shixuninformation extends Component { loading: true }) let id = this.props.match.params.shixunId; - let url = `/shixuns/${id}/update_permission_setting.json`; + let url = `/shixuns/${id}/update_learn_setting.json`; axios.post(url, { shixun: {