竞赛报名调整

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

@ -23,7 +23,8 @@ class CompetitionCommon extends Component{
chart_rules:undefined, chart_rules:undefined,
Competitionedittype:false, Competitionedittype:false,
chartdata:undefined, chartdata:undefined,
has_url:false has_url:false,
signupdata:undefined
} }
} }
@ -230,10 +231,44 @@ class CompetitionCommon extends Component{
} }
} }
}else{ }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)=>{ Competitioncallback=(key)=>{
this.setState({ this.setState({
tabkey:key tabkey:key
@ -255,7 +290,7 @@ class CompetitionCommon extends Component{
render() { render() {
let {data,module_type,Competitionedittype}=this.state; let {data,module_type,Competitionedittype,signupdata}=this.state;
return ( return (
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>
@ -338,7 +373,7 @@ class CompetitionCommon extends Component{
{data.competition_status==="nearly_published"?"未发布":"报名截止"} {data.competition_status==="nearly_published"?"未发布":"报名截止"}
</Button>: </Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}> 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>:""} </Button>:""}
</Col> </Col>
<Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col> <Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col>

Loading…
Cancel
Save