Commit b48e41fe authored by Damon's avatar Damon

fix: 【ID1001312】【小程序-首页-收藏的题】:点击已收藏按钮,当前的试题未消失且数量未变。

parent b4a37247
...@@ -197,9 +197,9 @@ export default { ...@@ -197,9 +197,9 @@ export default {
computed: { computed: {
defaultImg() { defaultImg() {
let name = '' let name = ''
if (this.type === 4) { if (this.source === 5) {
name = 'no-error.png' name = 'no-error.png'
} else if (this.type === 5) { } else if (this.source === 4) {
name = 'no-collect.png' name = 'no-collect.png'
} }
return process.uniEnv.qn_base_url + name return process.uniEnv.qn_base_url + name
...@@ -283,20 +283,22 @@ export default { ...@@ -283,20 +283,22 @@ export default {
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0 let total = parseInt(res) || 0
// 考试 if (total > 0) {
if (this.type === 2) { // 考试
this.pageSize = this.totalPoint if (this.type === 2) {
total = this.totalPoint this.pageSize = this.totalPoint
total = this.totalPoint
}
this.total = total
// 练习模式-初始化答题卡列表
if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
} }
this.total = total
// 练习模式-初始化答题卡列表
if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
}) })
}, },
// 切换 // 切换
...@@ -538,6 +540,9 @@ export default { ...@@ -538,6 +540,9 @@ export default {
if(res) { if(res) {
const msg = status ? '取消收藏成功' : '收藏成功' const msg = status ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg) this.$u.toast(msg)
if (status && this.source === 4) {
this.current = this.currentIndex + 1
}
info.collectionFlag = !status info.collectionFlag = !status
if (this.source === 1) { //更新缓存数据 if (this.source === 1) { //更新缓存数据
this.questionList[this.questionWarehouseId][this.currentIndex] = info this.questionList[this.questionWarehouseId][this.currentIndex] = info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment