From 35a321b9b3aded13733167b928e681155e5a9f7f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 17 Jul 2019 17:59:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/exercise/new/ShixunEditor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/exercise/new/ShixunEditor.js b/public/react/src/modules/courses/exercise/new/ShixunEditor.js index e4835ee10..29ba724af 100644 --- a/public/react/src/modules/courses/exercise/new/ShixunEditor.js +++ b/public/react/src/modules/courses/exercise/new/ShixunEditor.js @@ -183,9 +183,13 @@ class ShixunEditor extends Component{ // 新建的时候初始化数组 // question_scores.length = chLen - const newArray = []; - while(chLen--) { - newArray.push(5) + let newArray = []; + if (question_scores && question_scores.length && question_scores[0]) { + newArray = question_scores; + } else { + while(chLen--) { + newArray.push(5) + } } this.setState({ ...response.data, question_scores: newArray }) }