点赞bug

This commit is contained in:
shijingjing
2023-04-06 15:05:00 +08:00
parent 0b9928e1e0
commit 72b2edc0d4
2 changed files with 8 additions and 3 deletions

View File

@@ -120,10 +120,11 @@ export default {
this.flag = true
this.$instance.post(`/app/appcontentinfo/supportById?id=${id}`).then(res=> {
if(res?.code==0) {
this.flag = false
this.list[index].upStatus = 1
this.$u.toast(`点赞成功`)
}
})
}).finally(() => this.flag = false)
},
toPages(url,status) {
if(!this.user.idNumber) {

View File

@@ -2,7 +2,9 @@
<div class="handpick">
<div class="list" v-for="(item,index) in list" :key="index">
<div class="top">
<div class="left" @click="$linkTo(`./pickDetail?id=${item.id}`)">{{ item.content }}</div>
<div class="left" @click="$linkTo(`./pickDetail?id=${item.id}`)">
{{ item.content }}
</div>
<div class="right" @click="upCount(item.id, index)">
<img :src="item.upStatus == 0 ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png'" alt="">
<div>
@@ -74,15 +76,17 @@ export default {
},
// 点赞
upCount(id,index) {
console.log(id,index);
if (this.flag) return
this.flag = true
this.$instance.post(`/app/appcontentinfo/supportById?id=${id}`).then(res => {
if (res?.code == 0) {
this.flag = false
this.list[index].upStatus = 1
this.$u.toast(`点赞成功`)
}
})
}).finally(() => this.flag = false)
},
},
onShow() {