ZhangXianQiang
2024-06-26 c28f27e7a03e9c14422ae787d412c286b6ad501c
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(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>
@@ -24,19 +24,20 @@
const {examType, 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.correct,
    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);
}
</script>
<style lang="scss" scoped>
@@ -54,4 +55,9 @@
.active {
  border-color: #3680fa;
}
.answer {
  border-color: #3680fa !important;
  background-color: #3680fa !important;
  color: #fff !important;
}
</style>