From 0cbb51d9337a56f0598a8c6c41cf3e5f575b50ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E6=B4=81?= <209192278@qq.com> Date: Sat, 4 Feb 2023 23:22:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?dengjie=20:=20=E4=BA=A7=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/myAvatar/myAvatar.vue | 2 +- .../detail/productsDetail/productsDetail.vue | 49 ++++++++++++------- static/styles/myAvatar.scss | 2 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/components/myAvatar/myAvatar.vue b/components/myAvatar/myAvatar.vue index 2030b29..fa09a00 100644 --- a/components/myAvatar/myAvatar.vue +++ b/components/myAvatar/myAvatar.vue @@ -67,7 +67,7 @@ //获取头像昵称和普通会员和VIP会员 getUser() { this.$apiServe.getUser().then(res => { - // console.log('个人信息==', res.data); + console.log('个人信息==', res.data); if (res.data.msg === "登录超时,请重新登录") { this.isLoad = false } diff --git a/pages/detail/productsDetail/productsDetail.vue b/pages/detail/productsDetail/productsDetail.vue index b33298f..728a405 100644 --- a/pages/detail/productsDetail/productsDetail.vue +++ b/pages/detail/productsDetail/productsDetail.vue @@ -72,7 +72,7 @@ {{detailList.pub_time}} - + 联系客服 @@ -88,9 +88,12 @@ - - + + + + @@ -112,10 +115,12 @@ showHeart: false, detailList: [], isLoad: true, - showM: false, + showUpdate: false, + showUpdating: false, showCall: false, mobile: '', - content: '您暂无权限访问,请升级VIP访问' + updateContent: '您暂无权限访问,请升级VIP访问', + updatingContent: '升级VIP,正在审核中' } }, onLoad(option) { @@ -123,11 +128,6 @@ this.getProductDetail() this.getCsTel() this.imgUrl = uni.getStorageSync('img_url') - if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { - this.isLoad = false - return - } - this.isLoad = true }, methods: { //获取客服电话 @@ -139,24 +139,35 @@ //获取详情信息 getProductDetail() { this.$apiServe.getProductDetail(this.id).then(res => { - console.log('产品详情', res.data); - if (res.data.msg == "没有权限访问" && uni.getStorageSync('loginToken')) { - this.showM = true + console.log('产品详情mtype', res.data.data.mytpe); + //授权登录拦截 + if (res.data.code == 0 && res.data.data.mytpe == 1) { + this.isLoad = false + } + //跳转到升级VIP页面 + if (res.data.code == 0 && res.data.data.mytpe == 2) { + this.showUpdate = true + } + //升级VIP正在审核中 + if (res.data.code == 0 && res.data.data.mytpe == 0) { + this.showUpdating = true } if (res.data.data) { let detail = res.data.data detail.pub_time = dateFormatDetail(detail.pub_time) detail.tags = detail.tags.split(',') - if (detail.is_thumb == 1) { + //点赞数 + if (detail.thumbcount !== 0 && detail.is_thumb == 0) { detail.thumb = parseInt(detail.thumb) + parseInt(detail.thumbcount) } else { - detail.thumb = parseInt(detail.thumb) - parseInt(detail.thumbcount) + if (detail.is_thumb == 1) { + detail.thumb = parseInt(detail.thumb) + parseInt(detail.thumbcount) + } else { + detail.thumb = parseInt(detail.thumb) - parseInt(detail.thumbcount) + } } this.detailList = detail } - // else { - // this.$toast.warn('没有更多详情了') - // } }).finally(_ => {}) }, //点击star收藏 @@ -231,7 +242,7 @@ }) }, // 联系客服模态框 - showModal() { + showContact() { this.showCall = true }, confirmCall() { diff --git a/static/styles/myAvatar.scss b/static/styles/myAvatar.scss index 5e37938..7245b1d 100644 --- a/static/styles/myAvatar.scss +++ b/static/styles/myAvatar.scss @@ -16,7 +16,7 @@ } .my_avatar { - margin-top: -184rpx; + margin-top: -186rpx; display: flex; flex-direction: column; align-items: center; From d5c4e58ca0d5786b21614ab57bc00e12269cc72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E6=B4=81?= <209192278@qq.com> Date: Sat, 4 Feb 2023 23:46:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?dengjie=20:=20=E6=8F=90=E7=A4=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=90=8E=E6=89=8D=E8=83=BD=E7=82=B9=E8=B5=9E,?= =?UTF-8?q?=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/productsDetail/productsDetail.vue | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/pages/detail/productsDetail/productsDetail.vue b/pages/detail/productsDetail/productsDetail.vue index 728a405..b808501 100644 --- a/pages/detail/productsDetail/productsDetail.vue +++ b/pages/detail/productsDetail/productsDetail.vue @@ -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) {