From a2219e2aca84e28f01f6a62cb6381b71f2f9bda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 9 Jan 2020 14:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/busyWork/NewWorkForm.js | 37 +++++++++++-------- .../tasks/GraduationTaskssetting.js | 4 +- .../courses/poll/PollDetailTabForth.js | 12 +++--- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 6740f7579..edd83c9e1 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -109,19 +109,21 @@ class NewWorkForm extends Component{ // 输入title changeTitle=(e)=>{ - console.log(e.target.value.length); + this.setState({ title_num: parseInt(e.target.value.length) }) } + + handleSubmit = () => { const courseId = this.state.course_id || this.props.match.params.coursesId ; this.props.form.validateFieldsAndScroll((err, values) => { if(err && err.personNum) delete err.personNum; - console.log(values) + const mdContnet = this.contentMdRef.current.getValue().trim(); - console.log(mdContnet) + values.description = mdContnet; // return; @@ -133,15 +135,19 @@ class NewWorkForm extends Component{ if (isGroup) { if (!min_num) { this.props.showNotification('最小人数不能为空'); + this.props.scrollToAnchor("numberofgroups"); return; } else if (min_num < 1) { this.props.showNotification('最小人数不能小于1'); + this.props.scrollToAnchor("numberofgroups"); return; } else if (!max_num) { this.props.showNotification('最大人数不能为空'); + this.props.scrollToAnchor("numberofgroups"); return; } else if (max_num < min_num) { this.props.showNotification('最大人数不能小于最小人数'); + this.props.scrollToAnchor("numberofgroups"); return; } @@ -254,7 +260,7 @@ class NewWorkForm extends Component{ if (response.data) { const { status } = response.data; if (status == 0) { - console.log('--- success') + this.setState((state) => { const index = state[stateName].indexOf(file); @@ -272,16 +278,16 @@ class NewWorkForm extends Component{ }); } max_num_change = (val) => { - if (val < 2) { - // this.setState({ - // max_num: 2, - // }) - return; - } + // if (val < 2) { + // // this.setState({ + // // max_num: 2, + // // }) + // return; + // } const { min_num } = this.state; this.setState({ max_num: val, - min_num: val <= min_num ? val - 1 : min_num + // min_num: val <= min_num ? val - 1 : min_num }) } personNumValidator = (rule, value, callback) => { @@ -337,7 +343,7 @@ class NewWorkForm extends Component{ onChange: this.handleContentUploadChange, onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), beforeUpload: (file) => { - console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; if (!isLt150M) { this.props.showNotification('文件大小必须小于150MB!'); @@ -356,7 +362,7 @@ class NewWorkForm extends Component{ onChange: this.handleAnswerUploadChange, onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'), beforeUpload: (file) => { - console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; if (!isLt150M) { this.props.showNotification('文件大小必须小于150MB!'); @@ -461,7 +467,7 @@ class NewWorkForm extends Component{ (单个文件150M以内) - + { isGroup &&