| | |
| | | import { start } from '@/api/exam/examRecord' |
| | | import {setStore, getStore} from '@/util/store' |
| | | import { setStore, getStore } from '@/util/store' |
| | | import { submit } from '@/api/exam/answer' |
| | | |
| | | const exam = { |
| | |
| | | }) || {}, |
| | | incorrectRecord: getStore({ |
| | | name: 'incorrectRecord' |
| | | }) || {} |
| | | }) || {}, |
| | | examUserData: {}, |
| | | }, |
| | | actions: { |
| | | |
| | | // 设置题目信息 |
| | | SetSubjectInfo ({ commit, state }, subject) { |
| | | SetSubjectInfo({ commit, state }, subject) { |
| | | commit('SET_SUBJECT', subject) |
| | | }, |
| | | // 开始考试 |
| | | StartExam ({ commit, state }, examRecord) { |
| | | StartExam({ commit, state }, examRecord) { |
| | | return new Promise((resolve, reject) => { |
| | | start(examRecord).then(response => { |
| | | commit('SET_EXAM', response.data.data.examination) |
| | |
| | | }) |
| | | }, |
| | | // 提交考试 |
| | | SubmitExam ({ commit, state }, exam) { |
| | | SubmitExam({ commit, state }, exam) { |
| | | return new Promise((resolve, reject) => { |
| | | submit(exam).then(response => { |
| | | resolve(response) |
| | |
| | | }) |
| | | }, |
| | | // 当前错题记录 |
| | | SetIncorrectRecord ({ commit, state }, incorrectRecord) { |
| | | SetIncorrectRecord({ commit, state }, incorrectRecord) { |
| | | commit('SET_INCORRECT_RECORD', incorrectRecord) |
| | | } |
| | | }, |
| | | mutations: { |
| | | SetexamUserData(state, data) { |
| | | state.examUserData = data; |
| | | }, |
| | | SET_EXAM: (state, exam) => { |
| | | state.exam = exam |
| | | setStore({ |