|
|
|
@ -2250,51 +2250,52 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
//提交题目//没有就创建新的题库,新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
|
|
|
|
|
submitQuestionnaire = () => {
|
|
|
|
|
this.props.history.push(`/banks/poll/${pollid}`);
|
|
|
|
|
// console.log("调用了submitQuestionnaire")
|
|
|
|
|
if (this.state.Newedit === true) {
|
|
|
|
|
|
|
|
|
|
this.newword();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
|
|
|
|
|
this.props.showNotification("请输入标题");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.state.polls_descriptiontest.length > 100) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var pollid;
|
|
|
|
|
if (this.state.pollid === undefined) {
|
|
|
|
|
pollid = this.props.match.params.workid;
|
|
|
|
|
} else {
|
|
|
|
|
pollid = this.state.pollid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if(mews ==="new"){
|
|
|
|
|
if (this.state.poll_questions && this.state.poll_questions.length === 0) {
|
|
|
|
|
this.props.showNotification("至少创建1个题目");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
var url = `/polls/${pollid}.json`;
|
|
|
|
|
axios.put(url, {
|
|
|
|
|
polls_name: this.state.polls_nametest,
|
|
|
|
|
polls_description: this.state.polls_descriptiontest
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
try {
|
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
// console.log("更新题目成功")
|
|
|
|
|
// this.props.showNotification("保存成功");
|
|
|
|
|
this.props.history.push(`/courses/${this.props.match.params.coursesId}/polls/${pollid}/detail?tab=2`)
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// if (this.state.Newedit === true) {
|
|
|
|
|
//
|
|
|
|
|
// this.newword();
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
|
|
|
|
|
// this.props.showNotification("请输入标题");
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (this.state.polls_descriptiontest.length > 100) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// var pollid;
|
|
|
|
|
// if (this.state.pollid === undefined) {
|
|
|
|
|
// pollid = this.props.match.params.workid;
|
|
|
|
|
// } else {
|
|
|
|
|
// pollid = this.state.pollid;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // if(mews ==="new"){
|
|
|
|
|
// if (this.state.poll_questions && this.state.poll_questions.length === 0) {
|
|
|
|
|
// this.props.showNotification("至少创建1个题目");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// // }
|
|
|
|
|
//
|
|
|
|
|
// var url = `/polls/${pollid}.json`;
|
|
|
|
|
// axios.put(url, {
|
|
|
|
|
// polls_name: this.state.polls_nametest,
|
|
|
|
|
// polls_description: this.state.polls_descriptiontest
|
|
|
|
|
// }).then((result) => {
|
|
|
|
|
// try {
|
|
|
|
|
// // console.log(JSON.stringify(result))
|
|
|
|
|
// if (result.data.status === 0) {
|
|
|
|
|
// // console.log("更新题目成功")
|
|
|
|
|
// // this.props.showNotification("保存成功");
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancelmodel = () => {
|
|
|
|
@ -2470,7 +2471,9 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
//试图
|
|
|
|
|
toWorkDetail = () => {
|
|
|
|
|
this.props.history.push(`/banks/poll/${this.props.match.params.workId} `);
|
|
|
|
|
console.log(this.props);
|
|
|
|
|
console.log("toWorkDetail");
|
|
|
|
|
this.props.history.push(`/banks/poll/${this.props.match.params.workid}`);
|
|
|
|
|
this.props.initPublic(undefined);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|