修复myAttention页面认证状态显示问题:1. 优化登录状态和认证状态的检查逻辑 2. 修复审核中状态显示错误的问题 3. 调整模板结构,确保状态显示正确

This commit is contained in:
davy 2025-04-05 10:01:09 +08:00
parent 913118d58e
commit 7c565ff4ad

View File

@ -17,12 +17,17 @@
</view> </view>
</view> </view>
<template v-else> <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"> <view class="flex flex-col align-center">
<text style="color: #747783;font-size: 28rpx;margin-bottom: 30rpx;">请先完成门店认证</text> <text style="color: #747783;font-size: 28rpx;margin-bottom: 30rpx;">请先完成门店认证</text>
<button class="cu-btn" style="color: #FFFFFF; background-color: #4E63E0;" @click="toVerify">去认证</button> <button class="cu-btn" style="color: #FFFFFF; background-color: #4E63E0;" @click="toVerify">去认证</button>
</view> </view>
</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> <template v-else>
<view v-if="tabCur == 0" class="my-container"> <view v-if="tabCur == 0" class="my-container">
<template v-if="favoriteBeerList.length > 0"> <template v-if="favoriteBeerList.length > 0">
@ -97,6 +102,7 @@
return { return {
isLogin: false, isLogin: false,
isVerified: false, isVerified: false,
isVerifying: false,
tabCur: 0, tabCur: 0,
favoriteBeerList: [], // favoriteBeerList: [], //
favoriteBreweryList: [], // favoriteBreweryList: [], //
@ -130,15 +136,49 @@
checkLoginStatus() { checkLoginStatus() {
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
const userInfo = uni.getStorageSync('userInfo') const userInfo = uni.getStorageSync('userInfo')
this.isLogin = !!token const barInfo = uni.getStorageSync('barInfo')
this.isVerified = userInfo?.isVerified === 1
if (this.isLogin && this.isVerified) { //
this.getFavoriteBeerList() this.isLogin = false
this.getFavoriteBreweryList() this.isVerified = false
} else { this.isVerifying = false
this.favoriteBeerList = [] this.favoriteBeerList = []
this.favoriteBreweryList = [] 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 {
// 使userInfoisVerified
this.isVerified = userInfo?.isVerified === 1
this.isVerifying = false
}
//
if (this.isVerified || this.isVerifying) {
this.getFavoriteBeerList()
this.getFavoriteBreweryList()
} }
}, },
// //
@ -153,18 +193,8 @@
}, },
// //
loginSuccess() { loginSuccess() {
this.isLogin = true //
const userInfo = uni.getStorageSync('userInfo') this.checkLoginStatus()
this.isVerified = userInfo?.isVerified === 1
if (this.isVerified) {
this.favoriteBeerList = []
this.favoriteBreweryList = []
this.beerQuery.pageNum = 1
this.breweryQuery.pageNum = 1
this.getFavoriteBeerList()
this.getFavoriteBreweryList()
}
}, },
tabSelect(e) { tabSelect(e) {
console.log(e) console.log(e)