From d580f043716d30f9617ed7f3f49a7e80d54b9865 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 13 三月 2025 15:42:17 +0800
Subject: [PATCH] fix: 二期需求

---
 apps/taro/src/hooks/router.ts |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/apps/taro/src/hooks/router.ts b/apps/taro/src/hooks/router.ts
index b1236c1..d571b8f 100644
--- a/apps/taro/src/hooks/router.ts
+++ b/apps/taro/src/hooks/router.ts
@@ -1,14 +1,16 @@
 import Taro from '@tarojs/taro';
-import { TabBarPageRouter } from '@/constants';
+import { TabBarPageRouterForCheck } from '@/constants';
 import { useSystemStore } from '@/stores/modules/system';
 import { useAppStore } from '@/stores/modules/app';
 import { isInAlipay } from '@/utils/env';
+import { useLifeRechargeContext } from '@life-payment/core-vue';
+import { getRouterPath } from '@life-payment/utils';
 
 export function useSwitchTab() {
   const systemStore = useSystemStore();
 
   const switchTab = (option: Taro.switchTab.Option) => {
-    const index = Object.values(TabBarPageRouter).findIndex((x) => option.url.includes(x));
+    const index = Object.values(TabBarPageRouterForCheck).findIndex((x) => option.url.includes(x));
     console.log('index: ', index);
     systemStore.setTabIndex(index);
     Taro.switchTab(option);
@@ -47,14 +49,27 @@
 export function useTabRouteEnhance() {
   const appStore = useAppStore();
   const { latestRoute } = storeToRefs(appStore);
+  const { blLifeRecharge } = useLifeRechargeContext();
 
   const router = Taro.useRouter();
 
+  const channelId = router.params?.channelId ?? '';
+  console.log('router.params: ', router);
+
   Taro.useDidShow(() => {
-    const isTabbarPage = Object.values(TabBarPageRouter).some((x) =>
+    const isTabbarPage = Object.values(TabBarPageRouterForCheck).some((x) =>
       latestRoute.value.toLowerCase().includes(x.toLowerCase())
     );
-    if (isTabbarPage) {
+    // if (blLifeRecharge.accountModel.channlesNum && !channelId) {
+    //   Taro.reLaunch({
+    //     // url: `${getRouterPath(router.path)}?channelId=${blLifeRecharge.accountModel.channlesNum}`,
+    //     url: `${router.path}&channelId=${blLifeRecharge.accountModel.channlesNum}`,
+    //     success() {
+    //       appStore.setLatestRoute('');
+    //     },
+    //   });
+    // }
+    if (isTabbarPage && isInAlipay) {
       Taro.reLaunch({
         url: router.path,
         success() {

--
Gitblit v1.9.1