diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js index ff6a8855d..5d201fac2 100644 --- a/public/react/src/modules/courses/busyWork/PublishRightnow.js +++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js @@ -33,9 +33,11 @@ class PublishRightnow extends Component{ } homeworkstart=()=>{ - const isPublish = this.props.isPublish; + const isPublish = this.props.isPublish; + let showdatatypes=isPublish===true||isPublish===1; + if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) { - this.props.showNotification(`请先选择要立即${isPublish ? "发布" : "截止"}的作业`) + this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`) return; } @@ -46,25 +48,26 @@ class PublishRightnow extends Component{ showDialog = () => { const isPublish = this.props.isPublish; const dateFormat = 'YYYY-MM-DD HH:mm'; - - // getNextHalfHourOfMoment + let showdatatype=isPublish===true&&isPublish!=1; + let showdatatypes=isPublish===true||isPublish===1; + // getNextHalfHourOfMoment const startMoment = (moment()); this.setState({ - modalname: isPublish ? "立即发布" : "立即截止", + modalname: showdatatypes ? "立即发布" : "立即截止", modaltype:1, - visible:isPublish?false:true, - OneSelftype:isPublish?true:false, - Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品", + visible:showdatatype?false:true, + OneSelftype:showdatatype?true:false, + Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品", // Botvalleft: isPublish ? "暂不发布" : "暂不截止", - Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '', - starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '', - starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '', - endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', - Cancelname:isPublish ? "暂不发布" : "暂不截止", - Savesname:isPublish ? "立即发布" : "立即截止", + Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '', + starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '', + starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '', + endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', + Cancelname:showdatatypes ? "暂不发布" : "暂不截止", + Savesname:showdatatypes ? "立即发布" : "立即截止", Cancel:this.homeworkhide, Saves:this.homeworkstartend, - typs:isPublish ? "start" : "end", + typs:showdatatypes ? "start" : "end", }) } homeworkhide=()=>{ @@ -124,14 +127,15 @@ class PublishRightnow extends Component{ detail:true } } - + + let showdatatypes=isPublish===true||isPublish===1; let coursesId=this.props.match.params.coursesId; - const url = `/courses/${coursesId}/homework_commons/${isPublish ? "publish_homework" : "end_homework"}.json` + const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json` axios.post(url, data) .then((response) => { if (response.data.status == 0) { this.homeworkhide() - this.props.showNotification(isPublish ? "立即发布成功" : "立即截止成功") + this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功") this.props.doWhenSuccess && this.props.doWhenSuccess() this.setState({ visible : false }) this.props.action && this.props.action() @@ -147,13 +151,15 @@ class PublishRightnow extends Component{ // } // } fetchCourseGroups = () => { + const isPublish = this.props.isPublish; + let showdatatypes=isPublish===true||isPublish===1; let coursesId=this.props.match.params.coursesId; // TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668 // /homework_commons/:id/publish_groups.json let url = `/courses/${coursesId}/all_course_groups.json` if (this.props.checkBoxValues.length == 1) { const isPublish = this.props.isPublish; - url = `/homework_commons/${this.props.checkBoxValues[0]}/${ isPublish ? 'publish_groups' : 'end_groups'}.json` + url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json` } axios.get(url, { @@ -176,7 +182,7 @@ class PublishRightnow extends Component{ render(){ const isPublish = this.props.isPublish; - + let showdatatypes=isPublish===true||isPublish===1; let{ Topvalright, modalname, @@ -239,7 +245,7 @@ class PublishRightnow extends Component{ starttimesend={this.state.starttimesend} typs={this.state.typs} /> - { showActionButton && { isPublish ? "立即发布" : "立即截止" } } + { showActionButton && { showdatatypes ? "立即发布" : "立即截止" } } ) } diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index f6a989354..bf54e130c 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -431,7 +431,7 @@ class commonWork extends Component{ > + isPublish={1} doWhenSuccess={this.doWhenSuccess} fromListPage={true}> { mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js index 87a43ca1b..a07347b40 100644 --- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js +++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js @@ -161,7 +161,21 @@ class OneSelfOrderModal extends Component{ } onChangeTimeendlist=(date, dateString,id)=>{ - let {course_groups}=this.state; + let {course_groups,endtimetypeid}=this.state; + if(endtimetypeid===id){ + if(date!=null){ + this.setState({ + endtimetypeid:undefined + }) + } + if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{ + if(date!=null){ + this.setState({ + endtimetypeid:undefined + }) + } + } + } let arr=course_groups; arr.map((item,key)=>{ @@ -219,6 +233,13 @@ class OneSelfOrderModal extends Component{ // arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")) }else{ + if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){ + this.setState({ + endtimetype:true, + endtimetypevalue:"必须晚于发布时间" + }) + return + } arr.push(items.end_time) } } @@ -256,6 +277,7 @@ class OneSelfOrderModal extends Component{ render(){ let {group_ids,endtime,course_groups}=this.state; // console.log(course_groups) + let course_groupstype=course_groups===undefined||course_groups.length===0; // TODO course_groups为空时的处理 return(
@@ -377,7 +399,7 @@ class OneSelfOrderModal extends Component{
} {this.props.modaltype===undefined||this.props.modaltype===2 - || this.props.usingCheckBeforePost ?"":
:""}