Merge pull request 'dengjie' (#86) from dengjie into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/86
This commit is contained in:
odjbin
2023-02-04 15:49:42 +00:00
3 changed files with 59 additions and 39 deletions

View File

@@ -67,7 +67,7 @@
//获取头像昵称和普通会员和VIP会员 //获取头像昵称和普通会员和VIP会员
getUser() { getUser() {
this.$apiServe.getUser().then(res => { this.$apiServe.getUser().then(res => {
// console.log('个人信息==', res.data); console.log('个人信息==', res.data);
if (res.data.msg === "登录超时,请重新登录") { if (res.data.msg === "登录超时,请重新登录") {
this.isLoad = false this.isLoad = false
} }

View File

@@ -72,7 +72,7 @@
<text>{{detailList.pub_time}}</text> <text>{{detailList.pub_time}}</text>
</view> </view>
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse> <u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse>
<view class="footer" @click="showModal()"> <view class="footer" @click="showContact()">
<u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon> <u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon>
<text>联系客服</text> <text>联系客服</text>
</view> </view>
@@ -88,9 +88,12 @@
<login @success="reOnLoad()" @fail="failToLoad()"></login> <login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay> </u-overlay>
</view> </view>
<u-modal :show="showM" :content='content' closeOnClickOverlay="false" showCancelButton="true" <u-modal :show="showUpdate" :content='content' closeOnClickOverlay="false" showCancelButton="true"
confirmText="升级VIP" @confirm="confirm" @cancel="cancel" confirmColor="#0EBB5B"> confirmText="升级VIP" @confirm="confirm" @cancel="cancel" confirmColor="#0EBB5B">
<rich-text :nodes="content"></rich-text> <rich-text :nodes="updateContent"></rich-text>
</u-modal>
<u-modal :show="showUpdating" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
<rich-text :nodes="updatingContent"></rich-text>
</u-modal> </u-modal>
</view> </view>
</view> </view>
@@ -112,10 +115,12 @@
showHeart: false, showHeart: false,
detailList: [], detailList: [],
isLoad: true, isLoad: true,
showM: false, showUpdate: false,
showUpdating: false,
showCall: false, showCall: false,
mobile: '', mobile: '',
content: '您暂无权限访问请升级VIP访问' updateContent: '您暂无权限访问请升级VIP访问',
updatingContent: '升级VIP正在审核中'
} }
}, },
onLoad(option) { onLoad(option) {
@@ -123,11 +128,6 @@
this.getProductDetail() this.getProductDetail()
this.getCsTel() this.getCsTel()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
return
}
this.isLoad = true
}, },
methods: { methods: {
//获取客服电话 //获取客服电话
@@ -139,36 +139,52 @@
//获取详情信息 //获取详情信息
getProductDetail() { getProductDetail() {
this.$apiServe.getProductDetail(this.id).then(res => { this.$apiServe.getProductDetail(this.id).then(res => {
console.log('产品详情', res.data); console.log('产品详情mtype', res.data.data.mytpe);
if (res.data.msg == "没有权限访问" && uni.getStorageSync('loginToken')) { let detail = res.data.data
this.showM = true let dataCode = res.data.code
//授权登录拦截
if (dataCode == 0 && detail.mytpe == 1) {
this.isLoad = false
} }
if (res.data.data) { //跳转到升级VIP页面
let detail = res.data.data if (dataCode == 0 && detail.mytpe == 2) {
this.showUpdate = true
}
//升级VIP正在审核中
if (dataCode == 0 && detail.mytpe == 0) {
this.showUpdating = true
}
if (detail) {
detail.pub_time = dateFormatDetail(detail.pub_time) detail.pub_time = dateFormatDetail(detail.pub_time)
detail.tags = detail.tags.split(',') 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) detail.thumb = parseInt(detail.thumb) + parseInt(detail.thumbcount)
} else { } 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 this.detailList = detail
} }
// else {
// this.$toast.warn('没有更多详情了')
// }
}).finally(_ => {}) }).finally(_ => {})
}, },
//点击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) {
@@ -183,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) {
@@ -231,7 +251,7 @@
}) })
}, },
// 联系客服模态框 // 联系客服模态框
showModal() { showContact() {
this.showCall = true this.showCall = true
}, },
confirmCall() { confirmCall() {

View File

@@ -16,7 +16,7 @@
} }
.my_avatar { .my_avatar {
margin-top: -184rpx; margin-top: -186rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;