消逝
2024-07-12 b81d9110bcdef3b80386c6f16fa927e481ed9a7a
src/store/modules/exam.js
@@ -3,7 +3,7 @@
export const useExamStore = defineStore('exam', () => {
  const examInfo = ref(null);
  const examDetail = ref([]);
  const examType = ref({
    1: '单选题',
    2: '多选题',
@@ -34,7 +34,7 @@
    examDetail.value.forEach(item => {
      total += item.questionList.length;
      item.questionList.forEach(question => {
        grade += Number(question.score);
        grade += Number(question.questionScore);
      });
    });
    return {
@@ -42,7 +42,6 @@
      grade,
    };
  });
  const setExamInfo = (info) => {
    examInfo.value = info;
@@ -55,18 +54,25 @@
  const setQuestionAnswer = (type, index, answer) => {
    const temp = examDetail.value.find(item => item.questionType === type);
    if (temp) {
      temp.questionList[index].correct = answer;
      temp.questionList[index].answer = answer;
    }
  };
  const setQuestionAnswerList = (type, index, answer) => {
    const temp = examDetail.value.find(item => item.questionType === type);
    if (temp) {
      temp.questionList[index].answerList = answer;
    }
  }
  const setProgress = (progress) => {
    answerProgress.value = progress;
  };
  const initExam = () => {
  const initExam = (questionType) => {
    answerProgress.value = 0;
    currentIndex.value = 0;
    currentType.value = 1;
    currentType.value = questionType;
  }
@@ -87,6 +93,7 @@
    setExamInfo,
    setExamDetail,
    setQuestionAnswer,
    setQuestionAnswerList,
    setProgress
  };
});