瀏覽代碼

fix: 修复bug

yhd12345 3 年之前
父節點
當前提交
f1e5b093c0
共有 1 個文件被更改,包括 8 次插入23 次删除
  1. 8 23
      src/views/components/ExamQuestionsInfo.vue

+ 8 - 23
src/views/components/ExamQuestionsInfo.vue

@@ -10,10 +10,10 @@
           <v-chip
             v-else
             :color="
-              this.judgeAnswer(
-                question.id,
-                question.answer.replace(/[;]/gi, '')
-              )
+              submitAnswers.get(question.id) ===
+              question.answer.replace(/[;]/gi, '')
+                ? 'success'
+                : 'error'
             "
             label
           >
@@ -47,10 +47,10 @@
           <v-chip
             label
             :color="
-              this.judgeAnswer(
-                question.id,
-                question.answer.replace(/[;]/gi, '')
-              )
+              submitAnswers.get(question.id) ===
+              question.answer.replace(/[;]/gi, '')
+                ? 'success'
+                : 'error'
             "
             class="ml-2 mr-4"
             v-if="submitAnswers.size > 0"
@@ -135,21 +135,6 @@ export default Vue.extend({
           })
         }
       })
-    },
-
-    judgeAnswer(id: ID, answer: string): string {
-      if (this.submitAnswers.get(id) === answer.replace(/[;]/gi, '')) {
-        return 'success'
-      } else {
-        if (
-          (this.submitAnswers.get(id) === 'true' && answer === '正确') ||
-          (this.submitAnswers.get(id) === 'false' && answer === '错误')
-        ) {
-          return 'success'
-        } else {
-          return 'error'
-        }
-      }
     }
   },
   mounted() {