From 25168fae80ed99f4199aa28329465a4d7f479145 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 6 Sep 2019 18:10:14 +0800 Subject: [PATCH] isGroup --- .../modules/courses/busyWork/NewWorkForm.js | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 33d6e4cda..6083252bc 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -110,23 +110,27 @@ class NewWorkForm extends Component{ {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} // 已有提交作品,人数范围只能扩大 const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; - if (!min_num) { - this.props.showNotification('最小人数不能为空'); - return; - } else if (min_num < 1) { - this.props.showNotification('最小人数不能小于1'); - return; - } else if (!max_num) { - this.props.showNotification('最大人数不能为空'); - return; - } else if (max_num < min_num) { - this.props.showNotification('最大人数不能小于最小人数'); - return; - } - if (has_commit) { - if (max_num < init_max_num || min_num > init_min_num) { - this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) + const isGroup = this.props.isGroup() + if (isGroup) { + if (!min_num) { + this.props.showNotification('最小人数不能为空'); return; + } else if (min_num < 1) { + this.props.showNotification('最小人数不能小于1'); + return; + } else if (!max_num) { + this.props.showNotification('最大人数不能为空'); + return; + } else if (max_num < min_num) { + this.props.showNotification('最大人数不能小于最小人数'); + return; + } + + if (has_commit) { + if (max_num < init_max_num || min_num > init_min_num) { + this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) + return; + } } }