diff --git a/public/static/课件模板.docx b/public/static/课件模板.docx index da31715..c26e1ac 100644 --- a/public/static/课件模板.docx +++ b/public/static/课件模板.docx diff --git a/src/components/exportDia.vue b/src/components/exportDia.vue index d26abe4..5c15425 100644 --- a/src/components/exportDia.vue +++ b/src/components/exportDia.vue @@ -149,7 +149,10 @@ export default { return item.studentId; }); } - this.$emit("exportData", this.downType == 1 ? null : studentIds); + this.$emit( + "exportData", + this.downType == 1 ? null : studentIds.length == 0 ? null : studentIds + ); this.cancelSelection(); }, cancel() { diff --git a/src/views/basic/test/index.vue b/src/views/basic/test/index.vue index 54cac30..c18612a 100644 --- a/src/views/basic/test/index.vue +++ b/src/views/basic/test/index.vue @@ -29,7 +29,7 @@

-
+
科目:

@@ -55,6 +55,21 @@

+
+ 科目: +
+

+ + {{ item }} + +

+
+
日期:
@@ -294,6 +309,9 @@ export default { return; } let query = { ...this.query }; + if (this.role != "ROLE_BANZHUREN") { + query.subjectNames = [query.subjectNames]; + } this.$router.push({ path: "/testList", query: { diff --git a/src/views/basic/test/list.vue b/src/views/basic/test/list.vue index 6eccb77..d0fbb7c 100644 --- a/src/views/basic/test/list.vue +++ b/src/views/basic/test/list.vue @@ -242,6 +242,7 @@ export default { endDay: "", }, multipleSelection: [], + multipleSelectionObj: {}, tableData: [], page: 1, size: 20, @@ -269,6 +270,14 @@ export default { this.init(); } }, + multipleSelection: { + handler: function (nVal) { + this.multipleSelectionObj[this.page] = this.tableData.filter((item) => + nVal.includes(item.id) + ); + }, + deep: true, + }, }, methods: { //初始化 @@ -323,7 +332,13 @@ export default { let subjectArr = []; let classIds = ""; let multipleData = []; - this.tableData.map((item) => { + let multipleSelectionData = []; + Object.keys(this.multipleSelectionObj).map((keys) => { + multipleSelectionData = multipleSelectionData.concat( + this.multipleSelectionObj[keys] + ); + }); + multipleSelectionData.map((item) => { if (this.multipleSelection.includes(item.id)) { subjectArr.push(item.subjectName); multipleData.push(item); diff --git a/src/views/examinationPaper/addQs.vue b/src/views/examinationPaper/addQs.vue index 4d14381..258de2b 100644 --- a/src/views/examinationPaper/addQs.vue +++ b/src/views/examinationPaper/addQs.vue @@ -105,178 +105,364 @@ +
@@ -454,14 +640,21 @@
@@ -616,11 +809,11 @@ export default { methods: { // v1.5 //上传截图 - openStem(obj, index, indexs, type) { + openStem(obj, type, index, indexs) { this.iframeLoading = true; + this.stem.type = type; this.stem.index = index; this.stem.indexs = indexs; - this.stem.type = type; if (type == 1) { if (!obj.screenshot || obj.screenshot == "") { this.iframeLoading = false; @@ -643,14 +836,24 @@ export default { if (res && res.status == 0) { if (this.stem.type == 1) { this.stem.screenshot = res.data.url; - this.form.questionList[this.stem.index].subQuestions[ - this.stem.indexs - ].screenshot = this.stem.screenshot; + if (this.form.questionList[0]?.subQuestions) { + this.form.questionList[this.stem.index].subQuestions[ + this.stem.indexs + ].screenshot = this.stem.screenshot; + } else { + this.form.questionList[this.stem.index].screenshot = + this.stem.screenshot; + } } else { this.stem.answerScreenshot = res.data.url; - this.form.questionList[this.stem.index].subQuestions[ - this.stem.indexs - ].answerScreenshot = this.stem.answerScreenshot; + if (this.form.questionList[0]?.subQuestions) { + this.form.questionList[this.stem.index].subQuestions[ + this.stem.indexs + ].answerScreenshot = this.stem.answerScreenshot; + } else { + this.form.questionList[this.stem.index].answerScreenshot = + this.stem.answerScreenshot; + } } this.$message.success("上传成功"); } else { @@ -662,7 +865,7 @@ export default { this.$message.error("上传失败"); }, // 知识点 - openKnowledge(obj, index) { + openKnowledge(obj, index, indexs) { this.stem.index = index; this.stem.indexs = indexs; this.stem.knowledge = (obj.knowledge && obj.knowledge.split("#")) || []; @@ -742,10 +945,67 @@ export default { //整理问题 formateQuestion() { this.formatQuestionList(); - this.form.questionList?.map((item) => { + if (this.form.questionList[0]?.subQuestions) { + this.form.questionList?.map((item) => { + let types = [{}]; + let addndex = 0; + item.subQuestions?.map((sub, index) => { + if (!!sub.questionType) { + if ( + sub.questionType == types[addndex].qusType && + sub.questionType != 5 + ) { + //同类型批量答案+1 + types[addndex].subNum += 1; + if ( + types[addndex].answerOptions.length < sub.answerOptions.length + ) { + types[addndex].answerOptions = sub.answerOptions; + } + + // types[addndex].answerList += this.setAnswer( + // sub.questionType, + // sub.correctAnswer + // ); + types[addndex].answerList = ""; + if (index == item.subQuestions.length - 1) { + //循环最后类型数量大于等于5,保存批量答案 + if (types[addndex].subNum && types[addndex].subNum >= 5) { + types[addndex].endIndex = sub.questionIndex; + types[addndex].index = index; + } + } + } else { + if (types[addndex].subNum && types[addndex].subNum >= 5) { + //不同类型时如果原有类型数量大于等于5,保存批量答案 + types[addndex].endIndex = + item.subQuestions[index - 1].questionIndex; + types[addndex].index = index - 1; + addndex += 1; + types[addndex] = {}; + } + //不同类型初始化批量答案 + types[addndex].qusType = sub.questionType; + types[addndex].subNum = 1; + types[addndex].answerOptions = sub.answerOptions; + types[addndex].answerList = ""; + } + } + }); + for (let i = 0; i < types.length; i++) { + if (types[i].subNum >= 5) { + item.subQuestions?.splice( + types[i].index + i + 1, + 0, + deepClone(types[i]) + ); + } + } + }); + } else { let types = [{}]; let addndex = 0; - item.subQuestions?.map((sub, index) => { + this.form.questionList = this.form.questionList.map((sub, index) => { if (!!sub.questionType) { if ( sub.questionType == types[addndex].qusType && @@ -758,13 +1018,12 @@ export default { ) { types[addndex].answerOptions = sub.answerOptions; } - // types[addndex].answerList += this.setAnswer( // sub.questionType, // sub.correctAnswer // ); types[addndex].answerList = ""; - if (index == item.subQuestions.length - 1) { + if (index == this.form.questionList.length - 1) { //循环最后类型数量大于等于5,保存批量答案 if (types[addndex].subNum && types[addndex].subNum >= 5) { types[addndex].endIndex = sub.questionIndex; @@ -775,7 +1034,7 @@ export default { if (types[addndex].subNum && types[addndex].subNum >= 5) { //不同类型时如果原有类型数量大于等于5,保存批量答案 types[addndex].endIndex = - item.subQuestions[index - 1].questionIndex; + this.form.questionList[index - 1].questionIndex; types[addndex].index = index - 1; addndex += 1; types[addndex] = {}; @@ -787,35 +1046,56 @@ export default { types[addndex].answerList = ""; } } + return sub; }); for (let i = 0; i < types.length; i++) { + if (types[i].qusType == 3) { + types[i].answerList = types[i].answerList.slice(0, -1); + } if (types[i].subNum >= 5) { - item.subQuestions?.splice( + this.form.questionList.splice( types[i].index + i + 1, 0, deepClone(types[i]) ); } } - }); + } }, //初始化要修改的答案 - setFormAns(indexs, index) { - this.formAns = { ...this.form.questionList[index].subQuestions[indexs] }; - this.formAns.listIndex = index; + setFormAns(index, indexs) { let answerList = ""; - let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置 - this.form.questionList[index].subQuestions.map((item, subIdx) => { - if (subIdx >= startIndex && subIdx < indexs) { - answerList += this.setAnswer(item.questionType, item.correctAnswer); - - if (item.qusType == 3) { - answerList = answerList.slice(0, -1); + if (this.form.questionList[0]?.subQuestions) { + this.formAns = { + ...this.form.questionList[index].subQuestions[indexs], + }; + this.formAns.listIndex = index; + let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置 + this.form.questionList[index].subQuestions.map((item, subIdx) => { + if (subIdx >= startIndex && subIdx < indexs) { + answerList += this.setAnswer(item.questionType, item.correctAnswer); + + if (item.qusType == 3) { + answerList = answerList.slice(0, -1); + } } - } - }); - this.formAns.answerList = answerList; + }); + } else { + this.formAns = { ...this.form.questionList[index] }; + let startIndex = index - this.formAns.subNum; //批量设置开始位置 + this.formAns.answerList = []; + this.formAns.listIndex = index; + this.form.questionList.map((item, subIdx) => { + if (subIdx >= startIndex && subIdx < index) { + answerList += this.setAnswer(item.questionType, item.correctAnswer); + if (item.qusType == 3) { + answerList = answerList.slice(0, -1); + } + } + }); + } + this.formAns.answerList = answerList; this.diaSetAns = true; }, insertTxtAndSetcursor(element, answerList, str) { @@ -992,20 +1272,31 @@ export default { //删除批量操作数据 formatQuestionList() { for (let i = 0; i < this.form.questionList.length; i++) { - for ( - let j = 0; - j < this.form.questionList[i].subQuestions?.length; - j++ - ) { - if (this.form.questionList[i].subQuestions[j]?.qusType) { - this.form.questionList[i].subQuestions?.splice(j, 1); + if (this.form.questionList[0]?.subQuestions) { + for ( + let j = 0; + j < this.form.questionList[i].subQuestions?.length; + j++ + ) { + if (this.form.questionList[i].subQuestions[j]?.qusType) { + this.form.questionList[i].subQuestions?.splice(j, 1); + } + } + } else { + if (this.form.questionList[i].qusType) { + this.form.questionList.splice(i, 1); + i--; } } } }, //删除题 - delTabData(subIndex, index) { - this.form.questionList[index].subQuestions.splice(subIndex, 1); + delTabData(index, subIndex) { + if (this.form.questionList[0].subQuestions) { + this.form.questionList[index].subQuestions.splice(subIndex, 1); + } else { + this.form.questionList[index].splice(subIndex, 1); + } this.formateQuestion(); }, //切换题型 @@ -1188,22 +1479,28 @@ export default { } } this.form.questionList = data.questionList?.map((item) => { - let subQuestions = - item.subQuestions?.map((items) => { - return { - ...items, - selectNum: items.answerOptions?.split(",").length, - answerOptions: items.answerOptions || "A,B,C,D", - screenshot: items.screenshot || "", - correctAnswer: items.correctAnswer || "", - knowledge: items.knowledge || "", - }; - }) || []; - return { - questionTitle: item.questionTitle, - subQuestions: subQuestions, - show: false, - }; + if (item.subQuestions) { + let subQuestions = + item.subQuestions?.map((items) => { + return { + ...items, + selectNum: items.answerOptions?.split(",").length, + answerOptions: items.answerOptions || "A,B,C,D", + screenshot: items.screenshot || "", + correctAnswer: items.correctAnswer || "", + knowledge: items.knowledge || "", + }; + }) || []; + return { + questionTitle: item.questionTitle, + subQuestions: subQuestions, + show: false, + }; + } else { + return { + ...item, + }; + } }); }, },