实践课程增加不同状态发布,公开功能

dev_jupyter
杨树明 6 years ago
parent bdbf6f68f7
commit e5253f8c8b

@ -30,6 +30,9 @@ class DetailTop extends Component{
OpenCourseTypes:false, OpenCourseTypes:false,
putappointmenttype:false, putappointmenttype:false,
getappointmenttype:false, getappointmenttype:false,
openpathss:false,
cancel_publics:false,
cancel_has_publics:false
} }
} }
componentDidMount(){ componentDidMount(){
@ -104,61 +107,60 @@ class DetailTop extends Component{
}) })
} }
applyissuePath=()=>{ applyissuePath=()=>{
this.setState({ let pathid=this.props.match.params.pathId;
Modalstype:true, let url ="/paths/"+pathid+"/publish.json";
Modalstopval:"发布申请已提交,请等待管理员的审核", axios.post(url).then((result)=>{
Modalsbottomval:"• 我们将在1-2个工作日内完成审核", if(result.status===200){
loadtype:true if(result.data.status===0){
}) this.props.showNotification(result.data.message)
this.props.getlistdatas();
}else if(result.data.status===1){
// window.location.reload();
}
}
}).catch((error)=>{
console.log(error);
})
} }
postcancelissuePath=()=>{
let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_publish.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
}else if(result.data.status===1){
this.cardsModalcancel()
this.props.showNotification("撤销发布成功")
this.props.getlistdatas()
// window.location.href = "/paths/" + result.data.subject_id
}
}
}).catch((error)=>{
console.log(error);
})
}
cancelissuePath=()=>{ cancelissuePath=()=>{
let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_publish.json";
axios.get(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
}else if(result.data.status===1){
window.location.href = "/paths/" + result.data.subject_id
}
}
}).catch((error)=>{
console.log(error);
})
}
reovkissuePath=()=>{ this.setState({
Modalstype: true,
Modalstopval: "是否确认撤销发布?",
modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
Modalsbottomval:"卡,学员需要重新体验实训",
cardsModalsavetype: true,
modalstyles:"848282"
})
this.setState({
Modalstype:true,
Modalstopval:"是否确认撤销发布",
Modalsbottomval:"确认后,回退到编辑状态",
cardsModalsavetype:true,
})
} }
reovkissuePaths=()=>{
let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_has_publish.json";
axios.get(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
}else if(result.data.status===1){
this.setState({
cardsModalsavetype:false,
loadtype:false,
deletepathtype:false
})
window.location.href = "/paths/" + result.data.subject_id
}
}
}).catch((error)=>{
console.log(error);
})
}
cardsModalcancel=()=>{ cardsModalcancel=()=>{
this.setState({ this.setState({
@ -166,7 +168,14 @@ class DetailTop extends Component{
Modalsbottomval:'', Modalsbottomval:'',
loadtype:false, loadtype:false,
deletepathtype:false, deletepathtype:false,
putappointmenttype:false putappointmenttype:false,
modalsMidval:'',
modalstyles:'',
cardsModalsavetype:false,
applyissuePath:false,
openpathss:false,
cancel_publics:false,
cancel_has_publics:false
}) })
} }
@ -317,6 +326,7 @@ class DetailTop extends Component{
// this.props.getlistdatas() // this.props.getlistdatas()
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
}else{ }else{
this.cardsModalcancel()
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
} }
@ -327,10 +337,93 @@ class DetailTop extends Component{
}) })
} }
postopenpaths=()=>{
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/apply_public.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.props.showNotification(result.data.message)
this.props.getlistdatas();
this.cardsModalcancel()
}else if(result.data.status===1){
this.props.showNotification(result.data.message)
this.props.getlistdatas();
this.cardsModalcancel()
}
}
}).catch((error)=>{
console.log(error);
})
}
openpaths=()=>{
this.setState({
Modalstype: true,
openpathss:true,
Modalstopval: "公开申请已提交,请等待管理员的审核",
modalsMidval:"• 我们将在1-2个工作日内完成审核",
Loadtype:true,
modalstyles:"848282"
})
}
postcancel_public=()=>{
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/cancel_public.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.cardsModalcancel()
this.props.showNotification("撤销申请公开成功")
this.props.getlistdatas();
}
}
}).catch((error)=>{
console.log(error);
})
}
cancel_public=()=>{
this.setState({
cancel_publics:true,
Modalstype: true,
Modalstopval: "是否确认撤销申请公开?",
modalsMidval:" ",
ModalsBottomval:" ",
})
}
postcancel_has_public=()=>{
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/cancel_has_public.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.cardsModalcancel()
this.props.showNotification("撤消公开成功")
this.props.getlistdatas();
}
}
}).catch((error)=>{
console.log(error);
})
}
cancel_has_public=()=>{
this.setState({
cancel_has_publics:true,
Modalstype: true,
Modalstopval: "是否确认撤销公开?",
modalsMidval:" ",
ModalsBottomval:" ",
})
}
render(){ render(){
let{detailInfoList}=this.props; let{detailInfoList}=this.props;
let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype}=this.state; let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics}=this.state;
const radioStyle = { const radioStyle = {
display: 'block', display: 'block',
height: '30px', height: '30px',
@ -367,8 +460,10 @@ class DetailTop extends Component{
modalsTopval={Modalstopval} modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval} modalsBottomval={Modalsbottomval}
modalCancel={cardsModalcancel} modalCancel={cardsModalcancel}
modalSave={cardsModalsavetype===true?()=>this.reovkissuePaths():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()} modalSave={cardsModalsavetype===true?()=>this.postcancelissuePath():openpathss===true?()=>this.postopenpaths():cancel_publics===true?()=>this.postcancel_public():cancel_has_publics===true?()=>this.postcancel_has_public():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()}
loadtype={loadtype} loadtype={loadtype}
modalsMidval={this.state.modalsMidval}
modalstyles={this.state.modalstyles}
> >
</Modals> </Modals>
{this.state.yslJointhe===true?<Jointheclass {...this.props} {...this.state} ysljoinmodalCancel={()=>this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo(this.state.MenuItemskey)}></Jointheclass>:""} {this.state.yslJointhe===true?<Jointheclass {...this.props} {...this.state} ysljoinmodalCancel={()=>this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo(this.state.MenuItemskey)}></Jointheclass>:""}
@ -436,7 +531,7 @@ class DetailTop extends Component{
border:1px solid rgba(255,255,255,1); border:1px solid rgba(255,255,255,1);
} }
.maxwinth600{ .maxwinth600{
width:740px; width:730px;
} }
` `
} }
@ -473,33 +568,48 @@ class DetailTop extends Component{
} }
{ detailInfoList.allow_send === true? { detailInfoList.allow_send === true?
<SendPanel {...this.props} {...this.state}></SendPanel>:"" <SendPanel {...this.props} {...this.state} widths={"80px"}></SendPanel>
:""
} }
{this.props.courses===undefined?"":detailInfoList.is_creator===true?<a className={"fr font-18 color-white kaike mr20 kkbths"} onClick={()=>this.OpenCoursefun()}>开课</a>:""} {this.props.courses===undefined?"":detailInfoList.is_creator===true?<a className={"fr font-18 color-white kaike mr20 kkbths"} style={{'width':'65px'}} onClick={()=>this.OpenCoursefun()}>开课</a>:""}
{ { detailInfoList.allow_statistics===true&& detailInfoList.public_status===2?
detailInfoList.publish_status===2 && detailInfoList.allow_statistics===true? <a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancel_has_public}>撤销公开</a>:""
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.reovkissuePath}>撤销发布</a>:"" }
{detailInfoList.allow_statistics===true&& detailInfoList.public_status===1?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancel_public} style={{width:'135px'}}>撤销申请公开</a>:""
}
{ detailInfoList.publish_status===2&& detailInfoList.allow_statistics===true&& detailInfoList.public_status===0?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.openpaths}>申请公开</a>:""
} }
{ {
detailInfoList.publish_status===1 && detailInfoList.allow_statistics===true? detailInfoList.publish_status===2 && detailInfoList.allow_statistics===true&&detailInfoList.public_status===0?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancelissuePath}>撤销申请</a>:"" <a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancelissuePath}>撤销发布</a>:""
} }
{ {
detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true? detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.applyissuePath}>申请发布</a>:"" <a className="fr font-18 color-white kaike mr20 kkbths"
style={{'width':'65px'}}
onClick={this.applyissuePath}>发布</a>:""
} }
{detailInfoList===undefined?"":detailInfoList.allow_delete===true?<a {detailInfoList===undefined?"":detailInfoList.allow_delete===true?<a
className={"fr font-18 color-white kaike mr20 kkbths"} className={"fr font-18 color-white kaike mr20 kkbths"}
onClick={this.allow_deletepath} onClick={this.allow_deletepath}
style={{'width':'65px'}}
>删除</a>:""} >删除</a>:""}
{detailInfoList===undefined?"":detailInfoList.allow_statistics===true? {detailInfoList===undefined?"":detailInfoList.allow_statistics===true?
<Link to={"/paths/"+this.props.match.params.pathId+"/edit"} className="fr font-18 color-white kaike mr20 kkbths" > <Link to={"/paths/"+this.props.match.params.pathId+"/edit"}
style={{'width':'65px'}}
className="fr font-18 color-white kaike mr20 kkbths" >
编辑 编辑
</Link> </Link>
:"" :""

@ -69,7 +69,7 @@ class sendPanel extends Component{
openSearch:false openSearch:false
}) })
} }
// 选择课堂获取选中的Id // 选择课堂获取选中的Id
selectCloseList=(e)=>{ selectCloseList=(e)=>{
this.setState({ this.setState({
@ -85,7 +85,7 @@ class sendPanel extends Component{
// shixunNum:list.length // shixunNum:list.length
}) })
} }
//确认提交 //确认提交
submitInfo=()=>{ submitInfo=()=>{
let {sendToCourseId,sendToShixunArray}=this.state; let {sendToCourseId,sendToShixunArray}=this.state;
@ -180,7 +180,9 @@ class sendPanel extends Component{
{ {
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_send===true? this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_send===true?
<Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂"> <Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂">
<a onClick = {this.SentToLesson} className="fr font-18 color-white kaike mr20 kkbths"> <a onClick = {this.SentToLesson} className="fr font-18 color-white kaike mr20 kkbths"
style={{width:this.props&&this.props.widths}}
>
发送至 发送至
</a> </a>
</Tooltip>:'' </Tooltip>:''
@ -199,8 +201,8 @@ class sendPanel extends Component{
// onMouseLeave={this.closeList} // onMouseLeave={this.closeList}
> >
<Select <Select
placeholder="请选择您要发送的课堂" placeholder="请选择您要发送的课堂"
style={{"width":"100%"}} style={{"width":"100%"}}
onSelect={this.selectCloseList} onSelect={this.selectCloseList}
// onMouseEnter={this.openList} // onMouseEnter={this.openList}
defaultOpen={false} defaultOpen={false}
@ -217,7 +219,7 @@ class sendPanel extends Component{
{moment( item.created_at ).format('YYYY-MM-DD HH:mm')} {moment( item.created_at ).format('YYYY-MM-DD HH:mm')}
</Col> </Col>
</Row> </Row>
</Option> </Option>
) )
}) })
} }
@ -262,6 +264,6 @@ class sendPanel extends Component{
</div> </div>
) )
} }
} }
export default SnackbarHOC()(sendPanel); export default SnackbarHOC()(sendPanel);
Loading…
Cancel
Save