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