chromesetting
杨树林 5 years ago
parent 4e0a46be8d
commit a6428c0b53

@ -893,7 +893,6 @@ class PollNew extends Component {
//保存并继续 //保存并继续
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空) //保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = (indexo, object,bool) => { Deleteadddomtwo = (indexo, object,bool) => {
debugger
var thiss = this; var thiss = this;
@ -1038,7 +1037,7 @@ class PollNew extends Component {
if(object.question.max_choices){ if(object.question.max_choices){
if(object.question.max_choices>0){ if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) { if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`); this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
} }
} }
@ -1258,7 +1257,7 @@ class PollNew extends Component {
if(object.question.max_choices){ if(object.question.max_choices){
if(object.question.max_choices>0){ if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) { if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`); this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
} }
} }
@ -1449,9 +1448,7 @@ class PollNew extends Component {
// indexo 第几个数组 // indexo 第几个数组
//object 单个数组数据 //object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => { Deleteadddomthree = (indexo, object,bool) => {
this.setState({
newoption: false,
})
// console.log("deleteadddom 349") // console.log("deleteadddom 349")
var thiss = this; var thiss = this;
let arr = this.state.adddom; let arr = this.state.adddom;
@ -1477,9 +1474,14 @@ class PollNew extends Component {
} }
if (newarr[indexo].question.question_title === "") { if (newarr[indexo].question.question_title === "") {
this.props.showNotification('题目不能为空!'); this.props.showNotification('题目不能为空!');
return
}
if (newarr[indexo].question.question_title.match(/^[ ]*$/)) {
this.props.showNotification('题目不能为空!');
return return
} }
if (max > 0) { if (max > 0) {
if (object.question.question_type === 1) { if (object.question.question_type === 1) {
this.props.showNotification('选项内容不能为空!'); this.props.showNotification('选项内容不能为空!');
@ -1579,7 +1581,7 @@ class PollNew extends Component {
if(object.question.max_choices){ if(object.question.max_choices){
if(object.question.max_choices>0){ if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) { if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`); this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
} }
} }
@ -1790,7 +1792,7 @@ class PollNew extends Component {
if(object.question.max_choices){ if(object.question.max_choices){
if(object.question.max_choices>0){ if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) { if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`); this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
} }
} }
@ -1867,7 +1869,6 @@ 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,object.question.answers.length); this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
@ -2016,10 +2017,11 @@ class PollNew extends Component {
if (result !== undefined) { if (result !== undefined) {
if (result.data.status === 0) { if (result.data.status === 0) {
this.props.showNotification(`已完成`); this.props.showNotification(`已完成`);
thiss.thisinitializationdatanew(); thiss.thisinitializationdatanew();
this.setState({ this.setState({
Newdisplay:false, Newdisplay:false,
newoption: false,
}) })
// console.log("确认创建问题") // console.log("确认创建问题")
// console.log(result) // console.log(result)
@ -2032,11 +2034,24 @@ class PollNew extends Component {
// //
// } // }
} }
}else{
this.setState({
Newdisplay:true,
newoption: false,
})
} }
// } catch (e) { // } catch (e) {
// //
// } // }
}).catch((error) => {
console.log(error)
this.setState({
Newdisplay:true,
newoption: false,
})
}) })
@ -2096,11 +2111,24 @@ class PollNew extends Component {
if (result.data.status === 0) { if (result.data.status === 0) {
this.props.showNotification(`编辑题目成功`); this.props.showNotification(`编辑题目成功`);
thiss.thisinitializationdatanew(); thiss.thisinitializationdatanew();
this.setState({
Newdisplay:false,
newoption: false,
})
} }
} catch (e) { } catch (e) {
// console.log("调用了edittotheserver") // console.log("调用了edittotheserver")
console.log(e) this.setState({
Newdisplay:true,
newoption: false,
})
} }
}).catch((error) => {
console.log(error)
this.setState({
Newdisplay:true,
newoption: false,
})
}) })
} }
@ -2685,7 +2713,8 @@ class PollNew extends Component {
// console.log("2301"); // console.log("2301");
// console.log(newr); // console.log(newr);
// window.history.pushState('','',newUrl+'?tab='+e); // window.history.pushState('','',newUrl+'?tab='+e);
window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
// window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
}) })
} else { } else {
@ -2773,6 +2802,7 @@ class PollNew extends Component {
height: '30px', height: '30px',
lineHeight: '30px', lineHeight: '30px',
}; };
const hejiine=this.state.mysingles + this.state.mydoubles + this.state.mymainsint;
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions) // console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
var displaymysave = (mysave === true) ? "" : "display:none;"; var displaymysave = (mysave === true) ? "" : "display:none;";
@ -2942,7 +2972,7 @@ class PollNew extends Component {
{ {
this.state.mysingles + this.state.mydoubles + this.state.mymainsint === 0 ? "" : hejiine=== 0 ? "" :
<div> <div>
<span className="fl"> <span className="fl">
{this.state.mysingles === 0 ? "" : <span {this.state.mysingles === 0 ? "" : <span
@ -2959,7 +2989,7 @@ class PollNew extends Component {
</span> </span>
<span className="fr">合计 <span <span className="fr">合计 <span
className="color-blue">{this.state.mysingles === undefined ? "" : this.state.mydoubles === undefined ? "" : this.state.mymainsint === undefined ? "" : this.state.mysingles + this.state.mydoubles + this.state.mymainsint}</span> </span> className="color-blue">{this.state.mysingles === undefined ? "" : this.state.mydoubles === undefined ? "" : this.state.mymainsint === undefined ? "" : hejiine}</span> </span>
</div> </div>
} }

Loading…
Cancel
Save