个人中心按钮登录拦截

This commit is contained in:
唐明明
2022-01-14 08:55:54 +08:00
parent 90910363f0
commit e46e35cfbd

View File

@@ -13,7 +13,7 @@
</view>
</block>
<block v-else>
<view class="name" @click="Login">未登录</view>
<view class="name" @click="isLogin()">未登录</view>
</block>
</view>
</view>
@@ -61,23 +61,23 @@
</view>
<!-- 订单 -->
<view class="order-box">
<view class="order-box-item" @click="$Router.push({name: 'Order'})">
<view class="order-box-item" @click="onBtn('Order', {index: 0})">
<image class="icon" src="@/static/user/order_icon_00.png" mode="widthFix"></image>
<view class="title">全部订单</view>
</view>
<view class="order-box-item" @click="$Router.push({name: 'Order'})">
<view class="order-box-item" @click="onBtn('Order', {index: 1})">
<image class="icon" src="@/static/user/order_icon_01.png" mode="widthFix"></image>
<view class="title">待付款</view>
</view>
<view class="order-box-item" @click="$Router.push({name: 'Order'})">
<view class="order-box-item" @click="onBtn('Order', {index: 2})">
<image class="icon" src="@/static/user/order_icon_02.png" mode="widthFix"></image>
<view class="title">待发货</view>
</view>
<view class="order-box-item" @click="$Router.push({name: 'Order'})">
<view class="order-box-item" @click="onBtn('Order', {index: 3})">
<image class="icon" src="@/static/user/order_icon_03.png" mode="widthFix"></image>
<view class="title">待收货</view>
</view>
<view class="order-box-item" @click="$Router.push({name: 'Order'})">
<view class="order-box-item" @click="onBtn('Order', {index: 4})">
<image class="icon" src="@/static/user/order_icon_04.png" mode="widthFix"></image>
<view class="title">已完成</view>
</view>
@@ -135,11 +135,9 @@
getInfo(){
if(this.$store.state.token === '') return
info().then(res => {
console.log(res)
uni.setNavigationBarTitle({
title: res.nickname
})
this.userInfo = res
}).catch(err => {
uni.showToast({
@@ -150,57 +148,55 @@
},
// 开通会员
openVip(){
if(this.$store.state.token === ''){
this.Login()
return
}
uni.showActionSheet({
itemList: ["我是新用户", "我是老用户"],
success: res=> {
switch (res.tapIndex){
case 0:
uni.showModal({
title: '开通提示',
content: '平台新用户完成手笔订单即可获赠ZH健康会员',
showCancel:false,
cancelText: '去完成',
success: res => {
console.log(res)
this.$Router.pushTab({name: 'Store'})
}
})
break;
case 1:
uni.showToast({
title: '老用户渠道暂未开放',
icon : 'none'
})
break;
if(this.isLogin()){
uni.showActionSheet({
itemList: ["我是新用户", "我是老用户"],
success: res=> {
switch (res.tapIndex){
case 0:
uni.showModal({
title: '开通提示',
content: '平台新用户完成手笔订单即可获赠ZH健康会员',
showCancel:false,
cancelText: '去完成',
success: res => {
console.log(res)
this.$Router.pushTab({name: 'Store'})
}
})
break;
case 1:
uni.showToast({
title: '老用户渠道暂未开放',
icon : 'none'
})
break;
}
}
}
})
})
}
},
// 开通钱包
onWallet(){
if(this.$store.state.token === ''){
this.Login()
return
if(this.isLogin()){
if(this.userInfo.is_wallet) this.$Router.push({name: 'WalletProperty'})
else this.$Router.push({name: 'WalletAdd'})
}
if(this.userInfo.is_wallet) this.$Router.push({name: 'WalletProperty'})
else this.$Router.push({name: 'WalletAdd'})
},
// 按钮导航
onBtn(name, params){
if(this.$store.state.token === ''){
this.Login()
return
if(this.isLogin()){
this.$Router.push({name, params})
}
this.$Router.push({name, params})
},
// 登录
Login(){
const Auth = new userAuth()
Auth.Login()
// 检查登录
isLogin(){
if(this.$store.state.token === ''){
const Auth = new userAuth()
Auth.Login()
return false
}
return true
},
// 退出登录
logOut(){