| | |
| | | import { ref,computed } from 'vue'; |
| | | import { ref, computed } from 'vue'; |
| | | import { defineStore } from 'pinia'; |
| | | export const useExamStore = defineStore('exam', () => { |
| | | const examInfo = ref({ |
| | |
| | | } |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "B", |
| | | "correct": "", |
| | | "score": "", |
| | | "difficult": 5 |
| | | }, |
| | |
| | | } |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "B", |
| | | "correct": "", |
| | | "score": "", |
| | | "difficult": 5 |
| | | } |
| | |
| | | } |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "B", |
| | | "correct": "", |
| | | "score": "", |
| | | "difficult": 5 |
| | | }, |
| | |
| | | } |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "B", |
| | | "correct": "", |
| | | "score": "", |
| | | "difficult": 5 |
| | | } |
| | |
| | | ]); |
| | | |
| | | const activeQuestion = ref(null); |
| | | |
| | | |
| | | const getActiveQuestion = computed(() => { |
| | | const temp = examDetail.value.find(item => item.questionType === currentType.value); |
| | | if(temp) { |
| | | return temp.questionList[currentIndex.value]; |
| | | } |
| | | }) |
| | | |
| | | const setExamInfo = (info) => { |
| | | examInfo.value = info; |
| | |
| | | activeQuestion.value = detail; |
| | | }; |
| | | |
| | | const setQuestionAnswer = (type, index, answer) => { |
| | | const temp = examDetail.value.find(item => item.questionType === type); |
| | | if(temp) { |
| | | temp.questionList[index].correct = answer; |
| | | } |
| | | }; |
| | | |
| | | |
| | | return { |
| | | examInfo, |
| | | examDetail, |
| | |
| | | activeQuestion, |
| | | currentType, |
| | | currentIndex, |
| | | getActiveQuestion, |
| | | setExamInfo, |
| | | setExamDetail, |
| | | setActiveQuestion |
| | | setActiveQuestion, |
| | | setQuestionAnswer |
| | | }; |
| | | }); |