From a8c4d1497f36a343f52dab3d2d1ef6dea6f622dc Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期三, 19 六月 2024 16:54:49 +0800 Subject: [PATCH] feat(成绩):查看考后试卷 --- src/store/modules/exam.js | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 162 insertions(+), 13 deletions(-) diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js index 712d267..fa3292a 100644 --- a/src/store/modules/exam.js +++ b/src/store/modules/exam.js @@ -8,15 +8,19 @@ examStatus: '鑰冭瘯鐘舵��', examStartTime: '2021-01-01', examEndTime: '2021-01-01', + examTime: 5, }); const examType = ref({ 1: '鍗曢�夐', 2: '澶氶�夐', + 3: '闊抽棰�' }); const currentType = ref(1); const currentIndex = ref(0); + + const answerProgress = ref(0); const examDetail = ref([ { @@ -48,7 +52,7 @@ ], "analyze": "闂皬鏈嬪弸", "correct": "", - "score": "", + "score": "3", "difficult": 5 }, { @@ -77,7 +81,7 @@ ], "analyze": "闂皬鏈嬪弸", "correct": "", - "score": "", + "score": "3", "difficult": 5 } ] @@ -111,7 +115,7 @@ ], "analyze": "闂皬鏈嬪弸", "correct": "", - "score": "", + "score": "5", "difficult": 5 }, { @@ -140,22 +144,158 @@ ], "analyze": "闂皬鏈嬪弸", "correct": "", - "score": "", + "score": "5", + "difficult": 5 + }, + { + "id": null, + "questionType": 1, + "gradeLevel": null, + "subjectId": 2, + "title": "1+1=锛�", + "items": [ + { + "prefix": "A", + "content": "1" + }, + { + "prefix": "B", + "content": "2" + }, + { + "prefix": "C", + "content": "3" + }, + { + "prefix": "D", + "content": "4" + } + ], + "analyze": "闂皬鏈嬪弸", + "correct": "", + "score": "5", + "difficult": 5 + }, + { + "id": null, + "questionType": 1, + "gradeLevel": null, + "subjectId": 2, + "title": "1+1=锛�", + "items": [ + { + "prefix": "A", + "content": "1" + }, + { + "prefix": "B", + "content": "2" + }, + { + "prefix": "C", + "content": "3" + }, + { + "prefix": "D", + "content": "4" + } + ], + "analyze": "闂皬鏈嬪弸", + "correct": "", + "score": "5", "difficult": 5 } ] - } + }, + { + questionType: 3, + questionList: [ + { + "id": null, + "questionType": 1, + "gradeLevel": null, + "subjectId": 2, + "title": "娴嬭瘯闊抽1", + "audioFile": '/test.mp3', + "items": [ + { + "prefix": "A", + "content": "1" + }, + { + "prefix": "B", + "content": "2" + }, + { + "prefix": "C", + "content": "3" + }, + { + "prefix": "D", + "content": "4" + } + ], + "analyze": "闂皬鏈嬪弸", + "correct": "", + "score": "3", + "difficult": 5 + }, + { + "id": null, + "questionType": 1, + "gradeLevel": null, + "subjectId": 2, + "title": "娴嬭瘯闊抽2", + "audioFile": '/test.mp3', + "items": [ + { + "prefix": "A", + "content": "1" + }, + { + "prefix": "B", + "content": "2" + }, + { + "prefix": "C", + "content": "3" + }, + { + "prefix": "D", + "content": "4" + } + ], + "analyze": "闂皬鏈嬪弸", + "correct": "", + "score": "3", + "difficult": 5 + } + ] + }, ]); - - const activeQuestion = ref(null); - const getActiveQuestion = computed(() => { const temp = examDetail.value.find(item => item.questionType === currentType.value); - if(temp) { + if (temp) { return temp.questionList[currentIndex.value]; } - }) + }); + + const getAnswerInfo = computed(() => { + let total = 0; + let grade = 0; + examDetail.value.forEach(item => { + total += item.questionList.length; + item.questionList.forEach(question => { + grade += Number(question.score); + }); + }); + return { + total, + grade, + }; + }); + const setExamInfo = (info) => { examInfo.value = info; @@ -167,9 +307,13 @@ const setQuestionAnswer = (type, index, answer) => { const temp = examDetail.value.find(item => item.questionType === type); - if(temp) { + if (temp) { temp.questionList[index].correct = answer; } + }; + + const setProgress = (progress) => { + answerProgress.value = progress; }; @@ -177,12 +321,17 @@ examInfo, examDetail, examType, - activeQuestion, + currentType, currentIndex, + answerProgress, + getActiveQuestion, + getAnswerInfo, + setExamInfo, setExamDetail, - setQuestionAnswer + setQuestionAnswer, + setProgress }; }); -- Gitblit v1.8.0