From d95c23683388adbb8bd511f6d5da52bbec16ffd0 Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期三, 19 六月 2024 10:01:05 +0800 Subject: [PATCH] feat(考试):答题卡选项状态变化 --- src/store/modules/exam.js | 5 ----- src/views/exam/components/answer-sheet/index.vue | 9 +++++---- src/views/exam/components/answer-main/answer-single/index.vue | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js index 4622a95..712d267 100644 --- a/src/store/modules/exam.js +++ b/src/store/modules/exam.js @@ -165,10 +165,6 @@ examDetail.value = detail; }; - const setActiveQuestion = (detail) => { - activeQuestion.value = detail; - }; - const setQuestionAnswer = (type, index, answer) => { const temp = examDetail.value.find(item => item.questionType === type); if(temp) { @@ -187,7 +183,6 @@ getActiveQuestion, setExamInfo, setExamDetail, - setActiveQuestion, setQuestionAnswer }; }); 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 288bca2..b67815a 100644 --- a/src/views/exam/components/answer-main/answer-single/index.vue +++ b/src/views/exam/components/answer-main/answer-single/index.vue @@ -16,13 +16,13 @@ </template> <script setup> -import { ref, onMounted } from 'vue'; +import { ref } from 'vue'; import {storeToRefs} from 'pinia'; import ExamInfo from '@/components/ExamInfo/index.vue'; import {useExamStore} from '@/store/index.js'; const examStore = useExamStore(); -const {currentType,currentIndex,examDetail} = storeToRefs(examStore); +const {currentType,currentIndex} = storeToRefs(examStore); const activeQuestion = ref(examStore.getActiveQuestion); diff --git a/src/views/exam/components/answer-sheet/index.vue b/src/views/exam/components/answer-sheet/index.vue index e3a7418..ad89f1e 100644 --- a/src/views/exam/components/answer-sheet/index.vue +++ b/src/views/exam/components/answer-sheet/index.vue @@ -5,7 +5,7 @@ <template v-for="item in examDetail"> <el-collapse-item :title="examType[item.questionType]" :name="item.questionType"> <div class="sheet-list grid grid-cols-5 gap-4 justify-items-center"> - <div class="sheet-item cursor-pointer flex justify-center items-center" v-for="question,index in item.questionList" @click="sheetClick(item.questionType,index)" :class="itemClass(item,item.questionType, index)"> + <div class="sheet-item cursor-pointer flex justify-center items-center" v-for="question,index in item.questionList" @click="sheetClick(item.questionType,index)" :class="itemClass(question,item.questionType, index)"> {{ index + 1 }} </div> </div> @@ -17,12 +17,14 @@ </template> <script setup> -import { ref } from 'vue'; +import { ref,watchEffect } from 'vue'; import {storeToRefs} from 'pinia'; import {useExamStore} from '@/store/index.js'; const examStore = useExamStore(); const {examType, examDetail,currentType,currentIndex} = storeToRefs(examStore); + +const activeNames = ref(examDetail.value.map(item => item.questionType)); const itemClass = (question,type,index) => { return { @@ -31,12 +33,11 @@ } } -const activeNames = ref(examDetail.value.map(item => item.questionType)); - const sheetClick = (type,index) => { currentType.value = type; currentIndex.value = index; } + </script> <style lang="scss" scoped> -- Gitblit v1.8.0