|
|
|
@ -72,16 +72,19 @@ class CompetitionCommon extends Component{
|
|
|
|
|
}
|
|
|
|
|
//获取头部信息
|
|
|
|
|
getbannerdata=()=>{
|
|
|
|
|
let menuid=this.props.location.search.replace('?menu=', '');
|
|
|
|
|
// let menuid=this.props.location.search.replace('?menu=', '');
|
|
|
|
|
let query=this.props.location&&this.props.location.search;
|
|
|
|
|
const types = query.split('&')
|
|
|
|
|
const menuid = types[0].split('?menu=')
|
|
|
|
|
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
|
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
|
if(response.status===200){
|
|
|
|
|
this.setState({
|
|
|
|
|
data: response.data,
|
|
|
|
|
thiskeys: menuid === undefined || menuid === "" ? response.data.competition_modules[0].id : menuid,
|
|
|
|
|
thiskeys: menuid[1] === undefined || menuid[1] === "" ? response.data.competition_modules[0].id : menuid[1],
|
|
|
|
|
mode: response.data.mode
|
|
|
|
|
})
|
|
|
|
|
if(menuid===undefined||menuid===""){
|
|
|
|
|
if(menuid[1]===undefined||menuid[1]===""){
|
|
|
|
|
this.getrightdata(
|
|
|
|
|
response.data.competition_modules[0].id,
|
|
|
|
|
response.data.competition_modules[0].module_type,
|
|
|
|
@ -91,7 +94,7 @@ class CompetitionCommon extends Component{
|
|
|
|
|
}else{
|
|
|
|
|
let newlist=response.data.competition_modules;
|
|
|
|
|
newlist.map((item,key)=>{
|
|
|
|
|
if(`${item.id}`===`${menuid}`){
|
|
|
|
|
if(`${item.id}`===`${menuid[1]}`){
|
|
|
|
|
this.getrightdata(
|
|
|
|
|
item.id,
|
|
|
|
|
item.module_type,
|
|
|
|
@ -224,6 +227,18 @@ class CompetitionCommon extends Component{
|
|
|
|
|
Competitionedittype:false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
newgotocourse=(url)=>{
|
|
|
|
|
if(this.props.checkIfLogin()===false){
|
|
|
|
|
this.props.showLoginDialog()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(this.props.checkIfProfileCompleted()===false){
|
|
|
|
|
this.props.showProfileCompleteDialog()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
window.open(url);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gotocourse=(url)=>{
|
|
|
|
@ -255,7 +270,9 @@ class CompetitionCommon extends Component{
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if (response.data.status === 0) {
|
|
|
|
|
// this.props.history.replace();
|
|
|
|
|
this.Personalregistration(`/courses/${data.course_id}`)
|
|
|
|
|
this.getbannerdata()
|
|
|
|
|
window.open(`/courses/${data.course_id}`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -267,7 +284,7 @@ class CompetitionCommon extends Component{
|
|
|
|
|
let urls = `/competitions/${this.props.match.params.identifier}/enroll`;
|
|
|
|
|
this.Personalregistration(urls)
|
|
|
|
|
} else {
|
|
|
|
|
this.props.history.replace(url);
|
|
|
|
|
window.open(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -293,6 +310,7 @@ class CompetitionCommon extends Component{
|
|
|
|
|
if (response.data) {
|
|
|
|
|
this.props.showNotification(`报名成功,预祝您夺得桂冠!`);
|
|
|
|
|
// this.props.history.replace(urls);
|
|
|
|
|
this.getbannerdata()
|
|
|
|
|
window.open(urls)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -355,7 +373,15 @@ class CompetitionCommon extends Component{
|
|
|
|
|
className={"color000"}>{data && data.start_time}~{data && data.end_time}</span></Col>
|
|
|
|
|
{/*<Col></Col>*/}
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.ant-col-6{
|
|
|
|
|
width: 30%;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<Col className={"competitionbannerdiv mt10"}>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col className="gutter-row" span={6}>
|
|
|
|
@ -379,8 +405,24 @@ class CompetitionCommon extends Component{
|
|
|
|
|
className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status === "nearly_published" ? "--" : data && data.visits_count}</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col className="gutter-row rankbeicenter" span={6}>
|
|
|
|
|
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516"
|
|
|
|
|
onClick={data.competition_status === "nearly_published" ? "" : () => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status === "nearly_published" ? "--" : data && data.member_count}</div>
|
|
|
|
|
|
|
|
|
|
{data.competition_status === "ended" ?
|
|
|
|
|
<div className={data.mode === 2 ?data.member_of_course==true?"gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer":"gutter-box CompetitionsIndexbottomvalue Competitioncolor516":"gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer"}
|
|
|
|
|
// 已结束onClick={data.competition_status === "nearly_published" ? "" : () => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
|
|
|
|
|
onClick={ data.mode === 2 ?data.member_of_course==true?() => this.newgotocourse(`/courses/${data.course_id}`):"":() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
|
|
|
|
|
>{data && data.member_count}</div>
|
|
|
|
|
:data.competition_status === "nearly_published" ?
|
|
|
|
|
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516"
|
|
|
|
|
// onClick={data.competition_status === "nearly_published" ? "" : () => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
|
|
|
|
|
>{"--"}</div> :
|
|
|
|
|
data.competition_status === "progressing" ?
|
|
|
|
|
data.mode === 2 ?
|
|
|
|
|
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer" onClick={() => this.gotocourse()}>{data && data.member_count}</div> : signupdata && signupdata.personal === true ?
|
|
|
|
|
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer" onClick={() => this.gotocourse("personal")}>{data && data.member_count}</div> : <div
|
|
|
|
|
className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer"
|
|
|
|
|
onClick={() => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data && data.member_count}</div>
|
|
|
|
|
:""}
|
|
|
|
|
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
</Col>
|
|
|
|
|