浏览代码

练习:显示单选题、多选题答案

Michael Wang 6 年之前
父节点
当前提交
e2607ba58e

+ 1 - 1
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -135,7 +135,7 @@ export default {
             this.$route.params.examId +
             `/PRACTICE_TYPE`
         )).data;
-        this.practiceType = practiceType;
+        this.practiceType = practiceType; // IN_PRACTICE NO_ANSWER
       }
       const paperStruct = (await this.$http.get(
         "/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=" +

+ 20 - 1
src/features/OnlineExam/Examing/MultipleQuestionView.vue

@@ -12,6 +12,12 @@
     </div>
     <div class="reset">
       <i-button type="warning" size="large" @click="() => answerQuestion(null)">重置答案</i-button>
+      <span v-if="question.rightAnswer">
+        &nbsp;&nbsp;&nbsp;<i-button type="info" size="large" @click="showAnswer">显示答案</i-button>
+      </span>
+      <div v-if="question.rightAnswer && isShowAnswer">
+        正确答案:<div>{{rightAnswerTransform}}</div>
+      </div>
     </div>
   </div>
 </template>
@@ -28,7 +34,8 @@ export default {
     return {
       questionBody: this.question.body,
       optionName,
-      studentAnswer: this.examQuestion.studentAnswer || ""
+      studentAnswer: this.examQuestion.studentAnswer || "",
+      isShowAnswer: false
     };
   },
   props: {
@@ -99,6 +106,9 @@ export default {
           studentAnswer: realAnswer
         });
       }
+    },
+    showAnswer() {
+      this.isShowAnswer = !this.isShowAnswer;
     }
   },
   watch: {
@@ -129,6 +139,15 @@ export default {
           .map(v => v.name)
           .join("")
       );
+    },
+    rightAnswerTransform() {
+      return (
+        this.question.rightAnswer &&
+        this.newQuestionOptions
+          .filter(v => this.question.rightAnswer.includes(v.oldIndex))
+          .map(v => v.name)
+          .join("")
+      );
     }
   },
   components: {

+ 0 - 9
src/features/OnlineExam/Examing/QuestionView.vue

@@ -136,15 +136,6 @@ export default {
         question.questionUnitList[this.examQuestion.subNumber - 1];
     },
     async toggleSign() {
-      // await this.$http.post(
-      //   "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
-      //   [
-      //     {
-      //       order: this.examQuestion.order,
-      //       isSign: !this.examQuestion.isSign
-      //     }
-      //   ]
-      // );
       this.updateExamQuestion({
         order: this.$route.params.order,
         isSign: !this.examQuestion.isSign

+ 20 - 1
src/features/OnlineExam/Examing/SingleQuestionView.vue

@@ -12,6 +12,12 @@
     </div>
     <div class="reset">
       <i-button type="warning" size="large" @click="() => answerQuestion(null)">重置答案</i-button>
+      <span v-if="question.rightAnswer">
+        &nbsp;&nbsp;&nbsp;<i-button type="info" size="large" @click="showAnswer">显示答案</i-button>
+      </span>
+      <div v-if="question.rightAnswer && isShowAnswer">
+        正确答案:<div>{{rightAnswerTransform}}</div>
+      </div>
     </div>
   </div>
 </template>
@@ -28,7 +34,8 @@ export default {
     return {
       questionBody: this.question.body,
       optionName,
-      studentAnswer: this.examQuestion.studentAnswer
+      studentAnswer: this.examQuestion.studentAnswer,
+      isShowAnswer: false
     };
   },
   props: {
@@ -72,6 +79,9 @@ export default {
           studentAnswer
         });
       }
+    },
+    showAnswer() {
+      this.isShowAnswer = !this.isShowAnswer;
     }
   },
   watch: {
@@ -105,6 +115,15 @@ export default {
           .map(v => v.name)
           .join("")
       );
+    },
+    rightAnswerTransform() {
+      return (
+        this.question.rightAnswer &&
+        this.newQuestionOptions
+          .filter(v => this.question.rightAnswer.includes(v.oldIndex))
+          .map(v => v.name)
+          .join("")
+      );
     }
   },
   components: {

+ 1 - 1
src/features/OnlinePractice/OnlinePracticeList.vue

@@ -38,7 +38,7 @@
 import { createNamespacedHelpers } from "vuex";
 import moment from "moment";
 import { mapState as globalMapState } from "vuex";
-const { mapState, mapMutations } = createNamespacedHelpers("examHomeModule");
+const { mapMutations } = createNamespacedHelpers("examHomeModule");
 
 export default {
   name: "OnlinePracticeList",