dengjie : 提示登录后才能点赞,收藏
This commit is contained in:
@@ -140,20 +140,21 @@
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
console.log('产品详情mtype', res.data.data.mytpe);
|
||||
let detail = res.data.data
|
||||
let dataCode = res.data.code
|
||||
//授权登录拦截
|
||||
if (res.data.code == 0 && res.data.data.mytpe == 1) {
|
||||
if (dataCode == 0 && detail.mytpe == 1) {
|
||||
this.isLoad = false
|
||||
}
|
||||
//跳转到升级VIP页面
|
||||
if (res.data.code == 0 && res.data.data.mytpe == 2) {
|
||||
if (dataCode == 0 && detail.mytpe == 2) {
|
||||
this.showUpdate = true
|
||||
}
|
||||
//升级VIP正在审核中
|
||||
if (res.data.code == 0 && res.data.data.mytpe == 0) {
|
||||
if (dataCode == 0 && detail.mytpe == 0) {
|
||||
this.showUpdating = true
|
||||
}
|
||||
if (res.data.data) {
|
||||
let detail = res.data.data
|
||||
if (detail) {
|
||||
detail.pub_time = dateFormatDetail(detail.pub_time)
|
||||
detail.tags = detail.tags.split(',')
|
||||
//点赞数
|
||||
@@ -172,14 +173,18 @@
|
||||
},
|
||||
//点击star收藏
|
||||
starTap() {
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('收藏成功')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
if (!uni.getStorageSync('loginToken')) {
|
||||
this.$toast.warn('请登录后操作')
|
||||
} else {
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('收藏成功')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
},
|
||||
//点击star取消收藏
|
||||
cancelStarTap(fav_id) {
|
||||
@@ -194,14 +199,18 @@
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
this.$apiServe.thumb(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('点赞成功')
|
||||
} else {
|
||||
this.$toast.warn('点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
if (!uni.getStorageSync('loginToken')) {
|
||||
this.$toast.warn('请登录后操作')
|
||||
} else {
|
||||
this.$apiServe.thumb(this.id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('点赞成功')
|
||||
} else {
|
||||
this.$toast.warn('点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
}
|
||||
},
|
||||
//取消点赞
|
||||
cancelHeartTap(thumb_id) {
|
||||
|
||||
Reference in New Issue
Block a user