| | |
| | | <el-button :class="{ 'answered': subjectIds[index].answered }" |
| | | circle |
| | | v-for="(value, index) in subjectIds" |
| | | :style="{background: value.color}" |
| | | :key="index" |
| | | @click="toSubject(value.everyID, value.type, index)"> {{index + 1}} </el-button> |
| | | </el-row> |
| | |
| | | import { saveAndNext } from '@/api/exam/answer' |
| | | import { getSubjectIds } from '@/api/exam/exam' |
| | | import { getCurrentTime } from '@/api/exam/examRecord' |
| | | import { getSubjectAnswer } from '@/api/exam/subject' |
| | | import { getSubjectResultInfo } from '@/api/exam/subject' |
| | | |
| | | import moment from 'moment' |
| | | import { messageSuccess, messageFail, messageWarn, isNotEmpty } from '@/util/util' |
| | |
| | | return { |
| | | loadingLast: false, |
| | | loadingNext: false, |
| | | |
| | | //1:绿色 2:红色 3:无色 |
| | | result:3, |
| | | currentTime: 0, |
| | | startTime: 0, |
| | | endTime: 0, |
| | |
| | | index: i + 1, |
| | | answered: false, |
| | | answer: '', |
| | | score: subjectData[i].score |
| | | score: subjectData[i].score, |
| | | color: '#fff' |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.updateSubjectIndex() |
| | | // 获取当前题目信息 |
| | | getSubjectAnswer({ |
| | | getSubjectResultInfo({ |
| | | id: this.subjectIds[0].everyID, |
| | | }).then(response => { |
| | | if (isNotEmpty(response.data.data)) { |
| | |
| | | |
| | | this.subjectIndex = index |
| | | |
| | | this.saveCurrentSubjectAndGetNextSubject(nextSubjectType.last, everyID, type) |
| | | this.saveCurrentSubjectAndGetNextSubjectLast(nextSubjectType.last, everyID, type) |
| | | |
| | | break |
| | | |
| | |
| | | |
| | | this.subjectIndex = index |
| | | |
| | | this.saveCurrentSubjectAndGetNextSubject(nextSubjectType.next, everyID) |
| | | this.saveCurrentSubjectAndGetNextSubject(nextSubjectType.next, everyID,this.subjectIds[i-1]) |
| | | |
| | | break |
| | | |
| | |
| | | |
| | | }, |
| | | // 保存当前题目,同时根据序号加载下一题 |
| | | saveCurrentSubjectAndGetNextSubject (nextType, nextSubjectId) { |
| | | saveCurrentSubjectAndGetNextSubject (nextType, nextSubjectId,subjectIds) { |
| | | |
| | | |
| | | this.startLoading(nextType) |
| | | |
| | | getSubjectAnswer({ id: nextSubjectId }).then(response => { |
| | | var data = { |
| | | id:nextSubjectId, |
| | | preSubJectId:this.query.subjectId, |
| | | preResult:this.getAnswer() |
| | | } |
| | | getSubjectResultInfo(data).then(response => { |
| | | |
| | | if (response.data.data !== null) { |
| | | |
| | | // 保存成功后更新答题卡状态 |
| | | const subject = response.data.data |
| | | |
| | | //结果 |
| | | this.result = response.data.data.result; |
| | | |
| | | if(this.result==1){ |
| | | subjectIds.color = "#67C23A" |
| | | } |
| | | if(this.result==2){ |
| | | subjectIds.color = "red" |
| | | } |
| | | |
| | | const { id, choicesType } = subject |
| | | |
| | | this.query.subjectId = id |
| | | |
| | | this.query.type = choicesType |
| | | |
| | | for (let i = 0; i < this.subjectIds.length; i++) { |
| | | |
| | | if (this.subjectIds[i].everyID == nextSubjectId) { |
| | | |
| | | subject.answer = this.subjectIds[i].answer |
| | | |
| | | break |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | this.setSubjectInfo(subject) |
| | | |
| | | // store.dispatch('SetSubjectInfo', subject).then(() => { }) |
| | | |
| | | } |
| | | // 更新时间 |
| | | getCurrentTime().then(response => { |
| | | this.subjectStartTime = moment(response.data.data) |
| | | }) |
| | | this.endLoading(nextType) |
| | | }).catch((error) => { |
| | | console.log(error) |
| | | messageFail(this, '获取题目失败') |
| | | this.endLoading(nextType) |
| | | }) |
| | | }, |
| | | // 保存当前题目,同时根据序号加载上一题 |
| | | saveCurrentSubjectAndGetNextSubjectLast (nextType, nextSubjectId) { |
| | | |
| | | this.startLoading(nextType) |
| | | |
| | | var data = { |
| | | id:nextSubjectId |
| | | } |
| | | getSubjectResultInfo(data).then(response => { |
| | | |
| | | if (response.data.data !== null) { |
| | | |
| | | // 保存成功后更新答题卡状态 |
| | | const subject = response.data.data |
| | | |
| | | //结果 |
| | | this.result = response.data.data.result; |
| | | |
| | | // if(this.result==1){ |
| | | // subjectIds.color = "#67C23A" |
| | | // } |
| | | // if(this.result==2){ |
| | | // subjectIds.color = "red" |
| | | // } |
| | | |
| | | const { id, choicesType } = subject |
| | | |
| | | this.query.subjectId = id |