From 8296816e95bc4c4cba378d2e4bc4d0e1d2d14f90 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期一, 08 七月 2024 09:43:07 +0800
Subject: [PATCH] 发版环境
---
src/views/grade/components/answer-sheet/index.vue | 48 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/src/views/grade/components/answer-sheet/index.vue b/src/views/grade/components/answer-sheet/index.vue
index 31a83a6..1bec437 100644
--- a/src/views/grade/components/answer-sheet/index.vue
+++ b/src/views/grade/components/answer-sheet/index.vue
@@ -2,10 +2,12 @@
<div class="sheet-container w-full h-full">
<el-scrollbar>
<el-collapse v-model="activeNames">
- <template v-for="item in examDetail">
- <el-collapse-item :title="examType[item.questionType]" :name="item.questionType">
+ <template v-for="item, itemIndex 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="question,index in item.questionList" @click="sheetClick(item.questionType,index)" :class="itemClass(question,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>
@@ -18,26 +20,44 @@
<script setup>
import { ref } from 'vue';
-import {storeToRefs} from 'pinia';
-import {useGradeStore} from '@/store/index.js';
+import { storeToRefs } from 'pinia';
+import { useGradeStore } from '@/store/index.js';
const gradeStore = useGradeStore();
-const {examType, examDetail,currentType,currentIndex} = storeToRefs(gradeStore);
+const { examDetail, currentType, currentIndex, examInfo } = storeToRefs(gradeStore);
const activeNames = ref(examDetail.value.map(item => item.questionType));
-const itemClass = (question,type,index) => {
- return {
- right: question.isRight,
- wrong: !question.isRight,
- active: currentType.value === type && currentIndex.value === index
+const concatQuestion = (navbar, titleList) => {
+ if (Array.isArray(titleList) && titleList.length > 0) {
+ let tempIndex = 0;
+ titleList.forEach((title) => {
+ title.questionList.forEach((question) => {
+ question.isRight = navbar[tempIndex].right;
+ tempIndex++;
+ });
+ })
}
+
}
-const sheetClick = (type,index) => {
+concatQuestion(examInfo.value.navbar, examDetail.value);
+console.log(examDetail.value);
+
+const itemClass = (question,type,index) => {
+ return {
+ right: question.isRight === true,
+ wrong: question.isRight === false,
+ active: currentType.value === type && currentIndex.value === index
+ };
+};
+
+const sheetClick = (type, index) => {
currentType.value = type;
currentIndex.value = index;
-}
+};
+
+
</script>
@@ -45,6 +65,7 @@
.sheet-list {
width: 97%;
}
+
.sheet-item {
width: 35px;
height: 35px;
@@ -61,6 +82,7 @@
background-color: #67C23A !important;
color: #fff !important;
}
+
.wrong {
background-color: #F56C6C !important;
color: #fff !important;
--
Gitblit v1.8.0