修复myAttention页面认证状态显示问题:1. 优化登录状态和认证状态的检查逻辑 2. 修复审核中状态显示错误的问题 3. 调整模板结构,确保状态显示正确
This commit is contained in:
parent
913118d58e
commit
7c565ff4ad
@ -17,12 +17,17 @@
|
||||
</view>
|
||||
</view>
|
||||
<template v-else>
|
||||
<view v-if="!isVerified" class="flex align-center justify-center" style="height: calc(100vh - 100rpx);">
|
||||
<view v-if="!isVerified && !isVerifying" class="flex align-center justify-center" style="height: calc(100vh - 100rpx);">
|
||||
<view class="flex flex-col align-center">
|
||||
<text style="color: #747783;font-size: 28rpx;margin-bottom: 30rpx;">请先完成门店认证</text>
|
||||
<button class="cu-btn" style="color: #FFFFFF; background-color: #4E63E0;" @click="toVerify">去认证</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else-if="isVerifying" class="flex align-center justify-center" style="height: calc(100vh - 100rpx);">
|
||||
<view class="flex flex-col align-center">
|
||||
<text style="color: #747783;font-size: 28rpx;margin-bottom: 30rpx;">您的门店正在认证中,请耐心等待</text>
|
||||
</view>
|
||||
</view>
|
||||
<template v-else>
|
||||
<view v-if="tabCur == 0" class="my-container">
|
||||
<template v-if="favoriteBeerList.length > 0">
|
||||
@ -97,6 +102,7 @@
|
||||
return {
|
||||
isLogin: false,
|
||||
isVerified: false,
|
||||
isVerifying: false,
|
||||
tabCur: 0,
|
||||
favoriteBeerList: [], // 收藏的酒款列表
|
||||
favoriteBreweryList: [], // 收藏的酒厂列表
|
||||
@ -130,15 +136,49 @@
|
||||
checkLoginStatus() {
|
||||
const token = uni.getStorageSync('token')
|
||||
const userInfo = uni.getStorageSync('userInfo')
|
||||
this.isLogin = !!token
|
||||
this.isVerified = userInfo?.isVerified === 1
|
||||
const barInfo = uni.getStorageSync('barInfo')
|
||||
|
||||
if (this.isLogin && this.isVerified) {
|
||||
// 重置状态
|
||||
this.isLogin = false
|
||||
this.isVerified = false
|
||||
this.isVerifying = false
|
||||
this.favoriteBeerList = []
|
||||
this.favoriteBreweryList = []
|
||||
this.beerQuery.pageNum = 1
|
||||
this.breweryQuery.pageNum = 1
|
||||
|
||||
// 检查登录状态
|
||||
if (!token) {
|
||||
return
|
||||
}
|
||||
|
||||
this.isLogin = true
|
||||
|
||||
// 检查认证状态
|
||||
if (barInfo) {
|
||||
if (barInfo.authState === 2) {
|
||||
// 已认证
|
||||
this.isVerified = true
|
||||
this.isVerifying = false
|
||||
} else if (barInfo.authState === 1) {
|
||||
// 认证中
|
||||
this.isVerified = false
|
||||
this.isVerifying = true
|
||||
} else {
|
||||
// 未认证
|
||||
this.isVerified = false
|
||||
this.isVerifying = false
|
||||
}
|
||||
} else {
|
||||
// 兼容旧版本,使用userInfo中的isVerified
|
||||
this.isVerified = userInfo?.isVerified === 1
|
||||
this.isVerifying = false
|
||||
}
|
||||
|
||||
// 如果已登录且已认证或正在认证中,获取关注列表
|
||||
if (this.isVerified || this.isVerifying) {
|
||||
this.getFavoriteBeerList()
|
||||
this.getFavoriteBreweryList()
|
||||
} else {
|
||||
this.favoriteBeerList = []
|
||||
this.favoriteBreweryList = []
|
||||
}
|
||||
},
|
||||
// 去登录
|
||||
@ -153,18 +193,8 @@
|
||||
},
|
||||
// 登录成功
|
||||
loginSuccess() {
|
||||
this.isLogin = true
|
||||
const userInfo = uni.getStorageSync('userInfo')
|
||||
this.isVerified = userInfo?.isVerified === 1
|
||||
|
||||
if (this.isVerified) {
|
||||
this.favoriteBeerList = []
|
||||
this.favoriteBreweryList = []
|
||||
this.beerQuery.pageNum = 1
|
||||
this.breweryQuery.pageNum = 1
|
||||
this.getFavoriteBeerList()
|
||||
this.getFavoriteBreweryList()
|
||||
}
|
||||
// 重新检查登录状态
|
||||
this.checkLoginStatus()
|
||||
},
|
||||
tabSelect(e) {
|
||||
console.log(e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user