|
|
|
@ -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 (
|
|
|
|
|
<div className="newMain clearfix">
|
|
|
|
|
{/*头部*/}
|
|
|
|
@ -444,7 +449,7 @@ class TPMIndex extends Component {
|
|
|
|
|
{ this.state.is_jupyter===false? <Menu.Item key="8" className={"competitionmr50"}>
|
|
|
|
|
<span className={"tpmbannernavstyler"}>排行榜</span>
|
|
|
|
|
</Menu.Item>:""}
|
|
|
|
|
{this.state.identity >4||this.state.identity===undefined ? "":<span>
|
|
|
|
|
{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?<span>
|
|
|
|
|
<Popover
|
|
|
|
|
content={
|
|
|
|
|
<pre className={"bannerpd201"}>
|
|
|
|
@ -457,7 +462,7 @@ class TPMIndex extends Component {
|
|
|
|
|
visible={this.state.openknows}
|
|
|
|
|
>
|
|
|
|
|
</Popover>
|
|
|
|
|
</span>}
|
|
|
|
|
</span>:""}
|
|
|
|
|
|
|
|
|
|
{this.state.identity >4||this.state.identity===undefined ? "":
|
|
|
|
|
<Menu.Item key="9" className={"competitionmr50"}>
|
|
|
|
|