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