|
|
|
|
@ -85,7 +85,7 @@
|
|
|
|
|
<template>
|
|
|
|
|
<template v-if="!isTotalEnd">
|
|
|
|
|
<div class="answers__text answers__result">
|
|
|
|
|
打卡成功,已完成<span>{{detail.point_answer_total + 1}}</span>个红色场馆的打卡, 完成{{detail.points.length}}家红色场馆打卡即可获得<span>荣誉证书</span>
|
|
|
|
|
打卡成功,已完成<span>{{ totalDone }}</span>个红色场馆的打卡, 完成{{ detail.points ? detail.points.length : 0}}家红色场馆打卡即可获得<span>荣誉证书</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="answers__btn" @click="$u.throttle(toMap)">
|
|
|
|
|
@ -127,12 +127,12 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
async getDetail () {
|
|
|
|
|
const res = await this.$u.api.getPoints()
|
|
|
|
|
this.isTotalEnd = res.points.length == res.point_answer_total
|
|
|
|
|
this.isTotalEnd = res.points?.length == res.point_answer_total
|
|
|
|
|
this.detail = res
|
|
|
|
|
},
|
|
|
|
|
async getQuestions () {
|
|
|
|
|
async getQuestions (id) {
|
|
|
|
|
const res = await this.$u.api.getQuestions({
|
|
|
|
|
point_id: this.vuex_point_id
|
|
|
|
|
point_id: id
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.answers = res.questions
|
|
|
|
|
@ -148,12 +148,12 @@ export default {
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
this.progress = this.now === (this.answers.length - 1) ? 3 : 2
|
|
|
|
|
this.progress = this.now === (this.answers?.length - 1) ? 3 : 2
|
|
|
|
|
|
|
|
|
|
if (this.progress === 3) {
|
|
|
|
|
this.isTotalEnd = this.detail.points.length == ( Number(this.detail.point_answer_total) + 1)
|
|
|
|
|
this.isTotalEnd = this.detail.points?.length == ( Number(this.detail.point_answer_total) + 1)
|
|
|
|
|
this.$u.api.saveQuiz({
|
|
|
|
|
point_id: this.vuex_point_id,
|
|
|
|
|
point_id: this.$route.query?.id ? this.$route.query.id : this.vuex_point_id,
|
|
|
|
|
answers: this.myAnswers
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -175,6 +175,15 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
totalDone () {
|
|
|
|
|
if (this.detail && this.detail.points) {
|
|
|
|
|
let id = this.$route.query?.id ? this.$route.query.id : this.vuex_point_id
|
|
|
|
|
let point = this.detail.points.find(i => i.id == id)
|
|
|
|
|
return point?.has_answer > 0 ? this.detail.point_answer_total : this.detail.point_answer_total+1
|
|
|
|
|
}
|
|
|
|
|
return 1
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
correctAnswer () {
|
|
|
|
|
let correct = this.answers[this.now]?.options?.find(i => i.is_correct)
|
|
|
|
|
return `${this.num(correct?.myindex)}、${correct?.title}`
|
|
|
|
|
@ -246,8 +255,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
this.getQuestions();
|
|
|
|
|
onLoad(option) {
|
|
|
|
|
this.getQuestions(option.id);
|
|
|
|
|
this.getDetail();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|