diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 4529ade6b..e3dc06a4a 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2702,10 +2702,10 @@ class PollNew extends Component { { this.props.match.params.news === "new" ? 返回 + className=" fr font-16"> : 返回 + className=" fr font-16"> } diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js index 5530f839a..b739e358f 100644 --- a/public/react/src/modules/courses/poll/PollNewQuestbank.js +++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js @@ -854,19 +854,7 @@ class PollNewQuestbank extends Component { //保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空) Deleteadddomtwo = (indexo, object, bool) => { var thiss = this; - if (bool === true) { - this.setState({ - q_countst: 1, - bindingid: undefined, - Newdisplay: false, - }) - } else { - this.setState({ - q_countst: 1, - Newdisplay: false, - }) - } if (object.question.question_type === 3) { this.HandleInputTopics(this.contentMdRef.current.getValue().trim(), indexo); @@ -1019,11 +1007,11 @@ class PollNewQuestbank 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; } @@ -1035,11 +1023,11 @@ class PollNewQuestbank 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; } @@ -1250,11 +1238,11 @@ class PollNewQuestbank 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; } @@ -1266,11 +1254,11 @@ class PollNewQuestbank 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; } @@ -1406,6 +1394,19 @@ class PollNewQuestbank extends Component { this.state.mymainsint = this.state.mymainsint + 1; } + if (bool === true) { + this.setState({ + q_countst: 1, + bindingid: undefined, + Newdisplay: false, + + }) + } else { + this.setState({ + q_countst: 1, + Newdisplay: false, + }) + } this.setState({ // poll_questions: newarrpoll, adddom: newarr, @@ -1424,11 +1425,7 @@ class PollNewQuestbank extends Component { // indexo 第几个数组 //object 单个数组数据 Deleteadddomthree = (indexo, object, bool) => { - if (bool === true) { - this.setState({ - bindingid: undefined, - }) - } + this.setState({ Newdisplay: false, }); @@ -1571,11 +1568,11 @@ class PollNewQuestbank 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; } @@ -1587,11 +1584,11 @@ class PollNewQuestbank 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; } @@ -1775,11 +1772,11 @@ class PollNewQuestbank 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; } @@ -1791,11 +1788,11 @@ class PollNewQuestbank 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; } @@ -1917,7 +1914,11 @@ class PollNewQuestbank extends Component { this.state.mymainsint = this.state.mymainsint + 1; } - + if (bool === true) { + this.setState({ + bindingid: undefined, + }) + } //这里更新数据 if (this.state.q_countst == 1) { this.setState({ @@ -2100,7 +2101,7 @@ class PollNewQuestbank extends Component { } //上下移到服务器中 - Upanddownmovementof = (bool, poll_question_id) => { + Upanddownmovementof = (bool, poll_question_id,index) => { // console.log("调用了Upanddownmovementofr") // console.log(poll_question_id) var thiss = this; @@ -2109,14 +2110,30 @@ class PollNewQuestbank extends Component { axios.put(url, { opr: "up", }).then((result) => { + try { - if (result.data.status === 0) { - this.props.showNotification(`上移成功`); - thiss.thisinitializationdatanew(); + if(result){ + if(result.data){ + if (result.data.status === 0) { + this.props.showNotification(`上移成功`); + let arr = this.state.poll_questions; + let newarr = [...arr]; + let temp = newarr[index - 1]; + newarr[index - 1] = newarr[index]; + newarr[index] = temp; + this.setState({ + poll_questions: newarr, + }); + thiss.thisinitializationdatanew(); + }else{ + this.props.showNotification(`上移失败`); + } + } + }else { + this.props.showNotification(`上移失败`); } - // console.log(JSON.stringify(result)) } catch (e) { - // console.log("上移题目成功 错误") + this.props.showNotification(`上移失败`); console.log(e) } @@ -2126,15 +2143,31 @@ class PollNewQuestbank extends Component { axios.put(url, { opr: "down", }).then((result) => { + try { - if (result.data.status === 0) { - // message.success("下移题目成功", 1) - this.props.showNotification(`下移成功`); - thiss.thisinitializationdatanew(); + if(result){ + if(result.data){ + if (result.data.status === 0) { + // message.success("下移题目成功", 1) + this.props.showNotification(`下移成功`); + let arr = this.state.poll_questions; + let newarr = [...arr]; + let temp = newarr[index + 1]; + newarr[index + 1] = newarr[index]; + newarr[index] = temp; + this.setState({ + poll_questions: newarr, + }); + thiss.thisinitializationdatanew(); + }else { + this.props.showNotification(`下移失败`); + } + }else { + this.props.showNotification(`上移失败`); + } } - // console.log(JSON.stringify(result)) } catch (e) { - // console.log("下移题目成功 错误") + this.props.showNotification(`上移失败`); console.log(e) } }) @@ -2271,17 +2304,11 @@ class PollNewQuestbank extends Component { //点击向上排序按钮事件 handleClickBySortUp = (index, object) => { // console.log("handleClickBySortUp 521") - let arr = this.state.poll_questions; - let newarr = [...arr]; + // console.log(newarr) if (index != 0) { - this.Upanddownmovementof(true, object.question.id); - let temp = newarr[index - 1]; - newarr[index - 1] = newarr[index]; - newarr[index] = temp; - this.setState({ - poll_questions: newarr, - }); + this.Upanddownmovementof(true, object.question.id,index); + } } @@ -2292,13 +2319,8 @@ class PollNewQuestbank extends Component { let newarr = [...arr]; // if (index != newarr.length - 1) { - this.Upanddownmovementof(false, object.question.id); - let temp = newarr[index + 1]; - newarr[index + 1] = newarr[index]; - newarr[index] = temp; - this.setState({ - poll_questions: newarr, - }); + this.Upanddownmovementof(false, object.question.id,index); + } else { // console.log("2222index==arr.length"); // console.log(this.state.poll_questions); @@ -2978,7 +3000,7 @@ class PollNewQuestbank extends Component { { item.question.question_type === 2? {(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")} + className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "" : item.question.min_choices === null && item.question.max_choices === null ? "" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")} : "" } @@ -3121,7 +3143,7 @@ class PollNewQuestbank extends Component {
) : itemt.answer_text === "其他" ? (

其它 this.Deleteentrys(arrid, indext, true)}> + className="ml1 iconfont icon-htmal5icon19 font-22 color-grey-c"> } 1 ? - this.Deleteentrys(arrid, indext, false)}> @@ -3236,7 +3258,7 @@ class PollNewQuestbank extends Component {

可选 + className="color-grey-6 mr5 w55 font-16 lineh-40 fl" style={{textAlign: "center"}}>可选
{/*可选最小1*/}