| | |
| | | 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) { |
| | | 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 setProgress = (progress) => { |
| | | answerProgress.value = progress; |
| | | } |
| | | |
| | | |
| | | return { |
| | | examInfo, |
| | | examDetail, |
| | | examType, |
| | | activeQuestion, |
| | | |
| | | currentType, |
| | | currentIndex, |
| | | answerProgress, |
| | | |
| | | getActiveQuestion, |
| | | getAnswerInfo, |
| | | |
| | | setExamInfo, |
| | | setExamDetail, |
| | | setQuestionAnswer |
| | | setQuestionAnswer, |
| | | setProgress |
| | | }; |
| | | }); |
| | |
| | | <div class="progress-container w-full px-3 py-4 bg-slate-50"> |
| | | <div class="title-container flex justify-between items-center mb-3"> |
| | | <div class="title text-gray-600 text-base">答题进度</div> |
| | | <div class="title-num text-sm text-gray-500">10/30</div> |
| | | <div class="title-num text-sm text-gray-500">{{ answerProgress }} / {{ total }}</div> |
| | | </div> |
| | | |
| | | <div class="progress-content mb-3"> |
| | | <el-progress :percentage="progress" :stroke-width="10" :show-text="false" /> |
| | | <el-progress :percentage="percent" :stroke-width="10" :show-text="false" /> |
| | | </div> |
| | | |
| | | <div class="exam-info text-sm text-gray-600"> |
| | | 共30题,满分100分 |
| | | 共{{ total }}题,满分{{grade}}分 |
| | | </div> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from 'vue'; |
| | | const progress = ref(10); |
| | | import { ref, computed } from 'vue'; |
| | | import {storeToRefs} from 'pinia'; |
| | | import { useExamStore } from '@/store/index.js'; |
| | | const examStore = useExamStore(); |
| | | |
| | | const {answerProgress} = storeToRefs(examStore); |
| | | |
| | | |
| | | const total = ref(examStore.getAnswerInfo.total); |
| | | const grade = ref(examStore.getAnswerInfo.grade); |
| | | |
| | | const percent = computed(() => { |
| | | return Number((answerProgress.value / total.value * 100).toFixed(0)); |
| | | }); |
| | | |
| | | </script> |
| | | |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref,watchEffect } from 'vue'; |
| | | import { ref } from 'vue'; |
| | | import {storeToRefs} from 'pinia'; |
| | | import {useExamStore} from '@/store/index.js'; |
| | | const examStore = useExamStore(); |
| | |
| | | </div> |
| | | |
| | | |
| | | <!-- 提示弹窗 --> |
| | | <!-- 退出考试提示弹窗 --> |
| | | <el-dialog v-model="dialogVisible" title="注意" width="500"> |
| | | <div class="dialog-container"> |
| | | <p>请确认是否退出当前考试</p> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import { ref, watchEffect } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { Close } from '@element-plus/icons-vue'; |
| | | import AnswerTag from './components/answer-tag/index.vue'; |
| | |
| | | dialogVisible.value = false; |
| | | router.back(); |
| | | }; |
| | | |
| | | watchEffect(() => { |
| | | let progress = 0; |
| | | examDetail.value.forEach(item => { |
| | | item.questionList.forEach(question => { |
| | | if(question.correct) { |
| | | progress += 1; |
| | | } |
| | | }); |
| | | }); |
| | | examStore.setProgress(progress); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |