From a08557d07b1218f2546bc7515607bd28dfe26783 Mon Sep 17 00:00:00 2001 From: ljt990218 <2511590093@qq.com> Date: Fri, 19 Sep 2025 00:11:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(tabbar):=20=E4=BC=98=E5=8C=96`tabbar`?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tabbar/store.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tabbar/store.ts b/src/tabbar/store.ts index 7919cc0..a027a38 100644 --- a/src/tabbar/store.ts +++ b/src/tabbar/store.ts @@ -1,7 +1,9 @@ import type { CustomTabBarItem, CustomTabBarItemBadge } from './config' import { reactive } from 'vue' -import { FG_LOG_ENABLE } from '@/router/interceptor' +import { isNeedLoginMode } from '@/router/config' +import { FG_LOG_ENABLE, judgeIsExcludePath } from '@/router/interceptor' + import { tabbarList as _tabbarList, customTabbarEnable } from './config' // TODO 1/2: 中间的鼓包tabbarItem的开关 @@ -36,8 +38,11 @@ const tabbarStore = reactive({ curIdx: uni.getStorageSync('app-tabbar-index') || 0, prevIdx: uni.getStorageSync('app-tabbar-index') || 0, setCurIdx(idx: number) { - this.curIdx = idx - uni.setStorageSync('app-tabbar-index', idx) + // url 需要登录 && 不在白名单 || 不需要登录 && 不在黑名单 (关于 白名单|黑名单 逻辑: src/router/interceptor.ts) + if ((isNeedLoginMode && judgeIsExcludePath(tabbarList[idx].pagePath)) || (!isNeedLoginMode && !judgeIsExcludePath(tabbarList[idx].pagePath))) { + this.curIdx = idx + uni.setStorageSync('app-tabbar-index', idx) + } }, setTabbarItemBadge(idx: number, badge: CustomTabBarItemBadge) { if (tabbarList[idx]) { From 2d1d32218dbe92f53efda132d6a18bdb04201ca0 Mon Sep 17 00:00:00 2001 From: ljt990218 <2511590093@qq.com> Date: Fri, 19 Sep 2025 09:38:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(tabbar):=20=E4=BC=98=E5=8C=96=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=90=8E=20`tabbar`=20=E7=B4=A2=E5=BC=95=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tabbar/store.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tabbar/store.ts b/src/tabbar/store.ts index a027a38..42af3d4 100644 --- a/src/tabbar/store.ts +++ b/src/tabbar/store.ts @@ -3,7 +3,7 @@ import { reactive } from 'vue' import { isNeedLoginMode } from '@/router/config' import { FG_LOG_ENABLE, judgeIsExcludePath } from '@/router/interceptor' - +import { useTokenStore } from '@/store/token' import { tabbarList as _tabbarList, customTabbarEnable } from './config' // TODO 1/2: 中间的鼓包tabbarItem的开关 @@ -38,8 +38,9 @@ const tabbarStore = reactive({ curIdx: uni.getStorageSync('app-tabbar-index') || 0, prevIdx: uni.getStorageSync('app-tabbar-index') || 0, setCurIdx(idx: number) { - // url 需要登录 && 不在白名单 || 不需要登录 && 不在黑名单 (关于 白名单|黑名单 逻辑: src/router/interceptor.ts) - if ((isNeedLoginMode && judgeIsExcludePath(tabbarList[idx].pagePath)) || (!isNeedLoginMode && !judgeIsExcludePath(tabbarList[idx].pagePath))) { + const tokenStore = useTokenStore() + // 已登录 或 (url 需要登录 && 在白名单 || 不需要登录 && 不在黑名单) (关于 白名单|黑名单 逻辑: src/router/interceptor.ts) + if (tokenStore.hasLogin || (isNeedLoginMode && judgeIsExcludePath(tabbarList[idx].pagePath)) || (!isNeedLoginMode && !judgeIsExcludePath(tabbarList[idx].pagePath))) { this.curIdx = idx uni.setStorageSync('app-tabbar-index', idx) }