dev_aliyun_beta
杨树林 6 years ago
parent c5b41a2892
commit c79b7c4848

@ -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">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => 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}
>
<Option value={String("0")}>--</Option>
@ -3354,7 +3340,7 @@ class PollNewQuestbank extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => 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}
>
<Option value={String("0")}>--</Option>
@ -3674,7 +3660,7 @@ class PollNewQuestbank extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => 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}
>
<Option value={String("0")}>--</Option>

Loading…
Cancel
Save