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