From a2f97c0a741c3185fb30a505c916c94f78b21906 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期四, 17 十月 2024 19:57:25 +0800 Subject: [PATCH] meet websocket --- src/store/modules/exam.js | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js index b54d2ad..82a9c9c 100644 --- a/src/store/modules/exam.js +++ b/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 }; }); -- Gitblit v1.8.0