From 6afafd04ef3a42e5cb7e93af97affa75a0913d97 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 17:22:27 +0800 Subject: [PATCH] Merge branches 'dev_Ysl' and 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl # Conflicts: # public/react/src/modules/user/usersInfo/banks/BanksIndex.js --- .../react/src/modules/courses/poll/PollNew.js | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 531d9b3b8..83f2477dc 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2123,6 +2123,12 @@ class PollNew 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; @@ -2137,7 +2143,7 @@ class PollNew extends Component { if (minbool === true && maxbool === true) { for (var i = 0; i < arr.length; i++) { if (index === i) { - arr[i].question.min_choices = parseInt(value); + arr[i].question.min_choices = parseInt(value); } } this.setState({ @@ -2146,18 +2152,8 @@ class PollNew 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 = max; - } - }catch (e) { - arr[i].question.min_choices = 2; - arr[i].question.max_choices = length; - } + arr[i].question.max_choices = length; break; } } @@ -2169,19 +2165,32 @@ class PollNew 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); } } } @@ -2874,7 +2883,7 @@ class PollNew extends Component { value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} > - + {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { return ( indext >= 1 ? : "" @@ -2885,10 +2894,10 @@ class PollNew 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} > @@ -3380,7 +3389,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/}