From c79b7c4848ca8610aa8a668cb120e4bbe1fa0ef8 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, 31 Aug 2019 11:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/poll/PollNewQuestbank.js | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js index f86e8515d..ea49425d9 100644 --- a/public/react/src/modules/courses/poll/PollNewQuestbank.js +++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js @@ -2185,13 +2185,6 @@ class PollNewQuestbank extends Component { } //最小值 HandleGradationGroupChangee = (value, index, max, length) => { - // console.log("最小值"); - // console.log(value); - // console.log(index); - // console.log(max); - // console.log(length); - - // debugger var minbool = false; var maxbool = false; let arr = this.state.adddom; @@ -2228,30 +2221,24 @@ class PollNewQuestbank extends Component { //最大值 HandleGradationGroupChangeee = (value, index, minchoices, length) => { - // console.log("2112"); - // console.log(value); - // console.log(minchoices); - // console.log("最大值"); - // console.log(value); - // console.log(index); - // console.log(minchoices); - // console.log(length); let arr = this.state.adddom; for (var i = 0; i < arr.length; i++) { if (index === i) { - if (parseInt(value) === 0 && parseInt(minchoices) === 0) { - arr[i].question.min_choices = parseInt(0); + if(parseInt(value)===0&&parseInt(minchoices)===0){ + arr[i].question.min_choices= parseInt(0); arr[i].question.max_choices = parseInt(0); - } else if (parseInt(minchoices) === 0) { - arr[i].question.min_choices = parseInt(2); - arr[i].question.max_choices = parseInt(value); - } else if (parseInt(value) === 0 && parseInt(minchoices) > 0) { - arr[i].question.min_choices = parseInt(minchoices); + }else if(parseInt(minchoices)===0){ + arr[i].question.min_choices= parseInt(2); arr[i].question.max_choices = parseInt(value); - } else { - arr[i].question.min_choices = minchoices === null ? 2 : minchoices === undefined ? 2 : minchoices === 0 ? 2 : parseInt(minchoices); + } + else if(parseInt(value)===0&&parseInt(minchoices)>0){ + arr[i].question.min_choices= parseInt(minchoices); arr[i].question.max_choices = parseInt(value); } + else { + arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); + arr[i].question.max_choices = parseInt(value); + } } } // console.log(2119); @@ -2259,7 +2246,6 @@ class PollNewQuestbank extends Component { this.setState({ adddom: arr }) - // console.log(this.state.adddom); } //提交题目//没有就创建新的题库,新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知 @@ -3044,7 +3030,7 @@ class PollNewQuestbank extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/} this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices)} + onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} > @@ -3674,7 +3660,7 @@ class PollNewQuestbank extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/}