ZhangXianQiang
2024-07-04 5dcd784b68244886c8032186e37872c08d3cafe1
fix:修改试卷问题
4个文件已修改
75 ■■■■■ 已修改文件
src/views/grade-list/data-list/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/grade/components/answer-main/answer-single/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/grade/components/answer-sheet/index.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/components/info-data/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/grade-list/data-list/index.vue
@@ -88,14 +88,15 @@
const checkExam = (item) => {
  getGradeInfo(item.id).then((res) => {
    const {id,examName, score,navbar,titleList} = res.data;
    console.log(res.data);
    const {id,examName, score,navbar,titleItems} = res.data;
    gradeStore.setExamInfo({
      id,
      examName,
      score,
      navbar
    });
    gradeStore.setExamDetail(titleList);
    gradeStore.setExamDetail(titleItems);
    gradeStore.initExam();
    router.push('/grade');
  }).catch(err => {
src/views/grade/components/answer-main/answer-single/index.vue
@@ -4,7 +4,7 @@
      <ExamInfo class="mb-5" :questionIndex="currentIndex" :activeQuestion="activeQuestion"></ExamInfo>
      <div class="answer-content">
        <div class="answer-item flex" v-for="item, index in activeQuestion.items" :class="answerState(item)">
        <div class="answer-item flex" v-for="item, index in activeQuestion.questionItemList" :class="answerState(item)">
          <div class="answer-icon flex flex-col justify-center items-center flex-shrink-0">{{ item.prefix }}</div>
          <div class="answer-text text-gray-700">{{ item.content }}</div>
        </div>
@@ -15,19 +15,17 @@
      <div class="analysis-container">
        <div class="analysis-item" :class="analysisState">
          <div class="item-label">您的答案</div>
          <div class="item-info">{{ activeQuestion.correct }}</div>
          <div class="item-info">{{ activeQuestion.answer }}</div>
        </div>
        <div class="analysis-item analysis-right">
          <div class="item-label">正确答案</div>
          <div class="item-info">{{ activeQuestion.right }}</div>
          <div class="item-info">{{ activeQuestion.questionAnswer }}</div>
        </div>
        <div class="analysis-item text-gray-700">
          <div class="item-label">解析</div>
          <div class="item-info">Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem beatae possimus
            nostrum facere inventore aliquid vero fuga minus, mollitia temporibus harum commodi, dolores odio nulla
            aliquam maiores eligendi quis? Ad.</div>
          <div class="item-info" v-html="activeQuestion.analyze"></div>
        </div>
      </div>
    </el-scrollbar>
@@ -46,13 +44,13 @@
const activeQuestion = ref(gradeStore.getActiveQuestion);
const answerState = (item) => {
  const flag = activeQuestion.value.correct === activeQuestion.value.right;
  if (item.prefix === activeQuestion.value.correct) {
  const flag = activeQuestion.value.answer === activeQuestion.value.questionAnswer;
  if (item.prefix === activeQuestion.value.answer) {
    return {
      right: flag,
      wrong: !flag
    };
  } else if(item.prefix === activeQuestion.value.right) {
  } else if(item.prefix === activeQuestion.value.questionAnswer) {
    return {
      right: !flag,
      wrong: flag
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;
src/views/home/components/info-data/index.vue
@@ -42,8 +42,8 @@
        <div class="title text-lg font-bold">本周课程</div>
        <div class="table-container">
          <el-table :data="planeInfo.meetList" height="500" empty-text="暂无数据">
            <el-table-column prop="date" label="课程时间" />
            <el-table-column prop="name" label="课程名称" />
            <el-table-column prop="startTime" label="开始时间" />
            <el-table-column prop="meetName" label="课程名称" />
          </el-table>
        </div>
      </el-col>
@@ -52,7 +52,7 @@
        <div class="title text-lg font-bold">我的考试</div>
        <div class="table-container">
          <el-table :data="planeInfo.examList" height="500" empty-text="暂无数据">
            <el-table-column prop="startTime" label="课程时间" />
            <el-table-column prop="startTime" label="开始时间" />
            <el-table-column prop="examName" label="课程名称" />
          </el-table>
        </div>