From 98f494cf633e3acf5c20f3e9de0d708f2a6c2045 Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期五, 05 七月 2024 09:39:59 +0800 Subject: [PATCH] feat:视频浏览 --- src/views/exam/components/answer-sheet/index.vue | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/views/exam/components/answer-sheet/index.vue b/src/views/exam/components/answer-sheet/index.vue index b25642b..bb9bc94 100644 --- a/src/views/exam/components/answer-sheet/index.vue +++ b/src/views/exam/components/answer-sheet/index.vue @@ -3,9 +3,9 @@ <el-scrollbar> <el-collapse v-model="activeNames"> <template v-for="item in examDetail"> - <el-collapse-item :title="examType[item.questionType]" :name="item.questionType"> + <el-collapse-item :title="item.title" :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(question,index)" :class="itemClass(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> @@ -22,21 +22,27 @@ import {useExamStore} from '@/store/index.js'; const examStore = useExamStore(); -const {examType, examDetail,currentType,currentIndex} = storeToRefs(examStore); +const {examDetail,currentType,currentIndex} = storeToRefs(examStore); -const itemClass = (type,index) => { +const activeNames = ref(examDetail.value.map(item => item.questionType)); + +const itemClass = (question,type,index) => { return { + answer: question.answer || checkAnswerList(question.answerList), active: currentType.value === type && currentIndex.value === index } } -const activeNames = ref(examDetail.value.map(item => item.questionType)); - -const sheetClick = (item, index) => { - currentType.value = item.questionType; +const sheetClick = (type,index) => { + currentType.value = type; currentIndex.value = index; - examStore.setActiveQuestion(item); } + + +const checkAnswerList = (answerList) => { + return Array.isArray(answerList) && answerList.length && answerList.every(item => item); +} + </script> <style lang="scss" scoped> @@ -54,4 +60,9 @@ .active { border-color: #3680fa; } +.answer { + border-color: #3680fa !important; + background-color: #3680fa !important; + color: #fff !important; +} </style> \ No newline at end of file -- Gitblit v1.8.0