import React,{ Component } from "react"; import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd"; import axios from 'axios'; const { Search } = Input; class SendTopics extends Component{ constructor(props){ super(props); this.state={ courses:[], search:null, Radiolist:undefined, showcheck:false } } componentDidMount(){ let{search}=this.state; this.onupdatalist(search) } onupdatalist=(search)=>{ let url="/question_banks/my_courses.json"; axios.get(url,{params:{ search } }).then((result)=>{ this.setState({ courses:result.data.courses }) }).catch((error)=>{ console.log(error); }) } onSearchChange=(e)=>{ this.setState({ search:e.target.value }) // this.onupdatalist(e.target.value) } onSearch=(search)=>{ this.onupdatalist(search) } onChange=(e)=>{ this.setState({ Radiolist:e.target.value }) } submitInfo=()=>{ let{Radiolist}=this.state; let url=`/question_banks/send_to_course.json`; let object_id=this.props.checkBoxValues; let object_type=this.props.category; if(Radiolist===undefined){ this.setState({ showcheck:true }) }else{ axios.post(url,{ object_id: object_id, object_type:object_type, course_id:Radiolist } ).then((result)=>{ if(result.data.status===0){ this.props.updataslist() this.props.topicscancelmodel() this.props.showNotification(result.data.message) }else{ this.props.showNotification(result.data.message) } }).catch((error)=>{ console.log(error) }) } } render(){ let{courses,Radiolist,showcheck}= this.state; const radioStyle = { display: 'block', height: '30px', lineHeight: '30px', }; return(
温馨提示:选择的题将会发送到指定课堂
{ courses && courses.map((item,key)=>{ return(
{item.course_name}
) }) }
{showcheck===true?
请先选择课堂
:""}
this.props.topicscancelmodel()} className="pop_close task-btn mr30">取消 this.submitInfo()}>确定
) } } export default SendTopics;