Ver Fonte

修复判断题

Michael Wang há 6 anos atrás
pai
commit
4816cfe00f

+ 17 - 8
src/features/OnlineExam/Examing/BooleanQuestionView.vue

@@ -5,16 +5,16 @@
       <div class="stu-answer">{{studentAnswer}}</div>
       <div class="stu-answer">{{studentAnswer}}</div>
       <div class="score">({{question.questionScore}}分)</div>
       <div class="score">({{question.questionScore}}分)</div>
     </div>
     </div>
-    <div @click="() => answerQuestion(examQuestion.id, '正确')">
+    <div @click="() => answerQuestion('正确')">
       <input type="radio" name="question" value="正确" :checked="studentAnswer === '正确'" />
       <input type="radio" name="question" value="正确" :checked="studentAnswer === '正确'" />
       <span class="question-options">正确</span>
       <span class="question-options">正确</span>
     </div>
     </div>
-    <div @click="() => answerQuestion(examQuestion.id, '错误')">
+    <div @click="() => answerQuestion('错误')">
       <input type="radio" name="question" value="错误" :checked="studentAnswer === '错误'" />
       <input type="radio" name="question" value="错误" :checked="studentAnswer === '错误'" />
       <span class="question-options">错误</span>
       <span class="question-options">错误</span>
     </div>
     </div>
     <div class="reset">
     <div class="reset">
-      <i-button type="warning" size="large" @click="() => answerQuestion(examQuestion.id, null)">重置答案</i-button>
+      <i-button type="warning" size="large" @click="() => answerQuestion(null)">重置答案</i-button>
     </div>
     </div>
   </div>
   </div>
 </template>
 </template>
@@ -49,19 +49,28 @@ export default {
           ["checkbox", "radio"].includes(document.activeElement.type))
           ["checkbox", "radio"].includes(document.activeElement.type))
       ) {
       ) {
         if ("KeyY" === e.code) {
         if ("KeyY" === e.code) {
-          this.answerQuestion(this.examQuestion.id, "正确");
+          this.answerQuestion("正确");
         }
         }
         if ("KeyN" === e.code) {
         if ("KeyN" === e.code) {
-          this.answerQuestion(this.examQuestion.id, "错误");
+          this.answerQuestion("错误");
         }
         }
       }
       }
     },
     },
-    async answerQuestion(examQuestionId, studentAnswer) {
+    async answerQuestion(studentAnswer) {
       if (studentAnswer !== this.examQuestion.studentAnswer) {
       if (studentAnswer !== this.examQuestion.studentAnswer) {
-        await this.$http.put("/api/exam_question/" + examQuestionId, {
+        await this.$http.post(
+          "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
+          [
+            {
+              order: this.examQuestion.order,
+              studentAnswer: studentAnswer
+            }
+          ]
+        );
+        this.updateExamQuestion({
+          order: this.$route.params.order,
           studentAnswer
           studentAnswer
         });
         });
-        this.updateExamQuestion({ examQuestionId, studentAnswer });
       }
       }
     }
     }
   },
   },

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

@@ -9,7 +9,7 @@
     <template v-if="question.questionType === 'MULTIPLE_CHOICE'">
     <template v-if="question.questionType === 'MULTIPLE_CHOICE'">
       <multiple-question-view :question="question" :examQuestion="examQuestion" />
       <multiple-question-view :question="question" :examQuestion="examQuestion" />
     </template>
     </template>
-    <template v-if="question.questionType === 'BOOL_ANSWER_QUESTION'">
+    <template v-if="question.questionType === 'TRUE_OR_FALSE'">
       <boolean-question-view :question="question" :examQuestion="examQuestion" />
       <boolean-question-view :question="question" :examQuestion="examQuestion" />
     </template>
     </template>
     <template v-if="question.questionType === 'FILL_BLANK_QUESTION'">
     <template v-if="question.questionType === 'FILL_BLANK_QUESTION'">