From a3e6962c710152d2ae5db32c599f71467cf83415 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 12 Mar 2020 16:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E5=8D=A1-=E5=BC=80=E5=90=AF=E6=8C=91?= =?UTF-8?q?=E6=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tpm/shixunchild/Challenges/Challenges.js | 132 ++++++++++++------ .../shixunchild/shixunchildCss/Challenges.css | 24 ++++ 2 files changed, 117 insertions(+), 39 deletions(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 0e701c00c..32263676f 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -33,7 +33,7 @@ class Challenges extends Component { isSpin:false, boxoffsetHeigh:0, opentitletype:true, - isopentitletype:"Less", + 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; @@ -700,49 +744,60 @@ class Challenges extends Component { +
+
+
+ {/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/} + {this.props.identity<5? + item.st === 1 ? +
{item.name}
+ : +
{item.name}
:
this.startshixunCombat(this.props.identity, item.challenge_id, "/editcheckpoint")} + className="font-16 color05101a fonthiddens">{item.name}
+ } + {/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/} + + + +
+
+ + 正在挑战: {item.playing_count}人 + 完成挑战: {item.passed_count}人 + 可获经验: {item.score}点 -
- {/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/} - {this.props.identity<5? - item.st === 1 ? -
{item.name}
- : -
{item.name}
:
this.startshixunCombat(this.props.identity, item.challenge_id, "/editcheckpoint")} - className="font-16 color05101a fonthiddens">{item.name}
+
+
+ { + item.open_game ? + this.beginChallenge(item.open_game)} className="challengeBtn blue">开启挑战 + : + 开启挑战 } - {/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/} - - - - - -
-
- - 正在挑战: {item.playing_count}人 - 完成挑战: {item.passed_count}人 - 可获经验: {item.score}点 - -
+
) })} + + + -