头部调整

dev_sync_trustie
杨树明 5 years ago
parent 40d8a39d3d
commit 86c1c370be

@ -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?"":<div className={"educontent clearfix mt20 "}>
@ -204,10 +257,9 @@ class CompetitionCommon extends Component{
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束
</Button>:
<Button type="primary" block className={"Competitionfontsize22"}>
{data.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?<Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>立即报名</Link>:this.props.current_user&&this.props.current_user.business===true?<Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}></Link>:<a></a>:<Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}></Link>}
</Button>}
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${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>
</Col>

@ -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) => {

Loading…
Cancel
Save