竞赛报名调整

dev_auth
杨树明 5 years ago
parent de8e126bf8
commit 7b7c44fd18

@ -23,7 +23,8 @@ class CompetitionCommon extends Component{
chart_rules:undefined,
Competitionedittype:false,
chartdata:undefined,
has_url:false
has_url:false,
signupdata:undefined
}
}
@ -230,10 +231,44 @@ class CompetitionCommon extends Component{
}
}
}else{
this.props.history.replace(url);
if(url==="personal"){
this.Personalregistration()
}else{
this.props.history.replace(url);
}
}
}
Personalregistration = () => {
let {signupdata} = this.state;
let urls=`/competitions/${this.props.match.params.identifier}/enroll`;
if (signupdata.enroll_ended === true) {
//已截止
this.props.showNotification(`报名已截止`);
return;
}
if (signupdata.enrolled === true) {
this.props.showNotification(`你已经报名,不能重复报名!`);
return;
}
const url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`;
axios.post(url).then((response) => {
if (response) {
if (response.data) {
this.props.showNotification(`报名成功,预祝您夺得桂冠!`);
this.props.history.replace(urls);
}
}
}).catch((error) => {
});
}
Competitioncallback=(key)=>{
this.setState({
tabkey:key
@ -255,7 +290,7 @@ class CompetitionCommon extends Component{
render() {
let {data,module_type,Competitionedittype}=this.state;
let {data,module_type,Competitionedittype,signupdata}=this.state;
return (
data===undefined?"":<div className={"educontent clearfix mt20 "}>
@ -338,7 +373,7 @@ class CompetitionCommon extends Component{
{data.competition_status==="nearly_published"?"未发布":"报名截止"}
</Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}></a>}
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:signupdata&&signupdata.personal===true?<a onClick={()=>this.gotocourse("personal")}></a>:<a onClick={()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}></a>}
</Button>:""}
</Col>
<Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col>

Loading…
Cancel
Save