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 |   66 ++++++++++++++-------------------
 1 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/src/views/exam/components/answer-sheet/index.vue b/src/views/exam/components/answer-sheet/index.vue
index eb8c60b..bb9bc94 100644
--- a/src/views/exam/components/answer-sheet/index.vue
+++ b/src/views/exam/components/answer-sheet/index.vue
@@ -1,12 +1,12 @@
 <template>
   <div class="sheet-container w-full h-full">
     <el-scrollbar>
-      <el-collapse v-model="activeNames" @change="handleChange">
-        <template v-for="item in sheetList">
-          <el-collapse-item :title="item.title" :name="item.type">
+      <el-collapse v-model="activeNames">
+        <template v-for="item in examDetail">
+          <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="index in item.total" @click="sheetClick(item,index)" :class="itemClass(item.type, index)">
-                {{ 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>
           </el-collapse-item>
@@ -18,46 +18,31 @@
 
 <script setup>
 import { ref } from 'vue';
+import {storeToRefs} from 'pinia';
+import {useExamStore} from '@/store/index.js';
+const examStore = useExamStore();
 
-const categroy = ref(0);
-const sheetIndex = ref(0);
+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 {
-    active: categroy.value === type && sheetIndex.value === index
+    answer: question.answer || checkAnswerList(question.answerList),
+    active: currentType.value === type && currentIndex.value === index
   }
 }
 
-
-const sheetList = ref([
-  {
-    title: '鍗曢�夐',
-    type: 1,
-    total: 20,
-  },
-  {
-    title: '澶氶�夐',
-    type: 2,
-    total: 20,
-  },
-  {
-    title: '鍒ゆ柇棰�',
-    type: 3,
-    total: 20,
-  },
-]);
-
-const activeNames = ref(sheetList.value.map(item => item.type));
-
-
-const handleChange = () => {
-
-};
-
-const sheetClick = (item, index) => {
-  categroy.value = item.type;
-  sheetIndex.value = index;
+const sheetClick = (type,index) => {
+  currentType.value = type;
+  currentIndex.value = index;
 }
+
+
+const checkAnswerList = (answerList) => {
+  return Array.isArray(answerList) && answerList.length && answerList.every(item => item);
+}
+
 </script>
 
 <style lang="scss" scoped>
@@ -75,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