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 && +

{/* max={has_commit ? init_min_num : null } */} @@ -508,6 +514,7 @@ class NewWorkForm extends Component{ } +

{ let {latetime,end_time,allowlate,commenttime,commenttimeone}=this.state; let commenttimetype=commenttime===null||commenttime===""; -debugger + let newlatetimea=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm"); let newcommenttimea=moment(new Date()).format("YYYY-MM-DD HH:mm"); @@ -388,7 +388,7 @@ debugger let newcommenttimed=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm"); if(e.target.checked===true){ - debugger + if(allowlate===1||allowlate===true){ if(latetime===null||latetime===""){ diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index f5c49f0fe..076e1dbec 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -111,8 +111,10 @@ class PollDetailTabForth extends Component{ } // 已有设置数据的查询 - getSettingInfo=()=>{ - this.props.newgetPollInfo(); + getSettingInfo=(type)=>{ + if(type!=1){ + this.props.newgetPollInfo(); + } let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/poll_setting.json`; axios.get(url).then((result)=>{ @@ -254,7 +256,7 @@ class PollDetailTabForth extends Component{ this.commitSetting((result)=>{ if(result.status==200){ this.props.showNotification(`${result.data.message}`); - this.getSettingInfo(); + this.getSettingInfo(1); this.setState({ flagPageEdit:false }) @@ -275,7 +277,7 @@ class PollDetailTabForth extends Component{ this.commitSetting((result)=>{ if(result.status==200){ this.props.showNotification(`${result.data.message}`); - this.getSettingInfo(); + this.getSettingInfo(1); this.setState({ flagPageEdit:false }) @@ -453,7 +455,7 @@ class PollDetailTabForth extends Component{ this.setState({ flagPageEdit:false }) - this.getSettingInfo(); + this.getSettingInfo(1); }