From 04cd8f4eabe94f139249bd1b4424da0b6919cd2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 30 Aug 2019 18:38:39 +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/poll/PollNewQuestbank.js | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js index ac325df95..38256f389 100644 --- a/public/react/src/modules/courses/poll/PollNewQuestbank.js +++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js @@ -2141,8 +2141,14 @@ 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; @@ -2166,18 +2172,8 @@ class PollNewQuestbank extends Component { } else { for (var i = 0; i < arr.length; i++) { if (index === i) { - try { - if(parseInt(value)===0){ - arr[i].question.min_choices = 2; - arr[i].question.max_choices = length; - }else{ - arr[i].question.min_choices = parseInt(value); - arr[i].question.max_choices = length; - } - }catch (e) { - arr[i].question.min_choices = 2; - arr[i].question.max_choices = length; - } + arr[i].question.min_choices = parseInt(value); + arr[i].question.max_choices = length; break; } } @@ -2189,19 +2185,32 @@ class PollNewQuestbank extends Component { } //最大值 - HandleGradationGroupChangeee = (value, index,minchoices) => { + 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); + 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); arr[i].question.max_choices = parseInt(value); - }else { + } + else { arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); - arr[i].question.max_choices = parseInt(value); + arr[i].question.max_choices = parseInt(value); } } }