Эх сурвалжийг харах

配对题试卷预览支持

zhangjie 3 жил өмнө
parent
commit
1dd669d46f

+ 14 - 0
src/features/examwork/StudentExamDetail/PreviewPaperDialog.vue

@@ -92,6 +92,10 @@ export default {
         this.buildRenderGroupStructList();
       });
     },
+    checkIsMatches(structType) {
+      const matchesTypes = [8, 9, 10];
+      return matchesTypes.includes(structType);
+    },
     parsePaperStruct(data) {
       const paperStructJson = data.paperStructJson
         ? JSON.parse(data.paperStructJson)
@@ -148,7 +152,9 @@ export default {
         detail.questions.forEach((question) => {
           let k = `${detail.number}-${question.number}`;
           if (question.subQuestions) {
+            const isMatches = this.checkIsMatches(question.structType);
             question.subQuestions.forEach((sq) => {
+              if (isMatches) sq.options = [];
               const sqk = `${k}-${sq.number}`;
               sq.answer = isEmpty(answerMap[sqk]) ? null : answerMap[sqk];
               const stdAns = studentAnsMap[sqk] || {
@@ -257,6 +263,14 @@ export default {
             );
             renderStructList.push(...bodys);
 
+            const isMatches = this.checkIsMatches(question.structType);
+            if (isMatches && question.options && question.options.length) {
+              question.options.forEach((op) => {
+                const obodys = this.parseTopicOption(op.body, op.number);
+                renderStructList.push(...obodys);
+              });
+            }
+
             question.subQuestions.forEach((sq) => {
               const contents = this.parseSimpleQuestion(sq, false);
               renderStructList.push(...contents);