提交 509add12 authored 作者: lihuihui's avatar lihuihui

bug修改

上级 512b5473
...@@ -755,7 +755,8 @@ export default { ...@@ -755,7 +755,8 @@ export default {
// } // }
Exam.getExam(param, decodeURIComponent(this.requestParam.papersUrl)).then(res => { Exam.getExam(param, decodeURIComponent(this.requestParam.papersUrl)).then(res => {
Toast.clear() Toast.clear()
const times = this.$route.query.id === undefined ? res.sheet.remainingTime ? res.sheet.remainingTime : res.sheet.duration : res.sheet.duration let times = this.$route.query.id === undefined ? res.sheet.remainingTime ? res.sheet.remainingTime : res.sheet.duration : res.sheet.duration
times === undefined && (times = 0)
parseInt(this.$route.query.id) === -1 ? this.errorQuestion(res) : this.questionsData = res parseInt(this.$route.query.id) === -1 ? this.errorQuestion(res) : this.questionsData = res
this.questionCount = res.sheet.question_count this.questionCount = res.sheet.question_count
this.remainingTime = this.secondToDate(times) this.remainingTime = this.secondToDate(times)
...@@ -850,6 +851,7 @@ export default { ...@@ -850,6 +851,7 @@ export default {
answers: JSON.stringify(reqData), answers: JSON.stringify(reqData),
duration: this.questionsData.sheet.duration duration: this.questionsData.sheet.duration
} }
parseInt(this.$route.query.type) === 1 && (param.type = 1)
param.status = status param.status = status
Exam.examSubmit(param, this.requestParam.papersUrl).then(res => { Exam.examSubmit(param, this.requestParam.papersUrl).then(res => {
if (res.exm_status === 1) { if (res.exm_status === 1) {
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
:class="isObjKey(item, cItem) :class="isObjKey(item, cItem)
? cItem.question_answer === opt.id ? cItem.question_answer === opt.id
? 'active2' ? 'active2'
: question.answers[item.question_item_id][cItem.id].answers.find(i => { return i === opt.id }) : question.answer[item.question_item_id][cItem.id].answer.find(i => { return i === opt.id })
? 'active' ? 'active'
: '' : ''
: ''" : ''"
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<span> <span>
{{ {{
isObjKey(item, cItem) isObjKey(item, cItem)
? changeA_Z(question.answers[item.question_item_id][cItem.id].answers, cItem) ? changeA_Z(question.answer[item.question_item_id][cItem.id].answer, cItem)
: '' : ''
}} }}
</span> </span>
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
}, },
question: { question: {
list: [], list: [],
answers: {} answer: {}
}, },
time: { time: {
count: 1, count: 1,
...@@ -202,9 +202,9 @@ export default { ...@@ -202,9 +202,9 @@ export default {
}, },
isObjKey() { isObjKey() {
return function (item, cItem) { return function (item, cItem) {
return this.question.answers return this.question.answer
? this.question.answers[item.question_item_id] ? this.question.answer[item.question_item_id]
? this.question.answers[item.question_item_id][cItem.id] ? this.question.answer[item.question_item_id][cItem.id]
? 1 ? 1
: 0 : 0
: 0 : 0
...@@ -266,15 +266,15 @@ export default { ...@@ -266,15 +266,15 @@ export default {
init() { init() {
api.getExam({ type: 2, tag_id: this.$route.query.tag_id }).then(res => { api.getExam({ type: 2, tag_id: this.$route.query.tag_id }).then(res => {
const data = JSON.parse(res.data) const data = JSON.parse(res.data)
this.question.answers = data.sheet.answers this.question.answer = data.sheet.answer
data.sheet.questions.question_items.map(item => { data.sheet.questions.question_items.map(item => {
return item.question_list.map(cItem => { return item.question_list.map(cItem => {
if (parseInt(cItem.question_type) === 2 || (parseInt(cItem.question_type) === 5 && cItem.answer_count > 1)) { if (parseInt(cItem.question_type) === 2 || (parseInt(cItem.question_type) === 5 && cItem.answer_count > 1)) {
if (this.question.answers) { if (this.question.answer) {
if (this.question.answers[item.question_item_id]) { if (this.question.answer[item.question_item_id]) {
if (this.question.answers[item.question_item_id][cItem.id]) { if (this.question.answer[item.question_item_id][cItem.id]) {
cItem.isConfirm = true cItem.isConfirm = true
cItem.userAnswer = this.question.answers[item.question_item_id][cItem.id].answers cItem.userAnswer = this.question.answer[item.question_item_id][cItem.id].answer
return false return false
} }
} }
...@@ -296,21 +296,21 @@ export default { ...@@ -296,21 +296,21 @@ export default {
return false return false
} }
cItem.isConfirm = true cItem.isConfirm = true
const cacheData = this.question.answers const cacheData = this.question.answer
if (cacheData) { if (cacheData) {
cacheData[item.question_item_id] cacheData[item.question_item_id]
? cacheData[item.question_item_id][cItem.id] ? cacheData[item.question_item_id][cItem.id]
? cacheData[item.question_item_id][cItem.id].answers = cItem.userAnswer ? cacheData[item.question_item_id][cItem.id].answer = cItem.userAnswer
: cacheData[item.question_item_id][cItem.id] = { answers: cItem.userAnswer } : cacheData[item.question_item_id][cItem.id] = { answer: cItem.userAnswer }
: cacheData[item.question_item_id] = { [cItem.id]: { answers: cItem.userAnswer } } : cacheData[item.question_item_id] = { [cItem.id]: { answer: cItem.userAnswer } }
this.$forceUpdate() this.$forceUpdate()
this.cacheRequest() this.cacheRequest()
return false return false
} }
this.question.answers = { this.question.answer = {
[item.question_item_id]: { [item.question_item_id]: {
[cItem.id]: { [cItem.id]: {
answers: cItem.userAnswer answer: cItem.userAnswer
} }
} }
} }
...@@ -338,21 +338,21 @@ export default { ...@@ -338,21 +338,21 @@ export default {
if (this.isObjKey(item, cItem)) { if (this.isObjKey(item, cItem)) {
return false return false
} }
const cacheData = this.question.answers const cacheData = this.question.answer
if (cacheData) { if (cacheData) {
cacheData[item.question_item_id] cacheData[item.question_item_id]
? cacheData[item.question_item_id][cItem.id] ? cacheData[item.question_item_id][cItem.id]
? cacheData[item.question_item_id][cItem.id].answers = [opt.id] ? cacheData[item.question_item_id][cItem.id].answer = [opt.id]
: cacheData[item.question_item_id][cItem.id] = { answers: [opt.id] } : cacheData[item.question_item_id][cItem.id] = { answer: [opt.id] }
: cacheData[item.question_item_id] = { [cItem.id]: { answers: [opt.id] } } : cacheData[item.question_item_id] = { [cItem.id]: { answer: [opt.id] } }
this.$forceUpdate() this.$forceUpdate()
this.cacheRequest() this.cacheRequest()
return false return false
} }
this.question.answers = { this.question.answer = {
[item.question_item_id]: { [item.question_item_id]: {
[cItem.id]: { [cItem.id]: {
answers: [opt.id] answer: [opt.id]
} }
} }
} }
...@@ -361,9 +361,9 @@ export default { ...@@ -361,9 +361,9 @@ export default {
}, },
cacheRequest() { cacheRequest() {
let count = 0 let count = 0
const fKey = Object.keys(this.question.answers) const fKey = Object.keys(this.question.answer)
fKey.map(item => { fKey.map(item => {
const cKey = Object.keys(this.question.answers[item]) const cKey = Object.keys(this.question.answer[item])
for (let i = 0; i < cKey.length; i++) { for (let i = 0; i < cKey.length; i++) {
count++ count++
} }
...@@ -372,7 +372,7 @@ export default { ...@@ -372,7 +372,7 @@ export default {
type: 2, type: 2,
sheet_id: this.other.sheetId, sheet_id: this.other.sheetId,
status: this.other.totalQuestionCount === count ? 1 : 0, status: this.other.totalQuestionCount === count ? 1 : 0,
answers: JSON.stringify(this.question.answers), answers: JSON.stringify(this.question.answer),
duration: this.time.count duration: this.time.count
} }
api.cacheExam(param).then(res => {}) api.cacheExam(param).then(res => {})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论