diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index a83f799fb..40bf83f5e 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -60,6 +60,22 @@ class CompetitionCommon extends Component{ }).catch((error) => { console.log(error) }) + + // console.log("调用了GetenrollmentAPI"); + const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; + axios.get((zul)).then((result) => { + if (result) { + if (result.data) { + + this.setState({ + signupdata:result.data + }) + + } + } + }).catch((error) => { + //// //////console.log(error); + }) } getrightdatas=(e)=>{ @@ -80,7 +96,7 @@ class CompetitionCommon extends Component{ }) } getrightdata=(id,typeid,module_url,has_url)=>{ - console.log(id,typeid,module_url,has_url) + this.setState({ module_id:id, module_type:typeid @@ -122,10 +138,47 @@ class CompetitionCommon extends Component{ } + gotocourse=(url)=>{ + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + if(this.props.checkIfProfileCompleted()===false){ + this.props.showProfileCompleteDialog() + return + } + if(url===undefined){ + let {data,signupdata}=this.state; + + if(signupdata.enrolled===true){ + this.props.history.replace(`/courses/${data.course_id}`); + }else{ + if(data.member_of_course===true){ + this.props.history.replace(`/courses/${data.course_id}`); + }else{ + // 以学生身份调用加入课堂 进入课堂首页 + let url="/courses/apply_to_join_course.json" + axios.post(url, { + invite_code:data.invite_code, + student:1 + } + ).then((response) => { + if(response.data.status===0){ + this.props.history.replace(`/courses/${data.course_id}`); + } + }) + } + + } + }else{ + this.props.history.replace(url); + } + + } render() { let {data,bannerdata,module_type,Competitionedittype,mdContentdata}=this.state; - console.log(module_type) + return ( data===undefined?"":
@@ -204,10 +257,9 @@ class CompetitionCommon extends Component{ : - } + data.competition_status==="progressing"?:""} {data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`} diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js index f5043f187..8a1bd9fd6 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js @@ -100,7 +100,6 @@ class CompetitionContentsMd extends Component{ md_content_id:this.props.mdContentdata.md_id, competition_module_id:this.props.mdContentdata.id, content:mdContnet, - name:"编辑", attachment_ids:attachment_ids } ).then((response) => {