dev_cs
杨树明 5 years ago
parent e4385832d1
commit bf56efef22

@ -117,6 +117,49 @@ class NewShixunModel extends Component{
let{type,page,status,diff,order,limit}=this.state;
this.getdatalist(page,type,status,value,order,diff,limit)
}
savecouseShixunModal=()=>{
this.setState({
hometypepvisible:true
})
let {coursesId}=this.props;
let{Grouplist}=this.state;
if(Grouplist.length===0){
this.setState({
hometypepvisible:false
})
this.props.showNotification("请先选择实训")
return
}
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
axios.post(url, {
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
shixun_ids:Grouplist,
}
).then((response) => {
if(response.data.status===-1){
// this.props.showNotification(response.data.message)
}else{
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
this.props.showNotification("选择成功")
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
this.props.hideNewShixunModelType()
}
this.setState({
hometypepvisible:false
})
// category_id: 3
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
}).catch((error) => {
console.log(error)
})
}
render() {
let {diff,Grouplist,shixun_list,shixuns_count,page,type,order}=this.state;
@ -310,7 +353,7 @@ class NewShixunModel extends Component{
<div className={" edu-txt-center padding20-30"}>
<Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
<Button className={"newshixunmode"} type="primary">确定</Button>
<Button className={"newshixunmode"} type="primary" onClick={()=>this.savecouseShixunModal()}>确定</Button>
</div>
</div>

@ -958,8 +958,14 @@ class ShixunHomework extends Component{
{NewShixunModelType===true?<NewShixunModel
{...this.props}
{...this.state}
category_id={this.props.match.params.category_id}
type={'shixuns'}
hideNewShixunModelType={()=>this.hideNewShixunModelType()}
coursesId={this.props.match.params.coursesId}
homeworkupdatalists={(Coursename,page,order)=>this.homeworkupdatalist(Coursename,page,order)}
Coursename={Coursename}
page={page}
order={order}
/>:""}

Loading…
Cancel
Save