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/components/NavigationBar/TransparentNavigationBar.vue | 6 ++++--
apps/taro/src/app.ts | 1 +
apps/taro/src/hooks/login.ts | 4 ++--
packages/utils/common.ts | 5 +++++
packages/components/src/styles/components.scss | 1 +
apps/taro/src/constants/tabBar.ts | 9 +++++++--
packages/components/src/views/Order/OrderRefundResultView.vue | 2 +-
apps/taro/src/hooks/router.ts | 21 ++++++++++++++++++---
apps/h5/src/components/NavigationBar/CommonNavigationBar.vue | 2 +-
apps/taro/src/components/NavigationBar/CommonNavigationBar.vue | 4 ++--
apps/taro/src/utils/page.ts | 2 +-
11 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/apps/h5/src/components/NavigationBar/CommonNavigationBar.vue b/apps/h5/src/components/NavigationBar/CommonNavigationBar.vue
index b8fc5fc..07c508b 100644
--- a/apps/h5/src/components/NavigationBar/CommonNavigationBar.vue
+++ b/apps/h5/src/components/NavigationBar/CommonNavigationBar.vue
@@ -34,7 +34,7 @@
return !isCanGoBack.value;
});
// const isTabbarPage = computed(() =>
-// Object.values(TabBarPageRouter).some((x) => x.toLowerCase() === router.path.toLowerCase())
+// Object.values(TabBarPageRouterForCheck).some((x) => x.toLowerCase() === router.path.toLowerCase())
// );
function goBack() {
diff --git a/apps/taro/src/app.ts b/apps/taro/src/app.ts
index fcdd16e..1af221b 100644
--- a/apps/taro/src/app.ts
+++ b/apps/taro/src/app.ts
@@ -52,6 +52,7 @@
onLaunch(options) {
if (options.query?.channelId) {
console.log('options: ', options);
+ blLifeRecharge.accountModel.setChannlesNum(options.query.channelId);
}
// 濡傛灉鏄敹钘忚繘鍏�
if (options.query.collect) {
diff --git a/apps/taro/src/components/NavigationBar/CommonNavigationBar.vue b/apps/taro/src/components/NavigationBar/CommonNavigationBar.vue
index c2e9a93..e83ac7c 100644
--- a/apps/taro/src/components/NavigationBar/CommonNavigationBar.vue
+++ b/apps/taro/src/components/NavigationBar/CommonNavigationBar.vue
@@ -25,7 +25,7 @@
import IconArrowWhite from '@/assets/common/icon-navi-arrow-white.png';
import Taro from '@tarojs/taro';
import { goBack } from '@/utils';
-import { TabBarPageRouter } from '@/constants';
+import { TabBarPageRouterForCheck } from '@/constants';
defineOptions({
name: 'CommonNavigationBar',
@@ -43,7 +43,7 @@
});
const isTabbarPage = computed(() =>
- Object.values(TabBarPageRouter).some((x) => x.toLowerCase() === router.path.toLowerCase())
+ Object.values(TabBarPageRouterForCheck).some((x) => x.toLowerCase() === router.path.toLowerCase())
);
const barStyle = computed(() => {
diff --git a/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue b/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue
index 536f323..bf5f382 100644
--- a/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue
+++ b/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue
@@ -25,7 +25,7 @@
import IconArrowWhite from '@/assets/common/icon-navi-arrow-white.png';
import Taro from '@tarojs/taro';
import { goBack } from '@/utils';
-import { TabBarPageRouter } from '@/constants';
+import { TabBarPageRouterForCheck } from '@/constants';
defineOptions({
name: 'TransparentNavigationBar',
@@ -44,7 +44,9 @@
});
const isTabbarPage = computed(() =>
- Object.values(TabBarPageRouter).some((x) => router.path.toLowerCase().includes(x.toLowerCase()))
+ Object.values(TabBarPageRouterForCheck).some((x) =>
+ router.path.toLowerCase().includes(x.toLowerCase())
+ )
);
const barStyle = computed(() => {
diff --git a/apps/taro/src/constants/tabBar.ts b/apps/taro/src/constants/tabBar.ts
index e69188c..aea4e60 100644
--- a/apps/taro/src/constants/tabBar.ts
+++ b/apps/taro/src/constants/tabBar.ts
@@ -2,7 +2,12 @@
let res = Taro.getLaunchOptionsSync();
console.log('getLaunchOptionsSync: ', res);
+export const TabBarPageRouterForCheck = {
+ Home: `/pages/home/index`,
+ Mine: `/pages/mine/index`,
+};
+
export const TabBarPageRouter = {
- Home: `/pages/home/index?channelId=${res.query?.channelId}`,
- Mine: `/pages/mine/index?channelId=${res.query?.channelId}`,
+ Home: `${TabBarPageRouterForCheck['Home']}?channelId=${res.query?.channelId}`,
+ Mine: `${TabBarPageRouterForCheck['Mine']}?channelId=${res.query?.channelId}`,
};
diff --git a/apps/taro/src/hooks/login.ts b/apps/taro/src/hooks/login.ts
index 704b417..9f1ed47 100644
--- a/apps/taro/src/hooks/login.ts
+++ b/apps/taro/src/hooks/login.ts
@@ -2,7 +2,7 @@
import { object2query } from '@life-payment/utils';
import { goBack } from '@/utils';
import { useSwitchTab } from './router';
-import { TabBarPageRouter } from '@/constants';
+import { TabBarPageRouterForCheck } from '@/constants';
import { useQueryClient } from '@tanstack/vue-query';
function getOtherQuery(query: Partial<Record<string, string>>) {
@@ -55,7 +55,7 @@
function jump() {
if (redirect) {
- const isTabBarPage = Object.values(TabBarPageRouter).includes(redirect as any);
+ const isTabBarPage = Object.values(TabBarPageRouterForCheck).includes(redirect as any);
if (isTabBarPage) {
switchTab({
url: redirectPath.value,
diff --git a/apps/taro/src/hooks/router.ts b/apps/taro/src/hooks/router.ts
index 448a183..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,13 +49,26 @@
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 (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,
diff --git a/apps/taro/src/utils/page.ts b/apps/taro/src/utils/page.ts
index 9538688..8670a6f 100644
--- a/apps/taro/src/utils/page.ts
+++ b/apps/taro/src/utils/page.ts
@@ -20,6 +20,6 @@
const systemStore = useSystemStoreWithOut();
systemStore.setTabIndex(0);
Taro.switchTab({
- url: '/pages/home/index',
+ url: TabBarPageRouter['Home'],
});
}
diff --git a/packages/components/src/styles/components.scss b/packages/components/src/styles/components.scss
index 7ce7cc9..133bb89 100644
--- a/packages/components/src/styles/components.scss
+++ b/packages/components/src/styles/components.scss
@@ -145,6 +145,7 @@
font-size: 24px;
color: boleGetCssVar('text-color', 'primary');
line-height: 32px;
+ text-align: center;
}
.recharge-result-view-btn-wrapper {
diff --git a/packages/components/src/views/Order/OrderRefundResultView.vue b/packages/components/src/views/Order/OrderRefundResultView.vue
index 1f0a25a..72b7f96 100644
--- a/packages/components/src/views/Order/OrderRefundResultView.vue
+++ b/packages/components/src/views/Order/OrderRefundResultView.vue
@@ -1,6 +1,6 @@
<template>
<LoadingLayout :loading="isLoading">
- <div class="recharge-result-view">
+ <div class="recharge-result-view" v-bind="$attrs">
<div class="recharge-result-view-title">{{ title }}</div>
<div class="recharge-result-view-subtitle">璁㈠崟鍙凤細{{ orderNo }}</div>
<div class="recharge-result-view-remark">
diff --git a/packages/utils/common.ts b/packages/utils/common.ts
index 6a863d9..5a755bc 100644
--- a/packages/utils/common.ts
+++ b/packages/utils/common.ts
@@ -16,6 +16,11 @@
);
}
+export function getRouterPath(path: string) {
+ const pathList = path.split('?');
+ return pathList[0];
+}
+
export function formatTimeWithoutCurrentYear(date: string) {
if (!date) return date;
const targetDate = dayjs(date);
--
Gitblit v1.10.0