diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index bec9f5dde..e5494e8e3 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -24,15 +24,15 @@ class Challenges extends Component { startbtns: false, sumid: "", sumidtype: false, - startshixunCombattype: false, - shixunsreplace: false, - shixunsmessage: "", - hidestartshixunsreplacevalue: "", - operationstrue: false, - isSpin: false, - boxoffsetHeigh: 0, - opentitletype: true, - isopentitletype: "Less", + startshixunCombattype:false, + shixunsreplace:false, + shixunsmessage:"", + hidestartshixunsreplacevalue:"", + operationstrue:false, + isSpin:false, + boxoffsetHeigh:0, + opentitletype:true, + isopentitletype:"Less" } } @@ -357,6 +357,50 @@ class Challenges extends Component { }) } + // 开启挑战 + beginChallenge=(url)=>{ + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return; + } + if (this.props.checkIfProfileCompleted() === false) { + this.setState({ + AccountProfiletype: true + }) + return; + } + this.setState({ + startbtns:true + }) + if(url.indexOf(".json")>-1){ + axios.get(url).then((response) => { + if (response.data.status === -2) { + this.setState({ + startbtns:false, + shixunsreplace:true, + hidestartshixunsreplacevalue:response.data.message+".json" + }) + } else if (response.data.status === -1) { + this.setState({ + startbtns: false + }) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessage:response.data.message, + startshixunCombattype:true, + startbtns:false + }) + } else { + window.location.href = "/tasks/" + response.data.game_identifier; + } + }).catch((error) => { + + }); + }else{ + window.location.href=url; + } + } + render() { let { ChallengesDataList, startbtns, sumidtype, startshixunCombattype, shixunsreplace, shixunsmessage, hidestartshixunsreplacevalue, operationstrue, AccountProfiletype } = this.state; let { loadingContent } = this.props; @@ -695,38 +739,31 @@ class Challenges extends Component { - -