From 1910e9f27373b8b4da75f076762025ceb3419965 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 12 六月 2025 15:40:50 +0800
Subject: [PATCH] fix: 暂时隐藏电信充值通道
---
apps/taro/src/hooks/router.ts | 38 ++++++++++++++++++++++++++++++++++----
1 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/apps/taro/src/hooks/router.ts b/apps/taro/src/hooks/router.ts
index 448a183..a7400ce 100644
--- a/apps/taro/src/hooks/router.ts
+++ b/apps/taro/src/hooks/router.ts
@@ -1,17 +1,20 @@
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';
+import { pathAddExtraParam } from '@/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);
+ RouteHelper.switchTab(option);
};
return switchTab;
}
@@ -47,13 +50,40 @@
export function useTabRouteEnhance() {
const appStore = useAppStore();
const { latestRoute } = storeToRefs(appStore);
+ const { blLifeRecharge } = useLifeRechargeContext();
+ const system = useSystemStore();
const router = Taro.useRouter();
+ const channelId = router.params?.channelId ?? '';
+ console.log('router: params', router, blLifeRecharge.accountModel.channlesNum);
+
+ Taro.useTabItemTap((item) => {
+ system.setTabIndex(item.index as any);
+ Taro.reLaunch({
+ url: pathAddExtraParam(item.pagePath, { channelId: blLifeRecharge.accountModel.channlesNum }),
+ success() {
+ appStore.setLatestRoute('');
+ },
+ });
+ });
+
Taro.useDidShow(() => {
- const isTabbarPage = Object.values(TabBarPageRouter).some((x) =>
+ const isTabbarPage = Object.values(TabBarPageRouterForCheck).some((x) =>
latestRoute.value.toLowerCase().includes(x.toLowerCase())
);
+ // const currentIsTabbarPage = Object.values(TabBarPageRouterForCheck).some((x) =>
+ // getRouterPath(router.path).toLowerCase().includes(x.toLowerCase())
+ // );
+ // if (currentIsTabbarPage && blLifeRecharge.accountModel.channlesNum && !channelId) {
+ // Taro.reLaunch({
+ // url: pathAddExtraParam(router.path, { channelId: blLifeRecharge.accountModel.channlesNum }),
+ // success() {
+ // appStore.setLatestRoute('');
+ // },
+ // });
+ // return;
+ // }
if (isTabbarPage && isInAlipay) {
Taro.reLaunch({
url: router.path,
--
Gitblit v1.9.1