From 92a5087cff2821903314f092209a4c792bc28c3e Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期一, 01 七月 2024 13:48:00 +0800 Subject: [PATCH] fix:修改考试列表type --- src/views/exam/components/answer-main/answer-single/index.vue | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/views/exam/components/answer-main/answer-single/index.vue b/src/views/exam/components/answer-main/answer-single/index.vue index 705d1d0..8563967 100644 --- a/src/views/exam/components/answer-main/answer-single/index.vue +++ b/src/views/exam/components/answer-main/answer-single/index.vue @@ -4,7 +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" @click="answerClick(item)" + <div class="answer-item flex" v-for="item, index in activeQuestion.questionItemList" @click="answerClick(item)" :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> @@ -35,22 +35,29 @@ item.isActive = true; } const answerList = filterAnswer(); - examStore.setQuestionAnswer(currentType.value, currentIndex.value, answerList.join(',')); + let temp = ''; + if(answerList) { + temp = answerList.prefix; + } + examStore.setQuestionAnswer(currentType.value, currentIndex.value, temp); } }; const answerState = (item) => { + if(activeQuestion.value.answer === item.prefix) { + item.isActive = true; + } return { - active: item.isActive + active: item.isActive || item.prefix === activeQuestion.value.answer }; }; const resetAnswer = () => { - activeQuestion.value.items.forEach(item => item.isActive = false); + activeQuestion.value.questionItemList.forEach(item => item.isActive = false); }; const filterAnswer = () => { - return activeQuestion.value.items.filter(item => item.isActive); + return activeQuestion.value.questionItemList.find(item => item.isActive); } -- Gitblit v1.8.0