From 360f252566e55aae61f0bb17469cb28955dc32bc Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期二, 11 六月 2024 10:12:02 +0800 Subject: [PATCH] feat:答题切换 --- src/store/modules/exam.js | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 171 insertions(+), 7 deletions(-) diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js index 96a55e9..f436304 100644 --- a/src/store/modules/exam.js +++ b/src/store/modules/exam.js @@ -1,11 +1,175 @@ -import { ref } from 'vue'; +import { ref,computed } from 'vue'; import { defineStore } from 'pinia'; -const useExamStore = defineStore('exam', () => { - const examInfo = ref(null); +export const useExamStore = defineStore('exam', () => { + const examInfo = ref({ + examId: 1, + examName: '鑰冭瘯鍚嶇О', + examType: '鑰冭瘯绫诲瀷', + examStatus: '鑰冭瘯鐘舵��', + examStartTime: '2021-01-01', + examEndTime: '2021-01-01', + }); + + const examType = ref({ + 1: '鍗曢�夐', + 2: '澶氶�夐' + }); + + const currentType = ref(1); + const currentIndex = 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": "B", + "score": "", + "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": "B", + "score": "", + "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": "B", + "score": "", + "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": "B", + "score": "", + "difficult": 5 + } + ] + } + ]); + + const activeQuestion = ref(null); + + const setExamInfo = (info) => { + examInfo.value = info; + }; + + const setExamDetail = (detail) => { + examDetail.value = detail; + }; + + const setActiveQuestion = (detail) => { + activeQuestion.value = detail; + }; return { - examInfo - } + examInfo, + examDetail, + examType, + activeQuestion, + currentType, + currentIndex, + setExamInfo, + setExamDetail, + setActiveQuestion + }; }); - -export default useExamStore; \ No newline at end of file -- Gitblit v1.8.0