提交 fb83ef89 authored 作者: lihuihui's avatar lihuihui

updata

上级 d1ce5e52
...@@ -43,7 +43,7 @@ export default class ExamAction extends BaseACTION { ...@@ -43,7 +43,7 @@ export default class ExamAction extends BaseACTION {
const opa = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] const opa = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
return opa[index] return opa[index]
} }
}).toString().replace(new RegExp(',', 'g'), ''), }),
answer_count: e.answer_count answer_count: e.answer_count
} }
}) })
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="st-btn" v-if="title === '随堂测试' || title === '模拟考试'"> <div class="st-btn" v-if="title === '随堂测试' || title === '模拟考试' || title === '知识点测试'">
<div class="btn" @click="go(1)">全部解析</div> <div class="btn" @click="go(1)">全部解析</div>
<div class="btn" @click="go(-1)">错题解析</div> <div class="btn" @click="go(-1)">错题解析</div>
</div> </div>
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
created() { created() {
}, },
mounted() { mounted() {
if (this.$route.query.course_id) { if (this.$route.query.course_id || this.$route.query.tag_id) {
this.$route.query.type === 1 || this.$route.query.type === '1' ? this.title = '随堂测试' : this.title = '知识点测试' this.$route.query.type === 1 || this.$route.query.type === '1' ? this.title = '随堂测试' : this.title = '知识点测试'
} else { } else {
this.$route.query.type === 1 || this.$route.query.type === '1' ? this.title = '能力自测' : this.title = '模拟考试' this.$route.query.type === 1 || this.$route.query.type === '1' ? this.title = '能力自测' : this.title = '模拟考试'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="exam-box"> <div class="exam-box">
<div id="top-view" v-show="!topicCard.isShow"> <div id="top-view" v-show="!topicCard.isShow">
<div class="tool-box"> <div class="tool-box">
<div class="time">{{ $route.query.course_id || $route.query.tag_id ? '' : '倒计时' }}{{ remainingTime }}</div> <div class="time">{{ $route.query.id !== undefined ? '' : $route.query.course_id || $route.query.tag_id ? '' : '倒计时' }}{{ remainingTime }}</div>
<div class="tag-box"> <div class="tag-box">
<span @click="signQuestion" v-if="isExamEnd" :class="signText == '标记' ? '' : 'active'">{{ signText }}</span> <span @click="signQuestion" v-if="isExamEnd" :class="signText == '标记' ? '' : 'active'">{{ signText }}</span>
<span @click="showCard" v-if="isExamEnd">答题卡</span> <span @click="showCard" v-if="isExamEnd">答题卡</span>
...@@ -25,29 +25,36 @@ ...@@ -25,29 +25,36 @@
<ul class="option" v-if="item.type === '1' || item.type === '6' || item.type === '5' && dItem.answer_count <= 1"> <ul class="option" v-if="item.type === '1' || item.type === '6' || item.type === '5' && dItem.answer_count <= 1">
<template v-for="(opt, oIndex) in dItem.question_options"> <template v-for="(opt, oIndex) in dItem.question_options">
<template v-if="requestData2 != 0 && requestData[item.id]"> <template v-if="requestData2 != 0 && requestData[item.id]">
<li :key="oIndex" v-if="requestData[item.id][dItem.id]" :class="requestData[item.id][dItem.id].answer.find(res => { return res === opt.id }) ? 'active' : ''" @click="selectRadio(dItem, opt.id, oIndex, item)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li> <li :key="oIndex" v-if="requestData[item.id][dItem.id]" :class="dItem.answerOpt.find(cla => { return cla == opaKey[oIndex] }) && (isAnalysis || $route.query.id) ? 'active2' : requestData[item.id][dItem.id].answer.find(res => { return res === opt.id }) ? 'active' : ''" @click="selectRadio(dItem, opt.id, oIndex, item)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li>
<li :key="oIndex" v-else :class="dItem.activeIndex == oIndex ? 'active' : ''" @click="selectRadio(dItem, opt.id, oIndex, item)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li> <li :key="oIndex" v-else :class="dItem.answerOpt.find(cla => { return cla == opaKey[oIndex] }) && (isAnalysis || $route.query.id) ? 'active2' : dItem.activeIndex == oIndex ? 'active' : ''" @click="selectRadio(dItem, opt.id, oIndex, item)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li>
</template> </template>
<template v-else> <template v-else>
<li :key="oIndex" :class="dItem.activeIndex == oIndex ? 'active' : ''" @click="selectRadio(dItem, opt.id, oIndex, item)" :data-id="opt.id">{{opaKey[oIndex]}}{{ opt.option }}</li> <li :key="oIndex" :class="dItem.answerOpt.find(cla => { return cla == opaKey[oIndex] }) && (isAnalysis || $route.query.id) ? 'active2' : dItem.activeIndex == oIndex ? 'active' : ''" @click="selectRadio(dItem, opt.id, oIndex, item)" :data-id="opt.id">{{opaKey[oIndex]}}{{ opt.option }}</li>
</template> </template>
</template> </template>
</ul> </ul>
<ul class="option" v-if="item.type === '2' || item.type === '5' && dItem.answer_count > 1"> <ul class="option" v-if="item.type === '2' || item.type === '5' && dItem.answer_count > 1">
<template v-for="(opt, oIndex) in dItem.question_options"> <template v-for="(opt, oIndex) in dItem.question_options">
<template v-if="requestData2 != 0 && requestData[item.id]"> <template v-if="requestData2 != 0 && requestData[item.id]">
<li :key="oIndex+'-'" v-if="requestData[item.id][dItem.id]" :class="opt.active ? 'active' : ''" @click="selectCheckbox(opt, opt.id, dItem, item, oIndex)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li> <li :key="oIndex+'-'" v-if="requestData[item.id][dItem.id]" :class="dItem.answerOpt.find(cla => { return cla == opaKey[oIndex] }) && (isAnalysis || $route.query.id) ? 'active2' : opt.active ? 'active' : ''" @click="selectCheckbox(opt, opt.id, dItem, item, oIndex)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li>
<li :key="oIndex+'-'" v-else :class="opt.active ? 'active' : ''" @click="selectCheckbox(opt, opt.id, dItem, item, oIndex)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li> <li :key="oIndex+'-'" v-else :class="dItem.answerOpt.find(cla => { return cla == opaKey[oIndex] }) && (isAnalysis || $route.query.id) ? 'active2' :opt.active ? 'active' : ''" @click="selectCheckbox(opt, opt.id, dItem, item, oIndex)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li>
</template> </template>
<template v-else> <template v-else>
<li :key="oIndex+'-'" :class="opt.active ? 'active' : ''" @click="selectCheckbox(opt, opt.id, dItem, item, oIndex)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li> <li :key="oIndex+'-'" :class="dItem.answerOpt.find(cla => { return cla == opaKey[oIndex] }) && (isAnalysis || $route.query.id) ? 'active2' :opt.active ? 'active' : ''" @click="selectCheckbox(opt, opt.id, dItem, item, oIndex)" :data-id="opt.id">{{opaKey[oIndex]}}.{{ opt.option }}</li>
</template> </template>
</template> </template>
</ul> </ul>
<div class="analy" v-if="isAnalysis || $route.query.id"> <div class="analy" v-if="isAnalysis || $route.query.id">
<div class="tit">答案解析</div> <div class="tit">答案解析</div>
<div class="txt">正确答案:<span>{{ dItem.answerOpt }}</span></div> <div class="txt">正确答案:<span>{{ dItem.answerOpt.toString().replace(new RegExp(',', 'g'), '') }}</span></div>
<div class="txt">您的答案:<span>{{ dItem.opaVal }}</span></div> <template v-if="requestData[item.id]">
<div class="txt" v-if="requestData[item.id][dItem.id]">您的答案:<span>{{ requestData[item.id][dItem.id].opaVal.toString().replace(new RegExp(',', 'g'), '') }}</span></div>
<div class="txt" v-else>您的答案:<span>{{ dItem.opaVal }}</span></div>
</template>
<template v-else>
<div class="txt">您的答案:<span>{{ dItem.opaVal }}</span></div>
</template>
<!-- <div class="txt">您的答案:<span>{{ dItem.opaVal }}</span></div> -->
<div class="exp"> <div class="exp">
<p class="name">解析:</p> <p class="name">解析:</p>
<p class="nr" v-html="dItem.question_analysis"></p> <p class="nr" v-html="dItem.question_analysis"></p>
...@@ -63,7 +70,7 @@ ...@@ -63,7 +70,7 @@
</div> </div>
<div class="btn-box" v-show="!topicCard.isShow"> <div class="btn-box" v-show="!topicCard.isShow">
<div class="padd"> <div class="padd">
<div class="analysis" @click="analyShow" v-if="$route.query.id == undefined && $route.query.course_id || $route.query.tag_id">查看解析</div> <div class="analysis" @click="analyShow" v-if="$route.query.id == undefined && ($route.query.course_id || $route.query.tag_id)">查看解析</div>
<div class="btn left" @click="switchQuestions('left')" v-show="currentNum !== 1">上一题</div> <div class="btn left" @click="switchQuestions('left')" v-show="currentNum !== 1">上一题</div>
<div class="btn right" @click="switchQuestions('right')" v-show="nextBtnShow">下一题</div> <div class="btn right" @click="switchQuestions('right')" v-show="nextBtnShow">下一题</div>
</div> </div>
...@@ -109,6 +116,16 @@ export default { ...@@ -109,6 +116,16 @@ export default {
directives: { directives: {
swiper: directive swiper: directive
}, },
metaInfo () {
if (this.$route.query.id !== undefined) {
return {
title: '题目解析',
meta: [
// { vmid: 'description', name: 'description', content: this.description }
]
}
}
},
data () { data () {
const _this = this const _this = this
return { return {
...@@ -381,16 +398,19 @@ export default { ...@@ -381,16 +398,19 @@ export default {
if (!this.requestData[oData.id][cData.id]) { if (!this.requestData[oData.id][cData.id]) {
this.requestData[oData.id][cData.id] = { this.requestData[oData.id][cData.id] = {
sign: false, sign: false,
answer: [checkId] answer: [checkId],
opaVal: [cData.opaVal]
} }
} else { } else {
this.requestData[oData.id][cData.id].answer = [checkId] this.requestData[oData.id][cData.id].answer = [checkId]
this.requestData[oData.id][cData.id].opaVal = [cData.opaVal]
} }
} else { } else {
this.requestData[oData.id] = { this.requestData[oData.id] = {
[cData.id]: { [cData.id]: {
sign: false, sign: false,
answer: [checkId] answer: [checkId],
opaVal: [cData.opaVal]
} }
} }
} }
...@@ -406,28 +426,35 @@ export default { ...@@ -406,28 +426,35 @@ export default {
if (this.requestData[oData.id]) { if (this.requestData[oData.id]) {
if (this.requestData[oData.id][cData.id]) { if (this.requestData[oData.id][cData.id]) {
const arr = this.requestData[oData.id][cData.id].answer const arr = this.requestData[oData.id][cData.id].answer
const arr2 = this.requestData[oData.id][cData.id].opaVal
this.requestData[oData.id][cData.id] = { this.requestData[oData.id][cData.id] = {
sign: this.requestData[oData.id][cData.id].sign sign: this.requestData[oData.id][cData.id].sign
} }
arr.push(checkId) arr.push(checkId)
console.log(arr2)
arr2.push(this.opaKey[index])
this.requestData[oData.id][cData.id].answer = arr this.requestData[oData.id][cData.id].answer = arr
this.requestData[oData.id][cData.id].opaVal = arr2
} else { } else {
this.requestData[oData.id][cData.id] = { this.requestData[oData.id][cData.id] = {
sign: false, sign: false,
answer: [checkId] answer: [checkId],
opaVal: [this.opaKey[index]]
} }
} }
} else { } else {
this.requestData[oData.id] = { this.requestData[oData.id] = {
[cData.id]: { [cData.id]: {
sign: false, sign: false,
answer: [checkId] answer: [checkId],
opaVal: [this.opaKey[index]]
} }
} }
} }
} else { } else {
const index = this.requestData[oData.id][cData.id].answer.indexOf(checkId) const index = this.requestData[oData.id][cData.id].answer.indexOf(checkId)
this.requestData[oData.id][cData.id].answer.splice(index, 1) this.requestData[oData.id][cData.id].answer.splice(index, 1)
this.requestData[oData.id][cData.id].opaVal.splice(index, 1)
} }
const opa = this.opaKey const opa = this.opaKey
const opaArr = [] const opaArr = []
...@@ -452,7 +479,7 @@ export default { ...@@ -452,7 +479,7 @@ export default {
param.user_id = window.localStorage.userId param.user_id = window.localStorage.userId
} }
Exam.getExam(param, this.requestParam.papersUrl).then(res => { Exam.getExam(param, this.requestParam.papersUrl).then(res => {
const times = res.sheet.remainingTime ? res.sheet.remainingTime : res.sheet.duration const times = this.$route.query.id === undefined ? res.sheet.remainingTime ? res.sheet.remainingTime : res.sheet.duration : res.sheet.duration
if (this.$route.query.id === -1 || this.$route.query.id === '-1') { if (this.$route.query.id === -1 || this.$route.query.id === '-1') {
this.errorQuestion(res) this.errorQuestion(res)
} else { } else {
...@@ -460,18 +487,25 @@ export default { ...@@ -460,18 +487,25 @@ export default {
} }
window.localStorage.userId = res.user_id window.localStorage.userId = res.user_id
this.remainingTime = this.secondToDate(times) this.remainingTime = this.secondToDate(times)
this.setClock(times) if (this.$route.query.id === undefined) {
if (res.sheet.status === 1 || res.sheet.status === 2) { this.setClock(times)
if (res.sheet.remainingTime === undefined) { }
this.setClock(res.sheet.duration) if (parseInt(res.status) === 1 || parseInt(res.status) === 2) {
} else { if (this.$route.query.tag_id !== undefined && this.$route.query.id === undefined) {
if (res.sheet.remainingTime > 0) { this.$emit('goExamResult', this.requestParam)
this.setClock(res.sheet.remainingTime)
} else {
this.examEnd()
this.scrollDom()
}
} }
this.examEnd()
this.scrollDom()
// if (res.sheet.remainingTime === undefined) {
// this.setClock(res.sheet.duration)
// } else {
// if (res.sheet.remainingTime > 0) {
// this.setClock(res.sheet.remainingTime)
// } else {
// this.examEnd()
// this.scrollDom()
// }
// }
} }
// clearTimeout(this.cache) // clearTimeout(this.cache)
setTimeout(() => { setTimeout(() => {
...@@ -489,6 +523,7 @@ export default { ...@@ -489,6 +523,7 @@ export default {
} }
this.requestData = res.answers this.requestData = res.answers
this.requestData2 = Object.keys(datas).length this.requestData2 = Object.keys(datas).length
console.log(this.requestData)
} else { } else {
this.requestData = {} this.requestData = {}
this.requestData2 = 0 this.requestData2 = 0
...@@ -534,7 +569,7 @@ export default { ...@@ -534,7 +569,7 @@ export default {
if (res.exm_status === 1) { if (res.exm_status === 1) {
clearInterval(this.initTime) clearInterval(this.initTime)
clearInterval(this.clockCount) clearInterval(this.clockCount)
if (this.requestParam.course_id !== undefined || this.questionsData.sheet.remainingTime > 0) { if (this.requestParam.course_id !== undefined || this.requestParam.tag_id !== undefined || this.questionsData.sheet.remainingTime > 0) {
if (isSub) { if (isSub) {
this.goExamResult() this.goExamResult()
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论