Refactor(购物车&我的):增加未登录或者登录过期显示以便微信审核
This commit is contained in:
+74
-15
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<view class="user user-page tabbar-page">
|
||||
<view
|
||||
v-if="$store.getters.token || userInfo.uid"
|
||||
class="acea-row row-column"
|
||||
>
|
||||
<view class="acea-row row-column">
|
||||
<view class="my-hearder">
|
||||
<view class="my-header-bg">
|
||||
<image
|
||||
@@ -28,7 +25,10 @@
|
||||
>
|
||||
地标文化特产
|
||||
</view>
|
||||
<view class="info">
|
||||
<view
|
||||
v-if="$store.getters.token || userInfo.uid"
|
||||
class="info"
|
||||
>
|
||||
<view class="name-cont">
|
||||
<view class="txt flex">
|
||||
<view class="txt-cont">
|
||||
@@ -59,21 +59,52 @@
|
||||
<image :src="userInfo.avatar" class="img" />
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="info"
|
||||
>
|
||||
<view class="name-cont">
|
||||
<view class="txt flex">
|
||||
<view class="txt-cont">
|
||||
您还未登录
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="qrcode qrcode2" @click="toLoginHandle">
|
||||
<text class="v12-font-30">
|
||||
去登录
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="avatar-cont">
|
||||
<image
|
||||
:src="webUrl + '/page/my/avatar.jpg'"
|
||||
class="img"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="my-hdeader-bottom">
|
||||
<view class="item" @click="linkTo('/pages/user/UserBill/index')">
|
||||
<view class="number">
|
||||
<view v-if="!isNoLogin" class="number">
|
||||
{{ userInfo.nowMoney ? force2Decimal(userInfo.nowMoney) : 0.00 }}
|
||||
</view>
|
||||
<view v-else class="number">
|
||||
--
|
||||
</view>
|
||||
<view class="txt">
|
||||
<image :src="webUrl + '/icon/icon-yue.png'" class="img" />
|
||||
余额
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" @click="linkTo('/pages/user/Points/index')">
|
||||
<view class="number">
|
||||
<view v-if="!isNoLogin" class="number">
|
||||
{{ userInfo.integral || 0 }}
|
||||
</view>
|
||||
<view v-else class="number">
|
||||
--
|
||||
</view>
|
||||
<view class="txt">
|
||||
<image :src="webUrl + '/icon/icon-jifen.png'" class="img" />
|
||||
积分
|
||||
@@ -359,7 +390,9 @@ export default {
|
||||
bannerBgUrl: '',
|
||||
userCenterBannerUrl: '',
|
||||
pageKeyId: Object.freeze('userIndex'),
|
||||
nowrap: true
|
||||
nowrap: true,
|
||||
// 是否已登录
|
||||
isNoLogin: false
|
||||
}
|
||||
},
|
||||
computed: mapGetters(['userInfo']),
|
||||
@@ -370,19 +403,23 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
if (this.$store.getters.token) {
|
||||
this.isNoLogin = false
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.$store.dispatch('getUser', true)
|
||||
// 获取用户等级信息
|
||||
this.getUserLevelInfo()
|
||||
this.getUserLevelInfoReq()
|
||||
this.isWeixin = isWeixin()
|
||||
this.getUnreadMsgList()
|
||||
// this.getUnreadMsgList()
|
||||
} else {
|
||||
this.isNoLogin = true
|
||||
/*
|
||||
cookie.set('redirect', '/pages/user/User/index')
|
||||
uni.reLaunch({
|
||||
url: '/pages/authorization/index'
|
||||
})
|
||||
*/
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
@@ -451,6 +488,9 @@ export default {
|
||||
this.$yrouter.push('/pages/order/ReturnList/index')
|
||||
},
|
||||
goMyOrder(type) {
|
||||
if (this.isNoLogin) {
|
||||
return
|
||||
}
|
||||
const types = {
|
||||
0: 0,
|
||||
1: 1,
|
||||
@@ -475,14 +515,18 @@ export default {
|
||||
this.$yrouter.push('/pkg_user/views/personalData')
|
||||
},
|
||||
// 获取用户等级信息
|
||||
getUserLevelInfo: function () {
|
||||
getUserLevelInfoReq() {
|
||||
const _this = this
|
||||
getUserLevelInfo().then((res) => {
|
||||
if (res.data) {
|
||||
_this.getTextWidth()
|
||||
_this.userLevelInfo = res.data
|
||||
if (res.isNoLogin) {
|
||||
this.isNoLogin = true
|
||||
return
|
||||
} else {
|
||||
if (res.data) {
|
||||
_this.getTextWidth()
|
||||
_this.userLevelInfo = res.data
|
||||
}
|
||||
}
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
if (err.toLogin) {
|
||||
@@ -534,6 +578,9 @@ export default {
|
||||
})
|
||||
},
|
||||
toolItemClickHandle(item) {
|
||||
if (this.isNoLogin) {
|
||||
return
|
||||
}
|
||||
const url = item.url
|
||||
if (item.showTip) {
|
||||
this.$dialog.toast({
|
||||
@@ -550,6 +597,9 @@ export default {
|
||||
if (!url) {
|
||||
return
|
||||
}
|
||||
if (this.isNoLogin) {
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
bannerClickHandle() {
|
||||
@@ -557,6 +607,12 @@ export default {
|
||||
return
|
||||
}
|
||||
this.linkTo(this.userCenterBannerUrl)
|
||||
},
|
||||
toLoginHandle() {
|
||||
cookie.set('redirect', '/pages/user/User/index')
|
||||
uni.reLaunch({
|
||||
url: '/pages/authorization/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -736,6 +792,9 @@ export default {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
.qrcode2 {
|
||||
width: 92rpx;
|
||||
}
|
||||
}
|
||||
.avatar-cont {
|
||||
.img {
|
||||
|
||||
Reference in New Issue
Block a user