From 90cf4906f4eb91d82aa08045f52c278dc0926eb5 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 17 Aug 2021 21:19:45 +0800
Subject: [PATCH] 考试答一题提交一题,答过的题目无法修改

---
 src/components/Subjects/Choices/index.vue |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/components/Subjects/Choices/index.vue b/src/components/Subjects/Choices/index.vue
index 52305d6..8d70da6 100644
--- a/src/components/Subjects/Choices/index.vue
+++ b/src/components/Subjects/Choices/index.vue
@@ -11,10 +11,13 @@
             </div>
 
             <ul class="subject-options"
+                id="subjectOptions"
                 v-for="option in options"
                 :key="option.id">
                 <li class="subject-option">
-                    <input class="toggle"
+                    <input 
+                            :disabled="currentAnswer"
+                            class="toggle"
                            type="checkbox"
                            :checked="userAnswer === option.optionName"
                            :id="'option' + option.id"
@@ -42,7 +45,8 @@
             },
             options: [],
             userAnswer: '',
-            index: ''
+            index: '',
+            currentAnswer: false,
         }
     },
     methods: {
@@ -53,6 +57,7 @@
             this.userAnswer = answer
         },
         setSubjectInfo (subject, subjectCount, index) {
+            this.currentAnswer = false
             this.subjectCount = subjectCount
             this.subjectInfo = subject
             if (subject.hasOwnProperty('examSubjectOptions')) {
@@ -61,7 +66,9 @@
                 console.log(this.options)
             }
             if (subject.hasOwnProperty('answer')) {
-                console.log(subject.answer);
+                if (subject.answer) {
+                    this.currentAnswer = true
+                }
                 this.setAnswer(subject.answer)
             }
             this.index = index + '.'

--
Gitblit v1.9.3