From 5a3020aaec6815f2f38b140b4b30082ac56371f5 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期四, 20 六月 2024 10:54:27 +0800
Subject: [PATCH] fix:单选题判断问题

---
 src/views/grade/components/answer-main/answer-audio/index.vue |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/views/grade/components/answer-main/answer-audio/index.vue b/src/views/grade/components/answer-main/answer-audio/index.vue
index 86efe6b..bee9477 100644
--- a/src/views/grade/components/answer-main/answer-audio/index.vue
+++ b/src/views/grade/components/answer-main/answer-audio/index.vue
@@ -4,8 +4,7 @@
       <ExamInfo class="mb-5" :questionIndex="currentIndex" :activeQuestion="activeQuestion"></ExamInfo>
 
       <div class="answer-content">
-        <div class="answer-item flex" v-for="item, index in activeQuestion.items"
-          :class="answerState(item)">
+        <div class="answer-item flex" v-for="item, index in activeQuestion.items" :class="answerState(item)">
           <div class="answer-icon flex flex-col justify-center items-center flex-shrink-0">{{ item.prefix }}</div>
           <div class="answer-text text-gray-700">{{ item.content }}</div>
         </div>
@@ -17,7 +16,7 @@
       <div class="analysis-container">
         <div class="analysis-item" :class="analysisState">
           <div class="item-label">鎮ㄧ殑绛旀</div>
-          <div class="item-info">{{ activeQuestion.correct ? activeQuestion.correct: '鏈綔绛�' }}</div>
+          <div class="item-info">{{ activeQuestion.correct ? activeQuestion.correct : '鏈綔绛�' }}</div>
         </div>
 
         <div class="analysis-item analysis-right">
@@ -49,16 +48,16 @@
 
 
 const answerState = (item) => {
+  const flag = activeQuestion.value.correct === activeQuestion.value.right;
   if (item.prefix === activeQuestion.value.correct) {
-    const flag = activeQuestion.value.correct === activeQuestion.value.right;
     return {
       right: flag,
       wrong: !flag
     };
-  }
-  if (item.prefix === activeQuestion.value.right) {
+  } else if(item.prefix === activeQuestion.value.right) {
     return {
-      right: true
+      right: !flag,
+      wrong: flag
     };
   }
 };
@@ -76,6 +75,7 @@
   --right-color: #67c23a;
   --wrong-color: #f56c6c;
 }
+
 .answer-item {
   max-width: 500px;
   border-radius: 10px;
@@ -100,6 +100,21 @@
   }
 }
 
+.right {
+  border-color: var(--right-color) !important;
+  background-color: rgba($color: #67c23a, $alpha: 0.2) !important;
+
+  .answer-icon {
+    color: #ffffff !important;
+    border-color: var(--right-color) !important;
+    background-color: var(--right-color) !important;
+  }
+
+  .answer-text {
+    color: var(--right-color) !important;
+  }
+}
+
 .wrong {
   border-color: var(--wrong-color) !important;
   background-color: rgba($color: #f56c6c, $alpha: 0.2) !important;

--
Gitblit v1.8.0