import React,{ Component } from "react"; import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd"; import axios from 'axios'; import { SnackbarHOC } from 'educoder'; import Modals from '../../modals/Modals'; const Option = Select.Option; const CheckboxGroup = Checkbox.Group; class sendPanel extends Component{ constructor(props){ super(props); this.state={ sentShixunPath:false, sendToCourseList:undefined, openSearch:false, sendToCourseId:undefined, sendToShixunArray:[], shixunNum:0, Modalstype:false, cardsModalcancel:this.cardsModalcancel, cardsModalsave:this.cardsModalsave, modalsTopval:'', Modalsbottomval:'', courseurl:'' } } //发送至 SentToLesson =() =>{ this.setState({ sentShixunPath:true }) } //隐藏发送至弹框 hideSenttothevalue =()=>{ this.setState({ sentShixunPath:false }) } //打开课堂列表下拉框 openList=()=>{ this.setState({ openSearch:true }) } //关闭课堂列表下拉框 closeList=()=>{ this.setState({ openSearch:false }) } // 选择课堂获取选中的Id selectCloseList=(e)=>{ this.setState({ openSearch:false, sendToCourseId:e }) } //选择checkbox changeCheckBoxs=(list)=>{ this.setState({ sendToShixunArray:list, shixunNum:list.length }) } //确认提交 submitInfo=()=>{ let {sendToCourseId,sendToShixunArray}=this.state; if(sendToCourseId===undefined){ this.props.showSnackbar("您还未选择发送的课堂"); }else if(parseInt(sendToShixunArray.length)==0){ this.props.showSnackbar("您还未选择实训"); }else{ let id=this.props.detailInfoList.id; let url="/paths/"+id+"/send_to_course.json"; axios.post(url,{ shixun_ids:sendToShixunArray, course_id:sendToCourseId }).then((result)=>{ if(result.data.status===1){ this.setState({ Modalstype:true, sentShixunPath:false, Modalstopval:result.data.message, courseurl:result.data.url }) } }).catch((error)=>{ console.log(error); }) } } componentDidMount(){ let id=this.props.detailInfoList.id; let url="/paths/"+id+"/choose_course.json"; axios.get(url).then((result)=>{ if(result.status==200){ this.setState({ sendToCourseList:result.data }) } }).catch((error)=>{ console.log(error); }) } cardsModalcancel=()=>{ this.setState({ Modalstype:false, }) } cardsModalsave=()=>{ let {courseurl}=this.state; window.location.href =courseurl; } render(){ let{sentShixunPath,sendToCourseList,openSearch,shixunNum,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state; return(
) } } export default SnackbarHOC()(sendPanel);