From 98f494cf633e3acf5c20f3e9de0d708f2a6c2045 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期五, 05 七月 2024 09:39:59 +0800
Subject: [PATCH] feat:视频浏览

---
 src/store/modules/exam.js |  226 ++++++-------------------------------------------------
 1 files changed, 27 insertions(+), 199 deletions(-)

diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js
index edafdef..854eb4b 100644
--- a/src/store/modules/exam.js
+++ b/src/store/modules/exam.js
@@ -1,19 +1,18 @@
 import { ref, computed } from 'vue';
 import { defineStore } from 'pinia';
 export const useExamStore = defineStore('exam', () => {
-  const examInfo = ref({
-    examId: 1,
-    examName: '鑰冭瘯鍚嶇О',
-    examType: '鑰冭瘯绫诲瀷',
-    examStatus: '鑰冭瘯鐘舵��',
-    examStartTime: '2021-01-01',
-    examEndTime: '2021-01-01',
-    examTime: 60,
-  });
-
+  const examInfo = ref(null);
+  const examDetail = ref([]);
+  
   const examType = ref({
     1: '鍗曢�夐',
     2: '澶氶�夐',
+    3: '鍒ゆ柇棰�',
+    4: '濉┖棰�',
+    5: '绠�绛旈',
+    6: '璇煶棰�',
+    7: '璁$畻棰�',
+    8: '鍒嗘瀽棰�',
   });
 
   const currentType = ref(1);
@@ -21,192 +20,6 @@
 
   const answerProgress = ref(0);
 
-  const examDetail = ref([
-    {
-      questionType: 1,
-      questionList: [
-        {
-          "id": null,
-          "questionType": 1,
-          "gradeLevel": null,
-          "subjectId": 2,
-          "title": "1+1=锛�123",
-          "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": "1+1=锛�",
-          "items": [
-            {
-              "prefix": "A",
-              "content": "1"
-            },
-            {
-              "prefix": "B",
-              "content": "2"
-            },
-            {
-              "prefix": "C",
-              "content": "3"
-            },
-            {
-              "prefix": "D",
-              "content": "4"
-            }
-          ],
-          "analyze": "闂皬鏈嬪弸",
-          "correct": "",
-          "score": "3",
-          "difficult": 5
-        }
-      ]
-    },
-    {
-      questionType: 2,
-      questionList: [
-        {
-          "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
-        },
-        {
-          "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
-        }
-      ]
-    }
-  ]);
 
   const getActiveQuestion = computed(() => {
     const temp = examDetail.value.find(item => item.questionType === currentType.value);
@@ -221,7 +34,7 @@
     examDetail.value.forEach(item => {
       total += item.questionList.length;
       item.questionList.forEach(question => {
-        grade += Number(question.score);
+        grade += Number(question.questionScore);
       });
     });
     return {
@@ -229,7 +42,6 @@
       grade,
     };
   });
-
 
   const setExamInfo = (info) => {
     examInfo.value = info;
@@ -242,12 +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 = () => {
+    answerProgress.value = 0;
+    currentIndex.value = 0;
+    currentType.value = 1;
   }
 
 
@@ -263,9 +88,12 @@
     getActiveQuestion,
     getAnswerInfo,
 
+    initExam,
+
     setExamInfo,
     setExamDetail,
     setQuestionAnswer,
+    setQuestionAnswerList,
     setProgress
   };
 });

--
Gitblit v1.8.0