Commit 7f5613f19a075cad97769ad5f5ea6e2cbce531e4
1 parent
f8b21bc2
设置答案问题
Showing
2 changed files
with
22 additions
and
16 deletions
src/views/basic/test/list.vue
... | ... | @@ -295,7 +295,7 @@ export default { |
295 | 295 | id: obj.id, |
296 | 296 | title: obj.title, |
297 | 297 | score: obj.examPaperScore || 0, |
298 | - type: 1, | |
298 | + type: 1,//试卷类型 | |
299 | 299 | subjectName: obj.subjectName, |
300 | 300 | classId: this.query.classId[0], |
301 | 301 | params: this.$route.query.params, |
... | ... | @@ -404,8 +404,8 @@ export default { |
404 | 404 | query: { |
405 | 405 | paperId: item.id, |
406 | 406 | title: item.title, |
407 | - type: 2, | |
408 | - examType: item.examType || 1, | |
407 | + type: 2,//搜索题目详情类型 | |
408 | + examType: item.examPaperId == 0 ? 1 : 2, | |
409 | 409 | }, |
410 | 410 | }); |
411 | 411 | }, | ... | ... |
src/views/examinationPaper/edit.vue
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | </p> |
88 | 88 | <p v-if="subQuestions.questionType == 3" class="answer-box"> |
89 | 89 | <template |
90 | - v-for="option in subQuestions.answerOptions.split(',')" | |
90 | + v-for="option in subQuestions.answerOptions?.split(',')" | |
91 | 91 | > |
92 | 92 | <span |
93 | 93 | v-if="option" |
... | ... | @@ -105,7 +105,7 @@ |
105 | 105 | </p> |
106 | 106 | <p v-if="subQuestions.questionType == 2" class="answer-box"> |
107 | 107 | <template |
108 | - v-for="option in subQuestions.answerOptions.split(',')" | |
108 | + v-for="option in subQuestions.answerOptions?.split(',')" | |
109 | 109 | > |
110 | 110 | <span |
111 | 111 | class="answer-s" |
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | </p> |
244 | 244 | <p v-if="subQuestions.questionType == 3" class="answer-box"> |
245 | 245 | <template |
246 | - v-for="option in subQuestions.answerOptions.split(',')" | |
246 | + v-for="option in subQuestions.answerOptions?.split(',')" | |
247 | 247 | > |
248 | 248 | <span |
249 | 249 | v-if="option" |
... | ... | @@ -261,7 +261,7 @@ |
261 | 261 | </p> |
262 | 262 | <p v-if="subQuestions.questionType == 2" class="answer-box"> |
263 | 263 | <template |
264 | - v-for="option in subQuestions.answerOptions.split(',')" | |
264 | + v-for="option in subQuestions.answerOptions?.split(',')" | |
265 | 265 | > |
266 | 266 | <span |
267 | 267 | class="answer-s" |
... | ... | @@ -486,7 +486,7 @@ export default { |
486 | 486 | return { |
487 | 487 | role: "", |
488 | 488 | title: "", |
489 | - type: 1, | |
489 | + type: 1, //1:答题卡 2:即时测报表题目列表 3:课时题目列表 | |
490 | 490 | questionList: [], |
491 | 491 | paperType: 1, //1 备题(随堂问) /2 组卷 |
492 | 492 | //答题卡详情 |
... | ... | @@ -582,7 +582,7 @@ export default { |
582 | 582 | this.$store.getters.info.permissions[0].role; |
583 | 583 | this.type = this.$route.query.type || 1; |
584 | 584 | this.examType = this.$route.query.examType || 2; |
585 | - this.paperType = this.$route.query.paperType || 1; | |
585 | + this.paperType = this.$route.query.paperType || 2; | |
586 | 586 | this.form.title = this.$route.query.title || ""; |
587 | 587 | this._QueryDetail(); |
588 | 588 | this._GradeList(); |
... | ... | @@ -1006,6 +1006,7 @@ export default { |
1006 | 1006 | }; |
1007 | 1007 | const { data, status, info } = await detail(params); |
1008 | 1008 | if (status == 0) { |
1009 | + let questionList; | |
1009 | 1010 | if (this.type == 1) { |
1010 | 1011 | //修改答案信息 |
1011 | 1012 | this.paperModifyLog = { |
... | ... | @@ -1013,23 +1014,24 @@ export default { |
1013 | 1014 | ...this.form.paperModifyLog, |
1014 | 1015 | }; |
1015 | 1016 | this.form = deepClone(data); |
1016 | - this.questionList = deepClone(this.form.questionList); | |
1017 | + questionList = deepClone(this.form.questionList); | |
1017 | 1018 | } else { |
1018 | - this.questionList = data.list.sort((a, b) => { | |
1019 | + questionList = data.list.sort((a, b) => { | |
1019 | 1020 | return a.questionIndex - b.questionIndex; |
1020 | 1021 | }); |
1021 | 1022 | } |
1022 | - this.formateQuestion(); | |
1023 | + this.formateQuestion(questionList); | |
1023 | 1024 | } else { |
1024 | 1025 | this.$message.error(info); |
1025 | 1026 | } |
1026 | 1027 | }, |
1027 | - formateQuestion() { | |
1028 | - if (this.questionList[0]?.subQuestions) { | |
1029 | - this.questionList?.map((item) => { | |
1028 | + formateQuestion(arr) { | |
1029 | + if (arr[0]?.subQuestions) { | |
1030 | + this.questionList = arr.map((item) => { | |
1030 | 1031 | let types = [{}]; |
1031 | 1032 | let addndex = 0; |
1032 | 1033 | item.subQuestions.map((sub, index) => { |
1034 | + sub.answerOptions = sub.answerOptions || "A,B,C,D"; | |
1033 | 1035 | if (!!sub.questionType) { |
1034 | 1036 | if ( |
1035 | 1037 | sub.questionType == types[addndex].qusType && |
... | ... | @@ -1085,11 +1087,13 @@ export default { |
1085 | 1087 | ); |
1086 | 1088 | } |
1087 | 1089 | } |
1090 | + return item; | |
1088 | 1091 | }); |
1089 | 1092 | } else { |
1090 | 1093 | let types = [{}]; |
1091 | 1094 | let addndex = 0; |
1092 | - this.questionList?.map((sub, index) => { | |
1095 | + this.questionList = arr.map((sub, index) => { | |
1096 | + sub.answerOptions = sub.answerOptions || "A,B,C,D"; | |
1093 | 1097 | if (!!sub.questionType) { |
1094 | 1098 | if ( |
1095 | 1099 | sub.questionType == types[addndex].qusType && |
... | ... | @@ -1132,6 +1136,7 @@ export default { |
1132 | 1136 | ); |
1133 | 1137 | } |
1134 | 1138 | } |
1139 | + return sub; | |
1135 | 1140 | }); |
1136 | 1141 | for (let i = 0; i < types.length; i++) { |
1137 | 1142 | if (types[i].qusType == 3) { |
... | ... | @@ -1146,6 +1151,7 @@ export default { |
1146 | 1151 | } |
1147 | 1152 | } |
1148 | 1153 | } |
1154 | + console.log(this.questionList); | |
1149 | 1155 | }, |
1150 | 1156 | }, |
1151 | 1157 | }; | ... | ... |