@ -831,20 +831,7 @@ class PollNew extends Component {
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = ( indexo , object , bool ) => {
var thiss = this ;
if ( bool === true ) {
this . setState ( {
q _countst : 1 ,
bindingid : undefined ,
Newdisplay : false ,
newoption : false ,
} )
} else {
this . setState ( {
q _countst : 1 ,
Newdisplay : false ,
newoption : false ,
} )
}
var poll _questionslength = this . state . poll _questions . length ;
// console.log("deleteadddomtwo|||||||||||||||||||||||||||||||||||||||||\\");
@ -988,78 +975,95 @@ class PollNew extends Component {
if ( object . question . max _choices > 0 ) {
if ( object . question . max _choices < object . question . min _choices ) {
this . props . showNotification ( ` 可选的最大限制不能小于最小限制 ` ) ;
return ;
}
}
}
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
if ( object . question . max _choices ) {
if ( object . question . max _choices > 0 ) {
if ( object . question . min _choices ) {
if ( object . question . min _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id" : null ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
var insindex = null ;
if ( this . state . problemtopicbool === true ) {
insindex = this . state . problemtopic ;
if ( object . question . min _choices ) {
if ( object . question . min _choices > 0 ) {
if ( object . question . max _choices ) {
if ( object . question . max _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
}
}
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , insindex , object . question . answers . length ) ;
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于选项数")
// this.props.showNotification(`选择题的最大可选项不能大于选项数`);
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification(`选择题的最大可选项不能小于2项目`);
//
// return;
//
// }
// newarrpoll.push(question);
newarrpoll . splice ( thiss . state . Insertposition , 0 , question ) ;
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id" : null ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
var insindex = null ;
if ( this . state . problemtopicbool === true ) {
insindex = this . state . problemtopic ;
}
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , insindex , object . question . answers . length ) ;
newarrpoll . splice ( thiss . state . Insertposition , 0 , question ) ;
} else if ( object . question . question _type === 3 ) {
//插入主观题
var answers = [ ] ;
@ -1191,79 +1195,99 @@ class PollNew extends Component {
if ( object . question . max _choices > 0 ) {
if ( object . question . max _choices < object . question . min _choices ) {
this . props . showNotification ( ` 可选的最大限制不能小于最小限制 ` ) ;
return ;
}
}
}
if ( object . question . max _choices ) {
if ( object . question . max _choices > 0 ) {
if ( object . question . min _choices ) {
if ( object . question . min _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
}
}
if ( object . question . min _choices ) {
if ( object . question . min _choices > 0 ) {
if ( object . question . max _choices ) {
if ( object . question . max _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification('可选的最大限制不能小于最小限制!');
//
// return;
// }
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
questiontwo = {
"id" : object . question . id ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
if ( uuk !== - 1 ) {
// console.log("修改")
this . edittotheserver ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . answers . length ) ;
newarrpoll . splice ( uuk , 1 , question ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
// console.log("删除")
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . id , object . question . answers . length ) ;
newarrpoll . push ( question ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
questiontwo = {
"id" : object . question . id ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于答案数")
// this.props.showNotification('选择题的最大可选项不能大于选项数!');
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification('选择题的最大可选项不能小于2项目! ');
//
// return;
//
// }
if ( uuk !== - 1 ) {
// console.log("修改")
this . edittotheserver ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . answers . length ) ;
newarrpoll . splice ( uuk , 1 , question ) ;
} else {
// console.log("删除")
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . id , object . question . answers . length ) ;
newarrpoll . push ( question ) ;
}
// console.log(newarrpoll)
newarr [ indexo ] . question . new = "new"
// console.log(newarrpoll)
newarr [ indexo ] . question . new = "new"
} else if ( object . question . question _type === 3 ) {
//插入主观题
var answers = [ ] ;
@ -1328,6 +1352,20 @@ class PollNew extends Component {
this . state . mymainsint = this . state . mymainsint + 1 ;
}
if ( bool === true ) {
this . setState ( {
q _countst : 1 ,
bindingid : undefined ,
Newdisplay : false ,
newoption : false ,
} )
} else {
this . setState ( {
q _countst : 1 ,
Newdisplay : false ,
newoption : false ,
} )
}
this . setState ( {
// poll_questions: newarrpoll,
adddom : newarr ,
@ -1346,11 +1384,6 @@ class PollNew extends Component {
// indexo 第几个数组
//object 单个数组数据
Deleteadddomthree = ( indexo , object , bool ) => {
if ( bool === true ) {
this . setState ( {
bindingid : undefined ,
} )
}
this . setState ( {
Newdisplay : false ,
newoption : false ,
@ -1482,66 +1515,99 @@ class PollNew extends Component {
if ( object . question . max _choices > 0 ) {
if ( object . question . max _choices < object . question . min _choices ) {
this . props . showNotification ( ` 可选的最大限制不能小于最小限制 ` ) ;
return ;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
if ( object . question . max _choices ) {
if ( object . question . max _choices > 0 ) {
if ( object . question . min _choices ) {
if ( object . question . min _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
questiontwo = {
"id" : null ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
if ( object . question . min _choices ) {
if ( object . question . min _choices > 0 ) {
if ( object . question . max _choices ) {
if ( object . question . max _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
}
var insindex = null ;
if ( this . state . problemtopicbool === true ) {
insindex = this . state . problemtopic ;
}
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , insindex , object . question . answers . length ) ;
//插入多选题
// if (object.question.max_choices > arrc.length) {
newarrpoll . splice ( thiss . state . Insertposition , 0 , question ) ;
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
questiontwo = {
"id" : null ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
var insindex = null ;
if ( this . state . problemtopicbool === true ) {
insindex = this . state . problemtopic ;
}
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , insindex , object . question . answers . length ) ;
//插入多选题
// if (object.question.max_choices > arrc.length) {
newarrpoll . splice ( thiss . state . Insertposition , 0 , question ) ;
} else if ( object . question . question _type === 3 ) {
//插入主观题
var answers = [ ] ;
@ -1660,65 +1726,91 @@ class PollNew extends Component {
if ( object . question . max _choices > 0 ) {
if ( object . question . max _choices < object . question . min _choices ) {
this . props . showNotification ( ` 可选的最大限制不能小于最小限制 ` ) ;
return ;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
if ( object . question . max _choices ) {
if ( object . question . max _choices > 0 ) {
if ( object . question . min _choices ) {
if ( object . question . min _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
questiontwo = {
"id" : object . question . id ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
//插入多选题
if ( uuk !== - 1 ) {
// console.log("修改")
this . edittotheserver ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . answers . length ) ;
newarrpoll . splice ( uuk , 1 , question ) ;
} else {
// console.log("删除")
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . id , object . question . answers . length ) ;
newarrpoll . push ( question ) ;
if ( object . question . min _choices ) {
if ( object . question . min _choices > 0 ) {
if ( object . question . max _choices ) {
if ( object . question . max _choices === 0 ) {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
} else {
this . props . showNotification ( ` 可选:最小和最大限制须同时为数值或者“--" ` ) ;
return ;
}
}
}
// console.log(newarrpoll)
var questiontwo = { } ;
var other = [ ] ;
var option = [ ] ;
var answerstwos = [ ] ;
var answerstwoss = [ ] ;
for ( var y = 0 ; y < object . question . answers . length ; y ++ ) {
if ( object . question . answers [ y ] . answer _text === "其他" ) {
var dataone = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
other . push ( object . question . answers [ y ] . answer _text ) ;
answerstwos . push ( dataone ) ;
} else {
var datatwo = {
"answer_id" : object . question . answers [ y ] . answer _id ,
"answer_position" : object . question . answers [ y ] . answer _position ,
"answer_text" : object . question . answers [ y ] . answer _text
}
option . push ( object . question . answers [ y ] . answer _text )
answerstwoss . push ( datatwo ) ;
}
}
var arrc = option . concat ( other ) ;
var answers = answerstwoss . concat ( answerstwos ) ;
questiontwo = {
"id" : object . question . id ,
"is_necessary" : object . question . is _necessary ,
"question_number" : 2 ,
"question_title" : object . question . question _title ,
"question_type" : 2 ,
"max_choices" : object . question . max _choices ,
"min_choices" : object . question . min _choices ,
"new" : "" ,
"answers" : answers
} ;
question = { "question" : questiontwo } ;
//插入多选题
if ( uuk !== - 1 ) {
// console.log("修改")
this . edittotheserver ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . answers . length ) ;
newarrpoll . splice ( uuk , 1 , question ) ;
} else {
// console.log("删除")
this . createquestionsandanswers ( object , 2 , arrc , null , object . question . max _choices , object . question . min _choices , object . question . id , object . question . answers . length ) ;
newarrpoll . push ( question ) ;
}
} else if ( object . question . question _type === 3 ) {
//插入主观题
@ -1790,6 +1882,11 @@ class PollNew extends Component {
q _countst : 0 ,
} )
}
if ( bool === true ) {
this . setState ( {
bindingid : undefined ,
} )
}
this . Deleteadddom ( indexo ) ;
// console.log(indexo)
}
@ -1971,6 +2068,7 @@ class PollNew extends Component {
thiss . thisinitializationdatanew ( ) ;
}
} )
}
//上下移到服务器中
@ -2240,34 +2338,34 @@ class PollNew extends Component {
var minbool = false ;
var maxbool = false ;
let arr = this . state . adddom ;
if ( parseInt ( value ) === 0 || parseInt ( value ) === "0" || parseInt ( value ) === null || parseInt ( value ) === undefined || parseInt ( value ) < 1 ) {
minbool = true ;
}
if ( max === 0 || max === "0" || max === null || max === undefined ) {
maxbool = true ;
}
if ( minbool === true && maxbool === true ) {
for ( var i = 0 ; i < arr . length ; i ++ ) {
if ( index === i ) {
arr [ i ] . question . min _choices = parseInt ( value ) ;
}
}
this . setState ( {
adddom : arr
} )
} else {
// if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
// minbool = true;
// }
// if (max === 0 || max === "0" || max === null || max === undefined) {
// maxbool = true;
// }
//
// if (minbool === true && maxbool === true) {
// for (var i = 0; i < arr.length; i++) {
// if (index === i) {
// arr[i].question.min_choices = parseInt(value);
// }
// }
// this.setState({
// adddom: arr
// })
// } else {
for ( var i = 0 ; i < arr . length ; i ++ ) {
if ( index === i ) {
arr [ i ] . question . min _choices = parseInt ( value ) ;
arr [ i ] . question . max _choices = length ;
// arr[i].question.max_choices = length;
break ;
}
}
this . setState ( {
adddom : arr
} )
}
// }
}
@ -2284,21 +2382,21 @@ class PollNew extends Component {
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 {
arr [ i ] . question . min _choices = minchoices === null ? 2 : minchoices === undefined ? 2 : minchoices === 0 ? 2 : parseInt ( minchoices ) ;
// 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 {
// 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);
@ -2767,7 +2865,7 @@ class PollNew extends Component {
console . log ( this . state . poll _questions ) ;
console . log ( this . state . adddom ) ;
let resultDom ;
resultDom = < div >
resultDom = < div >
< p className = "clearfix font-16" >
< span className = "color-grey-6 fl" > 第 { index + 1 } 题 : < / s p a n >
< span
@ -2777,7 +2875,7 @@ class PollNew extends Component {
{
item . question . question _type === 2 ?
< span style = { { color : "#4B4B4B" } }
className = "font-16 mt10 ml10" > { ( item . question . min _choices === undefined && item . question . max _choices === undefined ? " 不限制 " : item . question . min _choices === null && item . question . max _choices === null ? " 不限制 " : item . question . min _choices === 0 && item . question . max _choices === 0 ? "" : item . question . min _choices === "null" && item . question . max _choices === "null" ? " 不限制 " : "可选" + ( item . question . min _choices === undefined || item . question . min _choices === null || item . question . min _choices === "" || item . question . min _choices === "null" ? 2 : item . question . min _choices ) + "-" + ( item . question . max _choices === undefined || item . question . max _choices === null || item . question . max _choices === "" || item . question . max _choices === "null" ? item . question . answers . length : item . question . max _choices ) + "项" ) } < / s p a n >
className = "font-16 mt10 ml10" > { ( item . question . min _choices === undefined && item . question . max _choices === undefined ? " " : item . question . min _choices === null && item . question . max _choices === null ? " " : item . question . min _choices === 0 && item . question . max _choices === 0 ? "" : item . question . min _choices === "null" && item . question . max _choices === "null" ? " " : item . question . min _choices === item . question . max _choices && item . question . max _choices === item . question . min _choices ? "可选" + ( item . question . max _choices ) + "项" : "可选" + ( item . question . min _choices === undefined || item . question . min _choices === null || item . question . min _choices === "" || item . question . min _choices === "null" ? 2 : item . question . min _choices ) + "-" + ( item . question . max _choices === undefined || item . question . max _choices === null || item . question . max _choices === "" || item . question . max _choices === "null" ? item . question . answers . length : item . question . max _choices ) + "项" ) } < / s p a n >
: ""
}
@ -2863,7 +2961,7 @@ class PollNew extends Component {
resultDomtwo =
< div >
< span
className = "font-16 color-grey-6 mb20" > { itemo . question . question _type === 1 ? "单选题" : itemo . question . question _type === 2 ? "多选题" : "主观题" }
className = "font-16 color-grey-6 mb20" id = { "yslproblms3" } > { itemo . question . question _type === 1 ? "单选题" : itemo . question . question _type === 2 ? "多选题" : "主观题" }
< Checkbox value = { itemo . question . is _necessary }
checked = { itemo . question . is _necessary === 1 ? true : false }
onChange = { ( e ) => this . OnCheckAllChange ( e , indexo ) }
@ -2931,7 +3029,7 @@ class PollNew extends Component {
< div className = "df" >
{ itemo . question . question _type === 1 ? (
< div >
< div className = "ml10" >
< div style = { { minWidth : "1100px" } } >
{ this . state . polls _status === undefined || this . state . polls _status === 1 ?
< ActionBtn style = "grey" className = "mr20 mt5"
@ -2966,7 +3064,7 @@ class PollNew extends Component {
< div style = { { minWidth : "1100px" } } >
< div >
< span
className = "color-grey-6 mr20 font-16 lineh-40 fl"> 可选 < / s p a n >
className = "color-grey-6 mr20 ml10 font-16 lineh-40 fl"> 可选 < / s p a n >
< div className = "mr40 flex1 " >
{ /*可选最小1*/ }
< style >
@ -3025,11 +3123,11 @@ class PollNew extends Component {
}
< / d i v >
< div >
< div >
{ itemo . question . question _type === 2 ?
(
this . state . polls _status === undefined || this . state . polls _status === 1 ?
< div className = "clearfix mt30 " >
< div className = "clearfix mt30 ml10 " >
< div > < ActionBtn style = "grey" className = "mr20 fl mt5"
onClick = { ( ) => this . Ewoption ( itemo . question . id , itemo ) } > 新增选项 < / A c t i o n B t n >
@ -3105,7 +3203,7 @@ class PollNew extends Component {
resultDomtwo =
< div >
< span
className = "font-16 color-grey-6 mb20" > { itemo . question . question _type === 1 ? "单选题" : itemo . question . question _type === 2 ? "多选题" : "主观题" }
className = "font-16 color-grey-6 mb20" id = { "yslproblms2" } > { itemo . question . question _type === 1 ? "单选题" : itemo . question . question _type === 2 ? "多选题" : "主观题" }
< Checkbox value = { itemo . question . is _necessary }
checked = { itemo . question . is _necessary === 1 ? true : false }
onChange = { ( e ) => this . OnCheckAllChange ( e , indexo ) }
@ -3173,7 +3271,7 @@ class PollNew extends Component {
< div className = "df" >
{ itemo . question . question _type === 1 ? (
< div >
< div className = "ml10" >
< div style = { { minWidth : "1100px" } } >
{ this . state . polls _status === undefined || this . state . polls _status === 1 ?
< ActionBtn style = "grey" className = "mr20 mt5"
@ -3271,7 +3369,7 @@ class PollNew extends Component {
{ itemo . question . question _type === 2 ?
(
this . state . polls _status === undefined || this . state . polls _status === 1 ?
< div className = "clearfix mt30 " >
< div className = "clearfix mt30 ml10 " >
< div > < ActionBtn style = "grey" className = "mr20 fl mt5"
onClick = { ( ) => this . Ewoption ( itemo . question . id , itemo ) } > 新增选项 < / A c t i o n B t n >
@ -3356,7 +3454,7 @@ class PollNew extends Component {
resultDomtwo =
< div className = "problemShow" >
< span
className = "font-16 color-grey-6 mb20" > { itemo . question . question _type === 1 ? "单选题" : itemo . question . question _type === 2 ? "多选题" : "主观题" }
className = "font-16 color-grey-6 mb20" id = { "yslproblms" } > { itemo . question . question _type === 1 ? "单选题" : itemo . question . question _type === 2 ? "多选题" : "主观题" }
< Checkbox value = { itemo . question . is _necessary }
checked = { itemo . question . is _necessary === 1 ? true : false }
onChange = { ( e ) => this . OnCheckAllChange ( e , indexo ) }
@ -3424,7 +3522,7 @@ class PollNew extends Component {
< div className = "df" >
{ itemo . question . question _type === 1 ? (
< div >
< div className = "ml10" >
< div style = { { minWidth : "1100px" } } >
{ polls _status === undefined || polls _status === 1 ?
< ActionBtn style = "grey" className = "mr20 mt5"
@ -3522,7 +3620,7 @@ class PollNew extends Component {
{ itemo . question . question _type === 2 ?
(
polls _status === undefined || polls _status === 1 ?
< div className = "clearfix mt30 " >
< div className = "clearfix mt30 ml10 " >
< div > < ActionBtn style = "grey" className = "mr20 fl mt5"
onClick = { ( ) => this . Ewoption ( itemo . question . id , itemo ) } > 新增选项 < / A c t i o n B t n >