|
|
@ -94,7 +94,13 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化数据
|
|
|
|
// 初始化数据
|
|
|
|
componentDidMount = () => {
|
|
|
|
componentDidMount = () => {
|
|
|
|
console.log("componentDidMount 50")
|
|
|
|
// console.log("componentDidMount 50")
|
|
|
|
|
|
|
|
if( this.props.isStudent() === true){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.props.history.push("/403")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
if (this.props.match.params.news !== undefined) {
|
|
|
|
if (this.props.match.params.news !== undefined) {
|
|
|
|
if (this.props.match.params.news === "new") {
|
|
|
|
if (this.props.match.params.news === "new") {
|
|
|
|
this.state.Newedit === true;
|
|
|
|
this.state.Newedit === true;
|
|
|
@ -137,12 +143,12 @@ class PollNew extends Component {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//初始化请求网络
|
|
|
|
//初始化请求网络
|
|
|
|
Initializatio_data = () => {
|
|
|
|
Initializatio_data = () => {
|
|
|
|
console.log("Initializatio_data 582")
|
|
|
|
// console.log("Initializatio_data 582")
|
|
|
|
//课堂id
|
|
|
|
//课堂id
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
//时间id
|
|
|
|
//时间id
|
|
|
|
let pollid = this.props.match.params.pollid;
|
|
|
|
let pollid = this.props.match.params.pollid;
|
|
|
|
console.log(pollid);
|
|
|
|
// console.log(pollid);
|
|
|
|
// let coursesId = 557;
|
|
|
|
// let coursesId = 557;
|
|
|
|
if (pollid === undefined) {
|
|
|
|
if (pollid === undefined) {
|
|
|
|
// console.log("没有问卷新建问卷~~~")
|
|
|
|
// console.log("没有问卷新建问卷~~~")
|
|
|
@ -223,8 +229,8 @@ class PollNew extends Component {
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
questionnair: true,
|
|
|
|
questionnair: true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log(this.state.polls_nametest)
|
|
|
|
// console.log(this.state.polls_nametest)
|
|
|
|
console.log(this.state.polls_descriptiontest)
|
|
|
|
// console.log(this.state.polls_descriptiontest)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
@ -321,7 +327,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//添加多选题目
|
|
|
|
//添加多选题目
|
|
|
|
addmydoubles = () => {
|
|
|
|
addmydoubles = () => {
|
|
|
|
console.log("addmymainsint 70")
|
|
|
|
// console.log("addmymainsint 70")
|
|
|
|
if (this.state.newoption === true) {
|
|
|
|
if (this.state.newoption === true) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
newoption: false
|
|
|
|
newoption: false
|
|
|
@ -361,7 +367,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//编辑方法
|
|
|
|
//编辑方法
|
|
|
|
adddomedit = (object) => {
|
|
|
|
adddomedit = (object) => {
|
|
|
|
console.log("adddomedit 76");
|
|
|
|
// console.log("adddomedit 76");
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
|
@ -512,11 +518,12 @@ class PollNew extends Component {
|
|
|
|
//新增添加题目 有new
|
|
|
|
//新增添加题目 有new
|
|
|
|
addMytopic = (index, pollid, Insertposition, Whether, id) => {
|
|
|
|
addMytopic = (index, pollid, Insertposition, Whether, id) => {
|
|
|
|
//Whether 是否插入
|
|
|
|
//Whether 是否插入
|
|
|
|
// console.log("id")
|
|
|
|
// console.log("addMytopic 90")
|
|
|
|
// console.log(id)
|
|
|
|
// console.log(index)
|
|
|
|
// console.log("Whether")
|
|
|
|
// console.log(pollid)
|
|
|
|
|
|
|
|
// console.log(Insertposition)
|
|
|
|
// console.log(Whether)
|
|
|
|
// console.log(Whether)
|
|
|
|
console.log("addMytopic 90")
|
|
|
|
// console.log(id)
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
|
@ -718,7 +725,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//删除指定条目
|
|
|
|
//删除指定条目
|
|
|
|
deleteadddom = (indexo) => {
|
|
|
|
deleteadddom = (indexo) => {
|
|
|
|
console.log("deleteadddom 259")
|
|
|
|
// console.log("deleteadddom 259")
|
|
|
|
var arr = this.state.adddom;
|
|
|
|
var arr = this.state.adddom;
|
|
|
|
let newarr = [...arr];
|
|
|
|
let newarr = [...arr];
|
|
|
|
|
|
|
|
|
|
|
@ -758,7 +765,7 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log("PollNew281")
|
|
|
|
// console.log("PollNew281")
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -779,19 +786,21 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (maxtie < 3) {
|
|
|
|
|
|
|
|
if (object.question.question_type === 1) {
|
|
|
|
|
|
|
|
this.props.showNotification(`选项不能少于3个!`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (object.question.question_type === 1) {
|
|
|
|
|
|
|
|
if (maxtie < 2) {
|
|
|
|
|
|
|
|
this.props.showNotification(`选项不能少于2个!`);
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (object.question.question_type === 2) {
|
|
|
|
} else if (object.question.question_type === 2) {
|
|
|
|
|
|
|
|
if (maxtie < 3) {
|
|
|
|
this.props.showNotification(`选项不能少于3个!`);
|
|
|
|
this.props.showNotification(`选项不能少于3个!`);
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (object.question.question_type === 2) {
|
|
|
|
if (object.question.question_type === 2) {
|
|
|
|
if (object.question.max_choices > 0) {
|
|
|
|
if (object.question.max_choices > 0) {
|
|
|
@ -1004,7 +1013,7 @@ class PollNew extends Component {
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////// 上面是新增
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////// 上面是新增
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////修改点了编辑
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////修改点了编辑
|
|
|
|
console.log("点了编辑")
|
|
|
|
// console.log("点了编辑")
|
|
|
|
var uuk = -1
|
|
|
|
var uuk = -1
|
|
|
|
//这个地方判断 点了编辑上面题目又把他删除了 保存的时候就只能是插入新增了
|
|
|
|
//这个地方判断 点了编辑上面题目又把他删除了 保存的时候就只能是插入新增了
|
|
|
|
for (var uk = 0; uk < newarrpoll.length; uk++) {
|
|
|
|
for (var uk = 0; uk < newarrpoll.length; uk++) {
|
|
|
@ -1130,15 +1139,15 @@ class PollNew extends Component {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if (uuk !== -1) {
|
|
|
|
if (uuk !== -1) {
|
|
|
|
console.log("修改")
|
|
|
|
// console.log("修改")
|
|
|
|
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
|
|
|
|
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("删除")
|
|
|
|
// console.log("删除")
|
|
|
|
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
|
|
|
|
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(newarrpoll)
|
|
|
|
// console.log(newarrpoll)
|
|
|
|
newarr[indexo].question.new = "new"
|
|
|
|
newarr[indexo].question.new = "new"
|
|
|
|
} else if (object.question.question_type === 3) {
|
|
|
|
} else if (object.question.question_type === 3) {
|
|
|
|
//插入主观题
|
|
|
|
//插入主观题
|
|
|
@ -1176,15 +1185,15 @@ class PollNew extends Component {
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
|
|
|
|
|
|
|
|
if (uuk !== -1) {
|
|
|
|
if (uuk !== -1) {
|
|
|
|
console.log("修改")
|
|
|
|
// console.log("修改")
|
|
|
|
this.edittotheserver(object, 3, null, null, 0, 0);
|
|
|
|
this.edittotheserver(object, 3, null, null, 0, 0);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("删除")
|
|
|
|
// console.log("删除")
|
|
|
|
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
|
|
|
|
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(newarrpoll)
|
|
|
|
// console.log(newarrpoll)
|
|
|
|
newarr[indexo].question.new = "new"
|
|
|
|
newarr[indexo].question.new = "new"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1259,17 +1268,19 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (maxtie < 3) {
|
|
|
|
|
|
|
|
if (object.question.question_type === 1) {
|
|
|
|
if (object.question.question_type === 1) {
|
|
|
|
this.props.showNotification('选项不能少于3个!');
|
|
|
|
if (maxtie < 2) {
|
|
|
|
|
|
|
|
this.props.showNotification('选项不能少于2个!');
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (object.question.question_type === 2) {
|
|
|
|
} else if (object.question.question_type === 2) {
|
|
|
|
|
|
|
|
if (maxtie < 3) {
|
|
|
|
this.props.showNotification('选项不能少于3个!');
|
|
|
|
this.props.showNotification('选项不能少于3个!');
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (object.question.question_type === 2) {
|
|
|
|
if (object.question.question_type === 2) {
|
|
|
|
if (object.question.max_choices > 0) {
|
|
|
|
if (object.question.max_choices > 0) {
|
|
|
@ -1453,7 +1464,7 @@ class PollNew extends Component {
|
|
|
|
for (var uk = 0; uk < newarrpoll.length; uk++) {
|
|
|
|
for (var uk = 0; uk < newarrpoll.length; uk++) {
|
|
|
|
if (object.question.id === newarrpoll[uk].question.id) {
|
|
|
|
if (object.question.id === newarrpoll[uk].question.id) {
|
|
|
|
uuk = uk;
|
|
|
|
uuk = uk;
|
|
|
|
console.log("删除了数据=-09876543234567890-111111111111")
|
|
|
|
// console.log("删除了数据=-09876543234567890-111111111111")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1501,15 +1512,15 @@ class PollNew extends Component {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
if (uuk !== -1) {
|
|
|
|
if (uuk !== -1) {
|
|
|
|
console.log("修改")
|
|
|
|
// console.log("修改")
|
|
|
|
this.edittotheserver(object, 1, arrc, null, 0, 0);
|
|
|
|
this.edittotheserver(object, 1, arrc, null, 0, 0);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("删除")
|
|
|
|
// console.log("删除")
|
|
|
|
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
|
|
|
|
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(newarrpoll)
|
|
|
|
// console.log(newarrpoll)
|
|
|
|
} else if (object.question.question_type === 2) {
|
|
|
|
} else if (object.question.question_type === 2) {
|
|
|
|
//插入多选题
|
|
|
|
//插入多选题
|
|
|
|
if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
if (object.question.max_choices < object.question.min_choices) {
|
|
|
@ -1557,15 +1568,15 @@ class PollNew extends Component {
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
//插入多选题
|
|
|
|
//插入多选题
|
|
|
|
if (uuk !== -1) {
|
|
|
|
if (uuk !== -1) {
|
|
|
|
console.log("修改")
|
|
|
|
// console.log("修改")
|
|
|
|
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
|
|
|
|
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("删除")
|
|
|
|
// console.log("删除")
|
|
|
|
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
|
|
|
|
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(newarrpoll)
|
|
|
|
// console.log(newarrpoll)
|
|
|
|
|
|
|
|
|
|
|
|
} else if (object.question.question_type === 3) {
|
|
|
|
} else if (object.question.question_type === 3) {
|
|
|
|
//插入主观题
|
|
|
|
//插入主观题
|
|
|
@ -1602,15 +1613,15 @@ class PollNew extends Component {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
question = {"question": questiontwo};
|
|
|
|
if (uuk !== -1) {
|
|
|
|
if (uuk !== -1) {
|
|
|
|
console.log("修改")
|
|
|
|
// console.log("修改")
|
|
|
|
this.edittotheserver(object, 3, null, null, 0, 0);
|
|
|
|
this.edittotheserver(object, 3, null, null, 0, 0);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
newarrpoll.splice(uuk, 1, question);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("删除")
|
|
|
|
// console.log("删除")
|
|
|
|
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
|
|
|
|
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
newarrpoll.push(question);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(newarrpoll)
|
|
|
|
// console.log(newarrpoll)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1693,7 +1704,7 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///编辑修改到服务器当中
|
|
|
|
///编辑修改到服务器当中
|
|
|
|
edittotheserver = (object, number, option, other, max_choices, min_choices) => {
|
|
|
|
edittotheserver = (object, number, option, other, max_choices, min_choices) => {
|
|
|
|
console.log("调用了edittotheserver")
|
|
|
|
// console.log("调用了edittotheserver")
|
|
|
|
var url = `/poll_questions/${object.question.id}.json`
|
|
|
|
var url = `/poll_questions/${object.question.id}.json`
|
|
|
|
var thiss = this;
|
|
|
|
var thiss = this;
|
|
|
|
axios.put(url, {
|
|
|
|
axios.put(url, {
|
|
|
@ -1720,7 +1731,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//删除到服务器当中
|
|
|
|
//删除到服务器当中
|
|
|
|
eletetoserver = (pollid, newarr, type, index) => {
|
|
|
|
eletetoserver = (pollid, newarr, type, index) => {
|
|
|
|
console.log("调用了eletetoserver")
|
|
|
|
// console.log("调用了eletetoserver")
|
|
|
|
var id = pollid;
|
|
|
|
var id = pollid;
|
|
|
|
var url = `/poll_questions/${id}.json`
|
|
|
|
var url = `/poll_questions/${id}.json`
|
|
|
|
let {mysingles, mydoubles, mymainsint} = this.state
|
|
|
|
let {mysingles, mydoubles, mymainsint} = this.state
|
|
|
@ -1729,7 +1740,7 @@ class PollNew extends Component {
|
|
|
|
axios
|
|
|
|
axios
|
|
|
|
.delete(url, {})
|
|
|
|
.delete(url, {})
|
|
|
|
.then(function (response) {
|
|
|
|
.then(function (response) {
|
|
|
|
console.log(response)
|
|
|
|
// console.log(response)
|
|
|
|
if (response === undefined) {
|
|
|
|
if (response === undefined) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1774,7 +1785,7 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log("上移题目成功 错误")
|
|
|
|
// console.log("上移题目成功 错误")
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1792,7 +1803,7 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log("下移题目成功 错误")
|
|
|
|
// console.log("下移题目成功 错误")
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -1804,8 +1815,8 @@ class PollNew extends Component {
|
|
|
|
//id 条目的唯一id
|
|
|
|
//id 条目的唯一id
|
|
|
|
//i 为要删除的子条目
|
|
|
|
//i 为要删除的子条目
|
|
|
|
deleteentrys = (id, i, stirngname) => {
|
|
|
|
deleteentrys = (id, i, stirngname) => {
|
|
|
|
console.log(id)
|
|
|
|
// console.log(id)
|
|
|
|
console.log(stirngname);
|
|
|
|
// console.log(stirngname);
|
|
|
|
var arrtwoy = this.state.adddom;
|
|
|
|
var arrtwoy = this.state.adddom;
|
|
|
|
let newarrtwoy = [...arrtwoy];
|
|
|
|
let newarrtwoy = [...arrtwoy];
|
|
|
|
for (var k = 0; k < newarrtwoy.length; k++) {
|
|
|
|
for (var k = 0; k < newarrtwoy.length; k++) {
|
|
|
@ -1822,14 +1833,14 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (stirngname === true) {
|
|
|
|
if (stirngname === true) {
|
|
|
|
console.log(stirngname);
|
|
|
|
// console.log(stirngname);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
newoption: false,
|
|
|
|
newoption: false,
|
|
|
|
adddom: newarrtwoy,
|
|
|
|
adddom: newarrtwoy,
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log(stirngname);
|
|
|
|
// console.log(stirngname);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
adddom: newarrtwoy,
|
|
|
|
adddom: newarrtwoy,
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1841,8 +1852,8 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
// 新增选项
|
|
|
|
// 新增选项
|
|
|
|
ewoption = (id, object) => {
|
|
|
|
ewoption = (id, object) => {
|
|
|
|
console.log("ewoption 440")
|
|
|
|
// console.log("ewoption 440")
|
|
|
|
console.log("是否是新建题目还是编辑")
|
|
|
|
// console.log("是否是新建题目还是编辑")
|
|
|
|
// console.log(object.question.new)
|
|
|
|
// console.log(object.question.new)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1903,10 +1914,10 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//新增其他选项
|
|
|
|
//新增其他选项
|
|
|
|
addanotheroption = (id) => {
|
|
|
|
addanotheroption = (id) => {
|
|
|
|
console.log("addanotheroption 457")
|
|
|
|
// console.log("addanotheroption 457")
|
|
|
|
let arrtwo = this.state.adddom;
|
|
|
|
let arrtwo = this.state.adddom;
|
|
|
|
let newarrtwo = [...arrtwo];
|
|
|
|
let newarrtwo = [...arrtwo];
|
|
|
|
console.log(newarrtwo)
|
|
|
|
// console.log(newarrtwo)
|
|
|
|
for (var k = 0; k < newarrtwo.length; k++) {
|
|
|
|
for (var k = 0; k < newarrtwo.length; k++) {
|
|
|
|
if (newarrtwo[k] != undefined) {
|
|
|
|
if (newarrtwo[k] != undefined) {
|
|
|
|
if (newarrtwo[k].question.id === id) {
|
|
|
|
if (newarrtwo[k].question.id === id) {
|
|
|
@ -1928,10 +1939,10 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//点击向上排序按钮事件
|
|
|
|
//点击向上排序按钮事件
|
|
|
|
handleClickBySortUp = (index, object) => {
|
|
|
|
handleClickBySortUp = (index, object) => {
|
|
|
|
console.log("handleClickBySortUp 521")
|
|
|
|
// console.log("handleClickBySortUp 521")
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
let newarr = [...arr];
|
|
|
|
let newarr = [...arr];
|
|
|
|
console.log(newarr)
|
|
|
|
// console.log(newarr)
|
|
|
|
if (index != 0) {
|
|
|
|
if (index != 0) {
|
|
|
|
this.Upanddownmovementof(true, object.question.id);
|
|
|
|
this.Upanddownmovementof(true, object.question.id);
|
|
|
|
let temp = newarr[index - 1];
|
|
|
|
let temp = newarr[index - 1];
|
|
|
@ -1945,7 +1956,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//点击向下排序按钮事件
|
|
|
|
//点击向下排序按钮事件
|
|
|
|
handleClickBySortDown = (index, object) => {
|
|
|
|
handleClickBySortDown = (index, object) => {
|
|
|
|
console.log("handleClickBySortDown 536")
|
|
|
|
// console.log("handleClickBySortDown 536")
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
let newarr = [...arr];
|
|
|
|
let newarr = [...arr];
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -1958,16 +1969,16 @@ class PollNew extends Component {
|
|
|
|
poll_questions: newarr,
|
|
|
|
poll_questions: newarr,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("2222index==arr.length");
|
|
|
|
// console.log("2222index==arr.length");
|
|
|
|
console.log(this.state.poll_questions);
|
|
|
|
// console.log(this.state.poll_questions);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//点击删除按钮事件
|
|
|
|
//点击删除按钮事件
|
|
|
|
handleClickByDelete = (type, index, object) => {
|
|
|
|
handleClickByDelete = (type, index, object) => {
|
|
|
|
console.log("handleClickByDelete 556")
|
|
|
|
// console.log("handleClickByDelete 556")
|
|
|
|
console.log("object.question.id")
|
|
|
|
// console.log("object.question.id")
|
|
|
|
console.log(object.question.id)
|
|
|
|
// console.log(object.question.id)
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
let newarr = [...arr];
|
|
|
|
let newarr = [...arr];
|
|
|
|
this.eletetoserver(object.question.id, newarr, type, index)
|
|
|
|
this.eletetoserver(object.question.id, newarr, type, index)
|
|
|
@ -1979,11 +1990,11 @@ class PollNew extends Component {
|
|
|
|
//i外层数组
|
|
|
|
//i外层数组
|
|
|
|
//k为内层数组
|
|
|
|
//k为内层数组
|
|
|
|
handleInputChanges = (e, i, k) => {
|
|
|
|
handleInputChanges = (e, i, k) => {
|
|
|
|
console.log("handleInputChanges 612")
|
|
|
|
// console.log("handleInputChanges 612")
|
|
|
|
|
|
|
|
|
|
|
|
let value = e.target.value;//取到input的数据
|
|
|
|
let value = e.target.value;//取到input的数据
|
|
|
|
console.log("handleInputChanges value is :" + value);
|
|
|
|
// console.log("handleInputChanges value is :" + value);
|
|
|
|
console.log(k);
|
|
|
|
// console.log(k);
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
let newarr = [...arr];
|
|
|
|
let newarr = [...arr];
|
|
|
|
|
|
|
|
|
|
|
@ -1996,11 +2007,11 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//标题输入监听
|
|
|
|
//标题输入监听
|
|
|
|
handleInputTopic = (e, i) => {
|
|
|
|
handleInputTopic = (e, i) => {
|
|
|
|
console.log("handleInputTopic 633")
|
|
|
|
// console.log("handleInputTopic 633")
|
|
|
|
|
|
|
|
|
|
|
|
let value = e.target.value;//取到input的数据
|
|
|
|
let value = e.target.value;//取到input的数据
|
|
|
|
console.log("handleInputTopic value is :" + value);
|
|
|
|
// console.log("handleInputTopic value is :" + value);
|
|
|
|
console.log(i);
|
|
|
|
// console.log(i);
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
let newarr = [...arr];
|
|
|
|
let newarr = [...arr];
|
|
|
|
newarr[i].question.question_title = value
|
|
|
|
newarr[i].question.question_title = value
|
|
|
@ -2063,7 +2074,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
//提交题目//没有就创建新的题库,新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
|
|
|
|
//提交题目//没有就创建新的题库,新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
|
|
|
|
submitQuestionnaire = (mews) => {
|
|
|
|
submitQuestionnaire = (mews) => {
|
|
|
|
console.log("调用了submitQuestionnaire")
|
|
|
|
// console.log("调用了submitQuestionnaire")
|
|
|
|
if (this.state.Newedit === true) {
|
|
|
|
if (this.state.Newedit === true) {
|
|
|
|
|
|
|
|
|
|
|
|
this.newword();
|
|
|
|
this.newword();
|
|
|
@ -2120,7 +2131,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
savedelete = (question_type, index, item) => {
|
|
|
|
savedelete = (question_type, index, item) => {
|
|
|
|
console.log("savedelete");
|
|
|
|
// console.log("savedelete");
|
|
|
|
this.handleClickByDelete(question_type, index, item);
|
|
|
|
this.handleClickByDelete(question_type, index, item);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Modalstype: false,
|
|
|
|
Modalstype: false,
|
|
|
@ -2141,8 +2152,8 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//必答选项
|
|
|
|
//必答选项
|
|
|
|
onCheckAllChange = (e, index) => {
|
|
|
|
onCheckAllChange = (e, index) => {
|
|
|
|
console.log("onCheckAllChange");
|
|
|
|
// console.log("onCheckAllChange");
|
|
|
|
console.log(e.target.checked);
|
|
|
|
// console.log(e.target.checked);
|
|
|
|
// console.log(e.target.value);
|
|
|
|
// console.log(e.target.value);
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
@ -2328,6 +2339,25 @@ class PollNew extends Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
|
|
|
|
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.state.mysave === false ?
|
|
|
|
|
|
|
|
<div className="padding20-30" style={{ background: '#fff'}}>
|
|
|
|
|
|
|
|
<div className="displayTitle font-16">
|
|
|
|
|
|
|
|
<span>{this.state.polls_nametest}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a className="fr" onClick={() => { this.adddomeditit() }} style={{ lineHeight: '32px'}}>
|
|
|
|
|
|
|
|
<Tooltip title="编辑"><i className="iconfont icon-bianjidaibeijing font-20 color-green"></i></Tooltip>
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="displayDescription color-grey-9" dangerouslySetInnerHTML={{__html: this.state.polls_descriptiontest}}
|
|
|
|
|
|
|
|
style={{whiteSpace: 'pre-wrap'}}
|
|
|
|
|
|
|
|
></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
:""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.state.mysave === true ?
|
|
|
|
<div className="edu-back-white">
|
|
|
|
<div className="edu-back-white">
|
|
|
|
<div className="createPage bor-bottom-greyE">
|
|
|
|
<div className="createPage bor-bottom-greyE">
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
@ -2349,11 +2379,7 @@ class PollNew extends Component {
|
|
|
|
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a></span>
|
|
|
|
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
: "")
|
|
|
|
: "")
|
|
|
|
:
|
|
|
|
:""
|
|
|
|
<div className="fr">
|
|
|
|
|
|
|
|
<span><a onClick={() => this.adddomeditit()}><Tooltip title="编辑"><i
|
|
|
|
|
|
|
|
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a></span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -2416,7 +2442,11 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>:""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p className="clearfix padding20-30 color-grey-9">
|
|
|
|
<p className="clearfix padding20-30 color-grey-9">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2495,8 +2525,8 @@ class PollNew extends Component {
|
|
|
|
(<RadioGroup defaultChecked={false} disabled>
|
|
|
|
(<RadioGroup defaultChecked={false} disabled>
|
|
|
|
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
|
|
|
|
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={"h20 mt20 mb20 "} style={{"clear": "both"}}>
|
|
|
|
<div className="h20 pt20" style={{"clear": "both"}}>
|
|
|
|
<Radio value={i} className={"fl"} style={{"text-align": "left"}}></Radio>
|
|
|
|
<Radio value={i} className={"fl"} style={{"text-align": "left",marginTop:"3px"}}></Radio>
|
|
|
|
{/*<pre className={"break_word flex1 fl"}*/}
|
|
|
|
{/*<pre className={"break_word flex1 fl"}*/}
|
|
|
|
{/* style={{"text-align": "left"}}>{items.answer_text}</pre>*/}
|
|
|
|
{/* style={{"text-align": "left"}}>{items.answer_text}</pre>*/}
|
|
|
|
{/*<span className={"break_word flex1"}><pre className={"break_word flex1"}>{items.answer_text}</pre> </span>*/}
|
|
|
|
{/*<span className={"break_word flex1"}><pre className={"break_word flex1"}>{items.answer_text}</pre> </span>*/}
|
|
|
@ -2510,7 +2540,7 @@ class PollNew extends Component {
|
|
|
|
(<CheckboxGroup defaultChecked={false} disabled>
|
|
|
|
(<CheckboxGroup defaultChecked={false} disabled>
|
|
|
|
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
|
|
|
|
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="mt10 mt20 mb20 " style={{"clear": "both"}}>
|
|
|
|
<div className="mt10 pt20 " style={{"clear": "both"}}>
|
|
|
|
<Checkbox value={i} className={"fl"} style={{"text-align": "left"}}></Checkbox>
|
|
|
|
<Checkbox value={i} className={"fl"} style={{"text-align": "left"}}></Checkbox>
|
|
|
|
<span className={" flex1"} style={{"text-align": "left","white-space":"pre-wrap","word-break": "break-all","word-wrap": "break-word","float": "left","width":"1120px"}}>{items.answer_text}</span>
|
|
|
|
<span className={" flex1"} style={{"text-align": "left","white-space":"pre-wrap","word-break": "break-all","word-wrap": "break-word","float": "left","width":"1120px"}}>{items.answer_text}</span>
|
|
|
|
|
|
|
|
|
|
|
@ -2536,7 +2566,7 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
{this.state.adddom === undefined ? "" : this.state.adddom.map((itemo, indexo) => {
|
|
|
|
{this.state.adddom === undefined ? "" : this.state.adddom.map((itemo, indexo) => {
|
|
|
|
// console.log('打印this.state.adddom')
|
|
|
|
// console.log('打印this.state.adddom')
|
|
|
|
// console.log(itemo.question)
|
|
|
|
// console.log(this.state.adddom);
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
let resultDomtwo;
|
|
|
|
let resultDomtwo;
|
|
|
|
resultDomtwo =
|
|
|
|
resultDomtwo =
|
|
|
@ -2769,7 +2799,7 @@ class PollNew extends Component {
|
|
|
|
this.props.match.params.news === "new" ?
|
|
|
|
this.props.match.params.news === "new" ?
|
|
|
|
this.state.Newedit === false ?
|
|
|
|
this.state.Newedit === false ?
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className=" mb10" style={{"border-bottom": "1px solid #eee"}}></div>
|
|
|
|
<div className=" mb10" style={this.state.adddom === undefined?{"border-bottom": "0.5px solid #ffffff"}:this.state.adddom.length <1? {"border-bottom": "0.5px solid #ffffff"}:{"border-bottom": "0.5px solid #eee"}}></div>
|
|
|
|
|
|
|
|
|
|
|
|
<div style={{"padding": "10px 30px 20px 30px"}}>
|
|
|
|
<div style={{"padding": "10px 30px 20px 30px"}}>
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
@ -2784,7 +2814,7 @@ class PollNew extends Component {
|
|
|
|
: ""
|
|
|
|
: ""
|
|
|
|
:
|
|
|
|
:
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className=" mb10" style={{"border-bottom": "1px solid #eee"}}></div>
|
|
|
|
<div className=" mb10" style={this.state.adddom === undefined? {"border-bottom": "0.5px solid #ffffff"}:this.state.adddom.length <1? {"border-bottom": "0.5px solid #ffffff"}:{"border-bottom": "0.5px solid #eee"}}></div>
|
|
|
|
<div style={{"padding": "10px 30px 20px 30px"}}>
|
|
|
|
<div style={{"padding": "10px 30px 20px 30px"}}>
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>
|
|
|
|