From d6a7df567da44ce01357a77cefacc5b085c93fcd Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 4 Jul 2019 17:22:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkSetting.js | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 3f7e5f3ad..72987d2ca 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -231,7 +231,7 @@ class CommonWorkSetting extends Component{ end_time: endTime.format(dateFormat) }) } - if (!this.state.late_time && endTime) { + if (this.state.allow_late && !this.state.late_time && endTime) { this.setState({ late_time: endTime.add(1, 'months').format(dateFormat) }) @@ -265,9 +265,12 @@ class CommonWorkSetting extends Component{ const currentEndTime = this._getCurrentEndTime() let evaluation_start, evaluation_end, evaluation_num = 0, absence_penalty = 0; if (checked) { - if (currentEndTime) { - evaluation_start = moment(currentEndTime).add(7, 'days').format(dateFormat) - evaluation_end = moment(currentEndTime).add(21, 'days').format(dateFormat) + if (this.state.allow_late && this.state.late_time) { + evaluation_start = moment(this.state.late_time).add(14, 'days').format(dateFormat) + evaluation_end = moment(this.state.late_time).add(28, 'days').format(dateFormat) + } else if (currentEndTime) { + evaluation_start = moment(currentEndTime).add(14, 'days').format(dateFormat) + evaluation_end = moment(currentEndTime).add(28, 'days').format(dateFormat) } if (!this.state.evaluation_num) { evaluation_num = 3 @@ -320,11 +323,15 @@ class CommonWorkSetting extends Component{ const { evaluation_end } = this.state; const anonymous_appeal = e.target.checked let appeal_time, appeal_penalty = this.state.appeal_penalty + const currentEndTime = this._getCurrentEndTime() + if (anonymous_appeal) { appeal_penalty = 2 - if (evaluation_end) { - appeal_time = moment(evaluation_end).add(7, 'days').format(dateFormat) - } + if (this.state.allow_late && this.state.late_time) { + appeal_time = moment(this.state.late_time).add(5 * 7, 'days').format(dateFormat) + } else if (currentEndTime) { + appeal_time = moment(currentEndTime).add(5 * 7, 'days').format(dateFormat) + } } else { appeal_time = null; } @@ -386,7 +393,7 @@ class CommonWorkSetting extends Component{ answer_public: e.target.checked }) } - + // 补交设置 允许补交 allow_late_change=(e)=>{ this.setState({ allow_late: e.target.value @@ -401,6 +408,10 @@ class CommonWorkSetting extends Component{ late_time: moment(handleDateString(currentEndTime)).add(1, 'months').format(dateFormat) }) } + } else { + this.setState({ + late_time: null + }) } }