From ee4ec2a2371509e5d4b8d174e39a5c9feebdfe3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 24 Aug 2019 22:03:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/gradinforms/Bullsubdirectory.js | 45 +++++++---- .../modules/courses/gradinforms/Eduinforms.js | 78 +++++++++++++++---- 2 files changed, 92 insertions(+), 31 deletions(-) diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index c0f66d55a..c7f773190 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -60,20 +60,25 @@ class Bullsubdirectory extends Component{ }; changeTopicName = (e) => { console.log("调用了changeTopicName"); - let num = parseInt(e.target.value.length); + let num = e.target.value.length; + if(num>60){ return; } this.setState({ addonAfter: num < 0 ? 0 : num }); - this.setState({ - eduintits: e.target.value - }) + if(num<=60){ + this.setState({ + eduintits: e.target.value + }) + + this.props.form.setFieldsValue({ + eduintits: e.target.value, + }); + } + - this.props.form.setFieldsValue({ - eduintits: e.target.value, - }); } handleSubmit=(e) => { e.preventDefault(); @@ -91,11 +96,25 @@ class Bullsubdirectory extends Component{ } var id=this.props.match.params.coursesId - + var titname=""; + try { + if(values.eduintits.length>0){ + if( values.eduintits.length>60){ + var str=values.eduintits; + titname=str.substring(0,60); + }else { + titname=values.eduintits; + } + }else { + titname=values.eduintits; + } + }catch (e) { + titname=values.eduintits; + } var url = `/courses/${id}/update_informs.json`; axios.post(url,{ inform_id:this.state.id, - name:values.eduintits, + name:titname, description:values.description, }).then((result) => { if(result){ @@ -103,13 +122,13 @@ class Bullsubdirectory extends Component{ if(result.data.status === 0){ this.props.form.setFieldsValue({ id:this.state.id, - eduintits:values.eduintits, + eduintits:titname, description:values.description, }); this.setState({ whethertoeditysl:false, id:this.state.id, - eduintits:values.eduintits, + eduintits:titname, description:values.description, }); this.props.getinputdata(); @@ -192,8 +211,6 @@ class Bullsubdirectory extends Component{ {getFieldDecorator('eduintits',{ initialValue: this.state.eduintits }, { rules: [{ required: true, message: '请在此输入标题,最多60个字符', - }, { - max: 60, message: '最大限制为60个字符', }], })(
开发社区
+实训项目
DEVELOPMENT COMMUNITY
-
- {data && data.name} - { - data && is_current == false && data.identity =="学生" ? "" : - - } -
-
-
+ {data && data.name} + { + data && is_current == false && data.identity =="学生" ? "" : + + } +
+
+
- { - is_edit && is_current ? - - : - is_current ? - {sign || "这家伙很懒,什么都没留下~"} - : - {sign || "这家伙很懒,什么都没留下~"} - } -
- { - is_current ? - - : -+ { + is_edit && is_current ? + + : + is_current ? + {sign || "这家伙很懒,什么都没留下~"} + : + {sign || "这家伙很懒,什么都没留下~"} + } +
+ { + is_current ? + + : +