From 959c40d8bd890a7936f9ffefa3b71e1de8909c48 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期四, 11 七月 2024 11:05:46 +0800 Subject: [PATCH] feat:成绩缺考状态 --- src/views/exam/components/answer-main/answer-single/index.vue | 18 +++++++++++++----- 1 files changed, 13 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 87ee164..1efa61d 100644 --- a/src/views/exam/components/answer-main/answer-single/index.vue +++ b/src/views/exam/components/answer-main/answer-single/index.vue @@ -1,3 +1,4 @@ +<!-- 鍗曢�夐 --> <template> <div class="answer-container w-full h-full"> <el-scrollbar> @@ -7,7 +8,7 @@ <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> + <div class="answer-text text-gray-700" v-html="item.content"></div> </div> </div> @@ -35,22 +36,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