|
|
|
@ -812,6 +812,7 @@ class PollNew extends Component {
|
|
|
|
|
problemtopicbool: false,
|
|
|
|
|
bindingid:undefined,
|
|
|
|
|
Newdisplay:false,
|
|
|
|
|
newoption: false,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
@ -821,6 +822,7 @@ class PollNew extends Component {
|
|
|
|
|
problemtopic: null,
|
|
|
|
|
problemtopicbool: false,
|
|
|
|
|
Newdisplay:false,
|
|
|
|
|
newoption: false,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -834,12 +836,13 @@ class PollNew extends Component {
|
|
|
|
|
q_countst: 1,
|
|
|
|
|
bindingid:undefined,
|
|
|
|
|
Newdisplay:false,
|
|
|
|
|
|
|
|
|
|
newoption: false,
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
this.setState({
|
|
|
|
|
q_countst: 1,
|
|
|
|
|
Newdisplay:false,
|
|
|
|
|
newoption: false,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1350,6 +1353,7 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
Newdisplay:false,
|
|
|
|
|
newoption: false,
|
|
|
|
|
})
|
|
|
|
|
// console.log("deleteadddom 349")
|
|
|
|
|
var thiss = this;
|
|
|
|
@ -1752,7 +1756,7 @@ class PollNew extends Component {
|
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
|
if (uuk !== -1) {
|
|
|
|
|
// console.log("修改")
|
|
|
|
|
this.edittotheserver(object, 3, null, null, 0, 0,0,0);
|
|
|
|
|
this.edittotheserver(object, 3, null, null, 0, 0,0);
|
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
|
} else {
|
|
|
|
|
// console.log("删除")
|
|
|
|
@ -1799,27 +1803,49 @@ class PollNew extends Component {
|
|
|
|
|
var urlly = `/polls/${poll_id}/poll_questions.json`
|
|
|
|
|
var max_choicess = null;
|
|
|
|
|
var min_choicess = null;
|
|
|
|
|
if (max_choices === 0 && min_choices === 0) {
|
|
|
|
|
try {
|
|
|
|
|
if (max_choices === 0 && min_choices === 0) {
|
|
|
|
|
max_choicess = null;
|
|
|
|
|
min_choicess = null;
|
|
|
|
|
} else {
|
|
|
|
|
max_choicess = max_choices;
|
|
|
|
|
min_choicess = min_choices;
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
max_choicess = null;
|
|
|
|
|
min_choicess = null;
|
|
|
|
|
} else {
|
|
|
|
|
max_choicess = max_choices;
|
|
|
|
|
min_choicess = min_choices;
|
|
|
|
|
}
|
|
|
|
|
console.log("createquestionsandanswers");
|
|
|
|
|
console.log(max_choicess);
|
|
|
|
|
console.log(min_choicess);
|
|
|
|
|
console.log(length);
|
|
|
|
|
axios.post(urlly, {
|
|
|
|
|
// console.log("createquestionsandanswers");
|
|
|
|
|
// console.log(max_choicess);
|
|
|
|
|
// console.log(min_choicess);
|
|
|
|
|
// console.log(length);
|
|
|
|
|
var datay={};
|
|
|
|
|
datay={
|
|
|
|
|
question_title: object.question.question_title,
|
|
|
|
|
question_type: number,
|
|
|
|
|
is_necessary: object.question.is_necessary,
|
|
|
|
|
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
|
|
|
|
|
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
|
|
|
|
|
question_answers: option,
|
|
|
|
|
question_other_answer: null,
|
|
|
|
|
insert_id: insert_id
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
if(number===2){
|
|
|
|
|
datay={
|
|
|
|
|
question_title: object.question.question_title,
|
|
|
|
|
question_type: number,
|
|
|
|
|
is_necessary: object.question.is_necessary,
|
|
|
|
|
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
|
|
|
|
|
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
|
|
|
|
|
question_answers: option,
|
|
|
|
|
question_other_answer: null,
|
|
|
|
|
insert_id: insert_id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
axios.post(urlly, datay).then((result) => {
|
|
|
|
|
// try {
|
|
|
|
|
if (result !== undefined) {
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
@ -1852,27 +1878,50 @@ class PollNew extends Component {
|
|
|
|
|
var thiss = this;
|
|
|
|
|
var max_choicess = null;
|
|
|
|
|
var min_choicess = null;
|
|
|
|
|
if (max_choices === 0 && min_choices === 0) {
|
|
|
|
|
try {
|
|
|
|
|
if (max_choices === 0 && min_choices === 0) {
|
|
|
|
|
max_choicess = null;
|
|
|
|
|
min_choicess = null;
|
|
|
|
|
} else {
|
|
|
|
|
max_choicess = max_choices;
|
|
|
|
|
min_choicess = min_choices;
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
max_choicess = null;
|
|
|
|
|
min_choicess = null;
|
|
|
|
|
} else {
|
|
|
|
|
max_choicess = max_choices;
|
|
|
|
|
min_choicess = min_choices;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log("createquestionsandanswers");
|
|
|
|
|
// console.log(max_choicess);
|
|
|
|
|
// console.log(min_choicess);
|
|
|
|
|
// console.log(length);
|
|
|
|
|
axios.put(url, {
|
|
|
|
|
var datay={};
|
|
|
|
|
datay={
|
|
|
|
|
// debug: true,
|
|
|
|
|
question_title: object.question.question_title,
|
|
|
|
|
question_type: number,
|
|
|
|
|
is_necessary: object.question.is_necessary,
|
|
|
|
|
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
|
|
|
|
|
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
|
|
|
|
|
question_answers: option,
|
|
|
|
|
question_other_answer: null,
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
};
|
|
|
|
|
try {
|
|
|
|
|
if(number===2){
|
|
|
|
|
datay={
|
|
|
|
|
// debug: true,
|
|
|
|
|
question_title: object.question.question_title,
|
|
|
|
|
question_type: number,
|
|
|
|
|
is_necessary: object.question.is_necessary,
|
|
|
|
|
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
|
|
|
|
|
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
|
|
|
|
|
question_answers: option,
|
|
|
|
|
question_other_answer: null,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
axios.put(url,datay).then((result) => {
|
|
|
|
|
try {
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
this.props.showNotification(`编辑题目成功`);
|
|
|
|
|