import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon } from "antd";
import axios from'axios';
import Modals from '../../modals/Modals';
const Search = Input.Search;
class PathModal extends Component{
constructor(props){
super(props);
this.state={
StudentList_value:"",
Searchvalue:undefined,
type:'all',
page:1,
patheditarry:undefined
}
}
hidecouseShixunModal=()=>{
this.props.hidecouseShixunModal()
}
//tag
changeTag=(types)=>{
let {Searchvalue}=this.state;
this.setState({
type:types,
page:1,
})
this.props.funshixunpathlist(Searchvalue,types,true,1)
}
//搜索
SenttotheValue=(e)=>{
this.setState({
Searchvalue:e.target.value
})
}
SenttotheSearch=(value)=>{
let{type}=this.state;
this.setState({
page:1,
})
this.props.funshixunpathlist(value,type,true,1)
}
//勾选实训
shixunhomeworkedit=(list)=>{
this.setState({
patheditarry:list
})
// this.props.funpatheditarry(newpatheditarry)
}
contentViewScrolledit=(e)=>{
//滑动到底判断
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
let {Searchvalue,type,page,shixunpathlist}=this.state;
let newpage=page+1
this.props.funshixunpathlist(Searchvalue,type,true,newpage)
this.setState({
page:newpage
})
}
}
//提交
savecouseShixunModal=()=>{
let {patheditarry}=this.state;
let {coursesId,Coursename,page,order,category_id,datas}=this.props;
let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json";
if(patheditarry===undefined){
this.setState({
patheditarrytype:true,
patheditarryvalue:"请先选择实训课程"
})
return
}else if(patheditarry.length===0){
this.setState({
patheditarrytype:true,
patheditarryvalue:"请先选择实训课程"
})
return
}
axios.post(url, {
// category_id: datas&&datas.category_name===undefined||datas&&datas.category_name===null?undefined:category_id,
subject_ids:patheditarry,
}
).then((response) => {
if(response.data.status===-1){
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalsBottomval:"",
// ModalSave:this.cancelmodel,
// Loadtype:true
// })
this.props.showNotification(response.data.message)
}else{
// this.homeworkstart
//调用立即发布弹窗
this.props.hidecouseShixunModal();
this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
// this.props.showNotification("选用成功")
// this.props.showNotification(response.data.message)
// this.props.homeworkupdatalists(Coursename,page,order);
}
// if(response.status===200) {
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
// }
}).catch((error) => {
console.log(error)
})
}
render(){
let {Searchvalue,type,Modalstype}=this.state;
let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props;
const antIcon =