From cffec8f4f0e4eb301a9c38c0fc09e9fbebb0b3d2 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 23 Aug 2019 10:51:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/boards/BoardsNew.js | 13 +++++++------ .../react/src/modules/courses/busyWork/NewWork.js | 9 +++++---- .../src/modules/courses/exercise/ExerciseNew.js | 6 ++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index f5b11519d..d2b218f3d 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -17,6 +17,7 @@ import {getUploadActionUrl, bytesToSize, uploadNameSizeSeperator, appendFileSize const confirm = Modal.confirm; const $ = window.$ const { Option } = Select; +const MAX_TITLE_LENGTH = 60 // https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=71072679-b925-4824-aceb-4649535e3652 class BoardsNew extends Component{ constructor(props){ @@ -27,7 +28,7 @@ class BoardsNew extends Component{ this.state = { fileList: [], boards: [], - title_num: 60 + title_num: 0 } } addSuccess = () => { @@ -95,7 +96,7 @@ class BoardsNew extends Component{ } }) - this.setState({ fileList: _fileList, board_name: data.board_name, title_num: 60 - parseInt(data.subject.length) }) + this.setState({ fileList: _fileList, board_name: data.board_name, title_num: parseInt(data.subject.length) }) } } }) @@ -233,7 +234,7 @@ class BoardsNew extends Component{ changeTitle=(e)=>{ console.log(e.target.value.length); this.setState({ - title_num: 60 - parseInt(e.target.value.length) + title_num: parseInt(e.target.value.length) }) } goBack = () => { @@ -345,11 +346,11 @@ class BoardsNew extends Component{ rules: [{ required: true, message: '请输入标题', }, { - max: 60, message: '最大限制为60个字符', + max: MAX_TITLE_LENGTH, message: `最大限制为${MAX_TITLE_LENGTH}个字符`, }], })( - + )} diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 410d12a3f..83e792d68 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -9,6 +9,7 @@ import CBreadcrumb from '../common/CBreadcrumb' const confirm = Modal.confirm; const $ = window.$ +const MAX_TITLE_LENGTH = 60; class NewWork extends Component{ constructor(props){ super(props); @@ -17,7 +18,7 @@ class NewWork extends Component{ this.state={ title_value:"", - title_num:60, + title_num: 0, contentFileList: [], answerFileList: [], workLoaded: false, @@ -91,7 +92,7 @@ class NewWork extends Component{ // course_id: data.course_id, // course_name: data.course_name, // category: data.category, - title_num: 60 - parseInt(data.name.length), + title_num: parseInt(data.name.length), workLoaded: true, init_min_num: data.min_num, init_max_num: data.max_num, @@ -125,7 +126,7 @@ class NewWork extends Component{ changeTitle=(e)=>{ console.log(e.target.value.length); this.setState({ - title_num: 60 - parseInt(e.target.value.length) + title_num: parseInt(e.target.value.length) }) } handleSubmit = () => { @@ -398,7 +399,7 @@ class NewWork extends Component{ required: true, message: '请输入标题' }], })( - + )}