| | |
| | | |
| | | const baseSubjectUrl = '/api/exam/v1/subject/' |
| | | |
| | | export function subjectList () { |
| | | return request({ |
| | | url: baseSubjectUrl + 'subjectList', |
| | | method: 'get' |
| | | }) |
| | | export function subjectList() { |
| | | return request({ |
| | | url: baseSubjectUrl + 'subjectList', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function fetchSubjectList (query) { |
| | | return request({ |
| | | url: baseSubjectUrl + 'subjectList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | export function fetchSubjectList(query) { |
| | | return request({ |
| | | url: baseSubjectUrl + 'subjectList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | export function getObj (id, query) { |
| | | return request({ |
| | | url: baseSubjectUrl + id, |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | export function getObj(id, query) { |
| | | return request({ |
| | | url: baseSubjectUrl + id, |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | export function addSubject (obj) { |
| | | return request({ |
| | | url: baseSubjectUrl, |
| | | method: 'post', |
| | | data: obj |
| | | }) |
| | | export function addSubject(obj) { |
| | | return request({ |
| | | url: baseSubjectUrl, |
| | | method: 'post', |
| | | data: obj |
| | | }) |
| | | } |
| | | |
| | | export function putSubject (obj) { |
| | | return request({ |
| | | url: baseSubjectUrl, |
| | | method: 'put', |
| | | data: obj |
| | | }) |
| | | export function putSubject(obj) { |
| | | return request({ |
| | | url: baseSubjectUrl, |
| | | method: 'put', |
| | | data: obj |
| | | }) |
| | | } |
| | | |
| | | export function delSubject (id) { |
| | | return request({ |
| | | url: baseSubjectUrl + id, |
| | | method: 'delete' |
| | | }) |
| | | export function delSubject(id) { |
| | | return request({ |
| | | url: baseSubjectUrl + id, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | export function delAllSubject (obj) { |
| | | return request({ |
| | | url: baseSubjectUrl + 'deleteAll', |
| | | method: 'post', |
| | | data: obj |
| | | }) |
| | | export function delAllSubject(obj) { |
| | | return request({ |
| | | url: baseSubjectUrl + 'deleteAll', |
| | | method: 'post', |
| | | data: obj |
| | | }) |
| | | } |
| | | |
| | | export function getSubjectAnswer (obj) { |
| | | return request({ |
| | | url: '/api/examSubjectChoices/details', |
| | | method: 'get', |
| | | params: obj |
| | | }) |
| | | export function getSubjectAnswer(obj) { |
| | | return request({ |
| | | url: '/api/examSubjectChoices/details', |
| | | method: 'get', |
| | | params: obj |
| | | }) |
| | | } |
| | | |
| | | |
| | | export function anonymousUserGetSubjectAnswer (obj) { |
| | | return request({ |
| | | url: baseSubjectUrl + 'anonymousUser/subjectAnswer', |
| | | method: 'get', |
| | | params: obj |
| | | }) |
| | | export function getSubjectResultInfo(obj) { |
| | | return request({ |
| | | url: '/api/examSubjectChoices/getSubjectResultInfo', |
| | | method: 'get', |
| | | params: obj |
| | | }) |
| | | } |
| | | |
| | | |
| | | export function anonymousUserGetSubjectAnswer(obj) { |
| | | return request({ |
| | | url: baseSubjectUrl + 'anonymousUser/subjectAnswer', |
| | | method: 'get', |
| | | params: obj |
| | | }) |
| | | } |
| | |
| | | </div> |
| | | |
| | | <ul class="subject-options" |
| | | id="subjectOptions" |
| | | v-for="option in options" |
| | | :key="option.id"> |
| | | <li class="subject-option"> |
| | | <input class="toggle" |
| | | <input |
| | | :disabled="currentAnswer" |
| | | class="toggle" |
| | | type="checkbox" |
| | | :checked="userAnswer === option.optionName" |
| | | :id="'option' + option.id" |
| | |
| | | }, |
| | | options: [], |
| | | userAnswer: '', |
| | | index: '' |
| | | index: '', |
| | | currentAnswer: false, |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | this.userAnswer = answer |
| | | }, |
| | | setSubjectInfo (subject, subjectCount, index) { |
| | | this.currentAnswer = false |
| | | this.subjectCount = subjectCount |
| | | this.subjectInfo = subject |
| | | if (subject.hasOwnProperty('examSubjectOptions')) { |
| | |
| | | console.log(this.options) |
| | | } |
| | | if (subject.hasOwnProperty('answer')) { |
| | | console.log(subject.answer); |
| | | if (subject.answer) { |
| | | this.currentAnswer = true |
| | | } |
| | | this.setAnswer(subject.answer) |
| | | } |
| | | this.index = index + '.' |
| | |
| | | <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 |
| | | |
| | |
| | | if (this.subjectIds[i].everyID == this.query.subjectId) { |
| | | |
| | | this.subjectIds[i].answer = this.getAnswer() |
| | | |
| | | |
| | | this.markAnswered(this.subjectIds[i].answer, i) |
| | | |
| | | if (i === this.subjectIds.length - 1) { |
| | |
| | | |
| | | 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 |