|
|
|
@ -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,7 +975,6 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
this.props.showNotification(`可选的最大限制不能小于最小限制`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -999,11 +985,11 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if(object.question.min_choices){
|
|
|
|
|
if(object.question.min_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1015,82 +1001,69 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.min_choices>0){
|
|
|
|
|
if(object.question.max_choices){
|
|
|
|
|
if(object.question.max_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
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
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
//插入多选题
|
|
|
|
|
// 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 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 = [];
|
|
|
|
@ -1222,7 +1195,6 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
this.props.showNotification(`可选的最大限制不能小于最小限制`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1233,11 +1205,11 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if(object.question.min_choices){
|
|
|
|
|
if(object.question.min_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1249,11 +1221,11 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.min_choices>0){
|
|
|
|
|
if(object.question.max_choices){
|
|
|
|
|
if(object.question.max_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1266,69 +1238,56 @@ class PollNew extends Component {
|
|
|
|
|
//
|
|
|
|
|
// 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 = [];
|
|
|
|
@ -1393,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,
|
|
|
|
@ -1411,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,
|
|
|
|
@ -1556,11 +1524,11 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if(object.question.min_choices){
|
|
|
|
|
if(object.question.min_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1572,11 +1540,11 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.min_choices>0){
|
|
|
|
|
if(object.question.max_choices){
|
|
|
|
|
if(object.question.max_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1590,56 +1558,56 @@ class PollNew extends Component {
|
|
|
|
|
//
|
|
|
|
|
// 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) {
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
newarrpoll.splice(thiss.state.Insertposition, 0, question);
|
|
|
|
|
} else if (object.question.question_type === 3) {
|
|
|
|
|
//插入主观题
|
|
|
|
|
var answers = [];
|
|
|
|
@ -1758,7 +1726,6 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
this.props.showNotification(`可选的最大限制不能小于最小限制`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1768,11 +1735,11 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if(object.question.min_choices){
|
|
|
|
|
if(object.question.min_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1784,66 +1751,66 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.min_choices>0){
|
|
|
|
|
if(object.question.max_choices){
|
|
|
|
|
if(object.question.max_choices===0){
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
|
|
|
|
|
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 (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)
|
|
|
|
|
|
|
|
|
|
} else if (object.question.question_type === 3) {
|
|
|
|
|
//插入主观题
|
|
|
|
@ -1915,6 +1882,11 @@ class PollNew extends Component {
|
|
|
|
|
q_countst: 0,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(bool === true) {
|
|
|
|
|
this.setState({
|
|
|
|
|
bindingid:undefined,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.Deleteadddom(indexo);
|
|
|
|
|
// console.log(indexo)
|
|
|
|
|
}
|
|
|
|
@ -2096,6 +2068,7 @@ class PollNew extends Component {
|
|
|
|
|
thiss.thisinitializationdatanew();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上下移到服务器中
|
|
|
|
@ -2892,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}题:</span>
|
|
|
|
|
<span
|
|
|
|
@ -2988,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)}
|
|
|
|
@ -3056,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"
|
|
|
|
@ -3091,7 +3064,7 @@ class PollNew extends Component {
|
|
|
|
|
<div style={{minWidth: "1100px"}}>
|
|
|
|
|
<div>
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
|
|
|
|
|
className="color-grey-6 mr20 ml10 font-16 lineh-40 fl">可选</span>
|
|
|
|
|
<div className="mr40 flex1 ">
|
|
|
|
|
{/*可选最小1*/}
|
|
|
|
|
<style>
|
|
|
|
@ -3150,11 +3123,11 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<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)}>新增选项</ActionBtn>
|
|
|
|
@ -3230,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)}
|
|
|
|
@ -3298,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"
|
|
|
|
@ -3396,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)}>新增选项</ActionBtn>
|
|
|
|
@ -3481,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)}
|
|
|
|
@ -3549,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"
|
|
|
|
@ -3647,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)}>新增选项</ActionBtn>
|
|
|
|
|