ZhangXianQiang
2024-07-05 98f494cf633e3acf5c20f3e9de0d708f2a6c2045
src/store/modules/exam.js
@@ -7,7 +7,12 @@
  const examType = ref({
    1: '单选题',
    2: '多选题',
    3: '音频题'
    3: '判断题',
    4: '填空题',
    5: '简答题',
    6: '语音题',
    7: '计算题',
    8: '分析题',
  });
  const currentType = ref(1);
@@ -29,7 +34,7 @@
    examDetail.value.forEach(item => {
      total += item.questionList.length;
      item.questionList.forEach(question => {
        grade += Number(question.score);
        grade += Number(question.questionScore);
      });
    });
    return {
@@ -37,7 +42,6 @@
      grade,
    };
  });
  const setExamInfo = (info) => {
    examInfo.value = info;
@@ -50,9 +54,16 @@
  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;
@@ -82,6 +93,7 @@
    setExamInfo,
    setExamDetail,
    setQuestionAnswer,
    setQuestionAnswerList,
    setProgress
  };
});