| | |
| | | examStatus: '考试状态', |
| | | examStartTime: '2021-01-01', |
| | | examEndTime: '2021-01-01', |
| | | examTime: 60, |
| | | }); |
| | | |
| | | const examType = ref({ |
| | |
| | | |
| | | const currentType = ref(1); |
| | | const currentIndex = ref(0); |
| | | |
| | | const answerProgress = ref(0); |
| | | |
| | | const examDetail = ref([ |
| | | { |
| | |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "", |
| | | "score": "", |
| | | "score": "3", |
| | | "difficult": 5 |
| | | }, |
| | | { |
| | |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "", |
| | | "score": "", |
| | | "score": "3", |
| | | "difficult": 5 |
| | | } |
| | | ] |
| | |
| | | ], |
| | | "analyze": "问小朋友", |
| | | "correct": "", |
| | | "score": "", |
| | | "score": "5", |
| | | "difficult": 5 |
| | | }, |
| | | { |
| | |
| | | ], |
| | | "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 |
| | | } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | 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; |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | return { |
| | | examInfo, |
| | | examDetail, |
| | | examType, |
| | | activeQuestion, |
| | | |
| | | currentType, |
| | | currentIndex, |
| | | answerProgress, |
| | | |
| | | getActiveQuestion, |
| | | getAnswerInfo, |
| | | |
| | | setExamInfo, |
| | | setExamDetail, |
| | | setQuestionAnswer |
| | | setQuestionAnswer, |
| | | setProgress |
| | | }; |
| | | }); |