关卡-开启挑战

dev_aliyun2
caicai8 5 years ago committed by harry
parent 24209fa375
commit 754637502b

@ -24,15 +24,15 @@ class Challenges extends Component {
startbtns: false, startbtns: false,
sumid: "", sumid: "",
sumidtype: false, sumidtype: false,
startshixunCombattype: false, startshixunCombattype:false,
shixunsreplace: false, shixunsreplace:false,
shixunsmessage: "", shixunsmessage:"",
hidestartshixunsreplacevalue: "", hidestartshixunsreplacevalue:"",
operationstrue: false, operationstrue:false,
isSpin: false, isSpin:false,
boxoffsetHeigh: 0, boxoffsetHeigh:0,
opentitletype: true, 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() { render() {
let { ChallengesDataList, startbtns, sumidtype, startshixunCombattype, shixunsreplace, shixunsmessage, hidestartshixunsreplacevalue, operationstrue, AccountProfiletype } = this.state; let { ChallengesDataList, startbtns, sumidtype, startshixunCombattype, shixunsreplace, shixunsmessage, hidestartshixunsreplacevalue, operationstrue, AccountProfiletype } = this.state;
let { loadingContent } = this.props; let { loadingContent } = this.props;
@ -695,28 +739,21 @@ class Challenges extends Component {
</span> </span>
</div> </div>
<div className="challengtes_Item">
<div className="flex1">
<div className="clearfix mb5"> <div className="clearfix mb5">
{/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/} {/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/}
{this.props.identity < 5 ? {this.props.identity<5?
item.st === 1 ? item.st === 1 ?
<div className="font-16 color05101a fonthiddens">{item.name}</div> <div className="font-16 color05101a fonthiddens">{item.name}</div>
: :
<div className="font-16 color05101a fonthiddens">{item.name}</div> : <div <div className="font-16 color05101a fonthiddens">{item.name}</div>:<div
// onClick={() => this.startshixunCombat(this.props.identity, item.challenge_id, "/editcheckpoint")} // onClick={() => this.startshixunCombat(this.props.identity, item.challenge_id, "/editcheckpoint")}
className="font-16 color05101a fonthiddens">{item.name}</div> className="font-16 color05101a fonthiddens">{item.name}</div>
} }
{/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/} {/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/}
<Modal
keyboard={false}
visible={startbtns}
closable={false}
footer={null}
className="startbtnModal"
>
<Spin size="large" />
</Modal>
</div> </div>
<div className="clearfix"> <div className="clearfix">
@ -735,9 +772,27 @@ class Challenges extends Component {
</div> </div>
</div> </div>
{
item.open_game ?
<a onClick={()=>this.beginChallenge(item.open_game)} className="challengeBtn blue">开启挑战</a>
:
<span className="challengeBtn">开启挑战</span>
}
</div>
</div>
) )
})} })}
</div> </div>
<Modal
keyboard={false}
visible={startbtns}
closable={false}
footer={null}
className="startbtnModal"
centered={true}
>
<Spin size="large" />
</Modal>
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="提示"
@ -760,7 +815,6 @@ class Challenges extends Component {
</div> </div>
</Modal> </Modal>
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="提示"

@ -263,3 +263,27 @@
.boreee{ .boreee{
border-bottom: 1px solid #F4F4F4; border-bottom: 1px solid #F4F4F4;
} }
.challengtes_Item{
display: flex;
justify-content: space-between;
align-items: center;
}
.flex1{
flex: 1;
width: 0;
}
.challengeBtn{
height:40px;
line-height: 38px;
padding:0px 27px;
color: #C0C4CC!important;
font-size: 16px;
border:1px solid rgba(235,235,235,1);
border-radius:4px;
margin-left: 15px;
}
.challengeBtn.blue{
background: #F2F8FE;
border:1px solid rgba(64,158,255,1);
color: #409EFF!important;
}
Loading…
Cancel
Save