import React,{ Component } from "react"; import { Modal,Checkbox,DatePicker} from "antd"; import { handleDateString } from 'educoder'; import locale from 'antd/lib/date-picker/locale/zh_CN'; import moment from 'moment'; const CheckboxGroup = Checkbox.Group; const dateFormat = 'YYYY-MM-DD HH:mm'; function range(start, end) { const result = []; for (let i = start; i < end; i++) { result.push(i); } return result; } function disabledDateTime() { return { // disabledHours: () => range(0, 24).splice(4, 20), disabledMinutes: () => range(1, 30).concat(range(31, 60)), // disabledSeconds: () => [55, 56], }; } function disabledDate(current) { return current && current < moment().endOf('day').subtract(1, 'days'); } class HomeworkModal extends Component{ constructor(props){ super(props); this.state={ group_ids:[], endtime:"" } } componentDidMount() { if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){ let arr=this.props.course_groups.map(item => item.id); this.shixunhomeworkedit(arr); } if(this.props.starttimes!=undefined&&this.props.starttimes!=""){ if(this.props.starttimesend!=undefined&&this.props.starttimesend!=""){ this.setState({ endtime:this.props.starttimesend, }) }else { this.setState({ endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm") }) } } } componentDidUpdate=(prevProps)=>{ // if(prevProps.visible!=this.props.visible){ // // if(this.props.course_groups!=undefined){ // let arr=this.props.course_groups.map(item => item.id); // this.shixunhomeworkedit(arr); // } // } if(prevProps.course_groups!=this.props.course_groups){ if(this.props.course_groups!=undefined){ let arr=this.props.course_groups.map(item => item.id); this.shixunhomeworkedit(arr); } } if(prevProps.starttimes!=this.props.starttimes){ if(this.props.starttimes!=undefined&&this.props.starttimes!=""){ if(this.props.starttimesend!=undefined&&this.props.starttimesend!=""){ this.setState({ endtime:this.props.starttimesend, }) }else{ this.setState({ endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm") }) } } } } //勾选实训 shixunhomeworkedit=(list)=>{ this.setState({ group_ids:list }) this.props.getcourse_groupslist && this.props.getcourse_groupslist(list) } onChangeTimeend= (date, dateString) => { // console.log('startValue',dateString); this.setState({ endtime: date===null?"":handleDateString(dateString), }) } propsSaves=(ds,endtime)=>{ if(ds.length ===0&&endtime === ""){ this.props.Saves() }else{ if(this.props.typs!="end"){ if(endtime === ""||endtime===undefined||endtime===null){ this.setState({ endtimetype:true, endtimetypevalue:"截止时间不能为空" }) return } if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){ this.setState({ endtimetype:true, endtimetypevalue:"必须晚于发布时间" }) return } } this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm")) } } render(){ let {group_ids,endtime}=this.state; let {course_groups}=this.props; // console.log(this.props.starttimes) // console.log(this.state.endtime) // console.log(this.props.starttime,this.props.endtime) // TODO course_groups为空时的处理 // let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months') return(
发布设置均可修改, 点击修改
此设置将对所有分班生效
{this.props.Topval} {this.props.Topvalright}
{this.props.Botvalleft===undefined?"":"{this.props.Botvalleft}"} {this.props.Botval}
{this.props.starttime}
{/*{this.props.endtime}*/}
截止时间: