| | |
| | | }; |
| | | }); |
| | | |
| | | |
| | | const setExamInfo = (info) => { |
| | | examInfo.value = info; |
| | | }; |
| | |
| | | temp.questionList[index].answer = answer; |
| | | } |
| | | }; |
| | | |
| | | const setQuestionAnswerList = (type, index, answer) => { |
| | | const temp = examDetail.value.find(item => item.questionType === type); |
| | | if (temp) { |
| | | temp.questionList[index].answerList = answer; |
| | | } |
| | | } |
| | | |
| | | const setProgress = (progress) => { |
| | | answerProgress.value = progress; |
| | |
| | | setExamInfo, |
| | | setExamDetail, |
| | | setQuestionAnswer, |
| | | setQuestionAnswerList, |
| | | setProgress |
| | | }; |
| | | }); |
| | |
| | | console.log(exam); |
| | | getExamInfo(exam.id).then((res) => { |
| | | examStore.setExamInfo({ |
| | | examId: res.data.id, |
| | | examName: res.data.examName, |
| | | examTime: res.data.suggestTime, |
| | | suggestTime: res.data.suggestTime, |
| | | }); |
| | | examStore.setExamDetail(res.data.titleList); |
| | | // examStore.setExamInfo(res.data.examInfo); |
| | | // examStore.setExamDetail(res.data.examQuestionList); |
| | | // examStore.initExam(); |
| | | examStore.initExam(); |
| | | router.push('/exam'); |
| | | }).catch(err => { |
| | | |
| | |
| | | // resetAnswer(); |
| | | item.isActive = !item.isActive; |
| | | const answerList = filterAnswer(); |
| | | examStore.setQuestionAnswer(currentType.value, currentIndex.value, answerList.join(',')); |
| | | examStore.setQuestionAnswerList(currentType.value, currentIndex.value, answerList); |
| | | |
| | | } |
| | | }; |
| | |
| | | }; |
| | | |
| | | const filterAnswer = () => { |
| | | return activeQuestion.value.questionItemList.filter(item => item.isActive); |
| | | return activeQuestion.value.questionItemList.filter(item => item.isActive).map(item => item.prefix); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | const emit = defineEmits(['timeOut']); |
| | | |
| | | const time = ref(dayjs().valueOf() + examInfo.value.examTime * 1000 * 60); |
| | | const time = ref(dayjs().valueOf() + examInfo.value.suggestTime * 1000 * 60); |
| | | |
| | | const timeFinish = () => { |
| | | emit('timeOut'); |
| | |
| | | </div> |
| | | |
| | | <div class="submit-wrapper"> |
| | | <el-button type="primary" class="submit-button" @click="submitExam">提交试卷</el-button> |
| | | <el-button type="primary" class="submit-button" @click="submitExamHandle">提交试卷</el-button> |
| | | </div> |
| | | |
| | | </div> |
| | |
| | | import { useExamStore } from '@/store/index.js'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { submitExam } from '@/api/modules/exam.js'; |
| | | |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const examStore = useExamStore(); |
| | |
| | | }; |
| | | |
| | | // 交卷 |
| | | const submitExam = () => { |
| | | const submitExamHandle = () => { |
| | | submitDialog.value = true; |
| | | }; |
| | | |
| | |
| | | const timeOut = () => { |
| | | resetAllDialog(); |
| | | timeDialog.value = true; |
| | | setTimeout(() => { |
| | | const temp = { |
| | | ...examInfo.value, |
| | | titleList: examDetail.value |
| | | } |
| | | submitExam(temp).then(res => { |
| | | router.back(); |
| | | },2000); |
| | | }) |
| | | // setTimeout(() => { |
| | | // router.back(); |
| | | // },2000); |
| | | }; |
| | | |
| | | watchEffect(() => { |