diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index 2d82c34b7..e0044bc34 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -832,6 +832,12 @@ class CoursesIndex extends Component{ render={ (props) => () } + > + {/*修改金品课堂*/} + () + } > {/*修改课堂*/} () } > - {/*修改金品课堂*/} - () - } - > + {/* 实训作业子页面*/} { - var id =1; + var ids =1; try { if(this.state.coursedata.is_public){ - id=1; + ids=1; }else { - id=0; + ids=0; } }catch (e) { } - - - window.location.href = " /courses/" + this.props.match.params.coursesId + "/newgold/settings"+id; + window.location.href = `/courses/${this.props.match.params.coursesId}/newgolds/settings/${ids}`; }; diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index faa64e866..40c4c4f1f 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -29,8 +29,13 @@ function disabledDateTime() { } function disabledDate(current) { + console.log(current); return current && current < moment().endOf('day').subtract(1, 'days'); } +function disabledDateysl(current) { + console.log(current); + return current && current < moment().endOf('day').add(1, 'days'); +} class Goldsubject extends Component { @@ -46,9 +51,56 @@ class Goldsubject extends Component { start_date:"", } } + // disabledEndDate= endValue => { + // const { datatimetwo } = this.state; + // var startValue =datatimetwo + // if (!endValue || !startValue) { + // return false; + // } + // return endValue.valueOf() < startValue.valueOf(); + // }; + + isabledStartDate = (startValue) => { + + const { datatime } = this.state; + var datatimes=""; + if(datatime!==undefined){ + datatimes=datatime; + datatimes=moment(datatimes, dateFormat).subtract(0, 'days');; + }else { + datatimes=datatime; + } + if (!startValue || !datatimes) { + return false; + } + return startValue.valueOf() > datatimes.valueOf(); + }; - componentDidMount() { + disabledEndDate = (endValue) => { + // console.log("---------------------------------") + // console.log(moment(new Date(), dateFormat).add(1, 'days')); + // console.log(moment(new Date(), dateFormat).add(2, 'days')); + const { datatimetwo } = this.state; + var startvalue=""; + if(datatimetwo!==undefined){ + startvalue=datatimetwo; + startvalue=moment(startvalue, dateFormat).add(1, 'days'); + }else { + startvalue=datatimetwo; + } + // console.log("结束时间"); + // console.log(endValue); + // console.log(startvalue); + // console.log(datatimetwo); + if (!endValue || !startvalue) { + return false; + } + return endValue.valueOf() < startvalue.valueOf(); + }; + componentDidMount() { + console.log("新建金品课堂的数据"); + console.log(this.props); let coursesId = this.props.match.params.coursesId; let user_school=this.props.current_user&&this.props.current_user.user_school; @@ -74,16 +126,16 @@ class Goldsubject extends Component { }); // starttime this.setState({ - datatimetwo: data.start_date, - datatime: data.end_date, - is_public: 1, + datatimetwo: data.start_date === undefined ? "" : moment(data.start_date, dateFormat), + datatime: data.end_date === undefined ? "" : moment(data.end_date, dateFormat), + is_public: this.props.match.params.id, Realnamecertification: data.authentication, Professionalcertification:data.professional_certification, name: data.name, class_period: data.class_period, credit: parseFloat(data.credit), course_module_types: data.course_module_types, - school:data.school + school:data.school, }); this.handleSearchschool(data.school); }).catch((error) => { @@ -125,25 +177,42 @@ class Goldsubject extends Component { } } onChangeTimepublishs = (date, dateString) => { + console.log("结束时间11111111111"); + console.log(dateString); + if(dateString===""){ this.setState({ datatime: undefined, }) + this.props.form.setFieldsValue({ + endtime: "", + }); }else{ this.setState({ datatime: dateString, - }) + }); + this.props.form.setFieldsValue({ + endtime:dateString, + }); } }; onChangeTimepublishstwo = (date, dateString) => { + console.log("结束时间22222222222"); + console.log(dateString); if(dateString===""){ this.setState({ datatimetwo: undefined, }) + this.props.form.setFieldsValue({ + starttime: "", + }); }else{ this.setState({ datatimetwo: dateString, }) + this.props.form.setFieldsValue({ + starttime: dateString, + }); } }; cancelmodel = () => { @@ -171,30 +240,34 @@ class Goldsubject extends Component { handleSubmit = (e) => { e.preventDefault(); + let first_category_url=this.props.current_user.first_category_url; let coursesId = this.props.match.params.coursesId; - let {is_public,datatime,datatimetwo} = this.state + var is_public =this.props.match.params.id; + let {datatime,datatimetwo} = this.state // console.log(is_public) if (coursesId != undefined) { // 编辑 this.props.form.validateFields((err, values) => { - + if (err) { + return; + } // if(values.course===""||values.course===undefined){ // this.scrollToAnchor("iscourse") // return // // } - if(values.classroom===""||values.classroom===undefined){ - this.scrollToAnchor("isclassroom") - return - } - - if(values.school===""||values.school===undefined){ - // this.scrollToAnchor("isschool") - return - - } + // if(values.classroom===""||values.classroom===undefined){ + // this.scrollToAnchor("isclassroom") + // return + // } + // + // if(values.school===""||values.school===undefined){ + // // this.scrollToAnchor("isschool") + // return + // + // } if(values.checkboxgroup.length===0){ this.setState({ @@ -220,9 +293,9 @@ class Goldsubject extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - start_date:datatimetwo===undefined?"":datatimetwo, - end_date: datatime===undefined?"":datatime, - is_public: 1, //这是也是带过来的值 + start_date:values.starttime, + end_date: values.endtime, + is_public: is_public, //这是也是带过来的值 course_module_types: values.checkboxgroup, school:values.school } @@ -251,6 +324,9 @@ class Goldsubject extends Component { console.log(error) }) } + + console.log("错误信息信息信息"); + console.log(err); }); } else { this.props.form.validateFields((err, values) => { @@ -279,9 +355,9 @@ class Goldsubject extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - start_date:datatimetwo===undefined?"":datatimetwo, - end_date: datatime===undefined?"":datatime, - is_public: 1, //这是也是带过来的值 + start_date:values.starttime, + end_date: values.endtime, + is_public: is_public, //这是也是带过来的值 course_module_types: values.checkboxgroup, school:values.school } @@ -430,15 +506,17 @@ class Goldsubject extends Component { search: value } }).then((result)=>{ - if (result.data.status===0) { - this.setState({ - searchlistscholl: result.data.school_names, - - }) - if(result.data.school_names.length!=0){ + if(result){ + if (result.data.status===0) { this.setState({ - fetching: false + searchlistscholl: result.data.school_names, + }) + if(result.data.school_names.length!=0){ + this.setState({ + fetching: false + }) + } } } }).catch((error)=>{ @@ -653,9 +731,10 @@ class Goldsubject extends Component { - {getFieldDecorator("starttime")( + {getFieldDecorator("starttime", { + rules: [{type: 'object',required: true, message: "开始时间不能为空"}], + })( @@ -675,9 +754,10 @@ class Goldsubject extends Component { - {getFieldDecorator("endtime")( + {getFieldDecorator("endtime", { + rules: [{type: 'object',required: true, message: "结束时间不能为空"}], + })( @@ -815,6 +895,8 @@ class Goldsubject extends Component { ) } } - const WrappedCoursesNewAppGoldclass = Form.create({name: 'goldsubject'})(Goldsubject); -export default WrappedCoursesNewAppGoldclass; \ No newline at end of file + +export default WrappedCoursesNewAppGoldclass; + +