From 0a45ebd0372b7209d5b84156ef540d5b0e68c248 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期三, 19 六月 2024 10:04:27 +0800
Subject: [PATCH] feat(考试):多选题答题
---
src/views/exam/components/answer-main/answer-multiple/index.vue | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/views/exam/components/answer-main/answer-multiple/index.vue b/src/views/exam/components/answer-main/answer-multiple/index.vue
index 4142e61..e925454 100644
--- a/src/views/exam/components/answer-main/answer-multiple/index.vue
+++ b/src/views/exam/components/answer-main/answer-multiple/index.vue
@@ -17,20 +17,23 @@
<script setup>
import { ref } from 'vue';
-import {storeToRefs} from 'pinia';
+import { storeToRefs } from 'pinia';
import ExamInfo from '@/components/ExamInfo/index.vue';
-import {useExamStore} from '@/store/index.js';
+import { useExamStore } from '@/store/index.js';
const examStore = useExamStore();
-const {currentIndex} = storeToRefs(examStore);
+const { currentType, currentIndex } = storeToRefs(examStore);
const activeQuestion = ref(examStore.getActiveQuestion);
const answerClick = (item) => {
- if(item) {
+ if (item) {
// resetAnswer();
item.isActive = !item.isActive;
+ const answerList = filterAnswer();
+ examStore.setQuestionAnswer(currentType.value, currentIndex.value, answerList.join(','));
+
}
};
@@ -38,10 +41,10 @@
return {
active: item.isActive
};
-}
+};
-const resetAnswer = () => {
- activeQuestion.value.items.forEach(item => item.isActive = false);
+const filterAnswer = () => {
+ return activeQuestion.value.items.filter(item => item.isActive);
}
@@ -85,6 +88,7 @@
.active {
border-color: #409EFF !important;
+
.answer-icon {
color: #ffffff !important;
border-color: #409EFF !important;
--
Gitblit v1.8.0