| | |
| | | import { ref } from 'vue'; |
| | | import { ref,computed } from 'vue'; |
| | | import { defineStore } from 'pinia'; |
| | | const useExamStore = defineStore('exam', () => { |
| | | const examInfo = ref(null); |
| | | |
| | | return { |
| | | examInfo |
| | | } |
| | | export const useExamStore = defineStore('exam', () => { |
| | | const examInfo = ref({ |
| | | examId: 1, |
| | | examName: '考试名称', |
| | | examType: '考试类型', |
| | | examStatus: '考试状态', |
| | | examStartTime: '2021-01-01', |
| | | examEndTime: '2021-01-01', |
| | | }); |
| | | |
| | | export default useExamStore; |
| | | 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, |
| | | examDetail, |
| | | examType, |
| | | activeQuestion, |
| | | currentType, |
| | | currentIndex, |
| | | setExamInfo, |
| | | setExamDetail, |
| | | setActiveQuestion |
| | | }; |
| | | }); |