| | |
| | | "useTemplateRef": true, |
| | | "DirectiveBinding": true, |
| | | "MaybeRef": true, |
| | | "MaybeRefOrGetter": true |
| | | "MaybeRefOrGetter": true, |
| | | "RouteHelper": true |
| | | } |
| | | } |
| | |
| | | export {} |
| | | declare global { |
| | | const EffectScope: typeof import('vue')['EffectScope'] |
| | | const RouteHelper: typeof import('@/utils')['RouteHelper'] |
| | | const RouterPath: typeof import('@/constants')['RouterPath'] |
| | | const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] |
| | | const computed: typeof import('vue')['computed'] |
| | |
| | | |
| | | chain.plugin('unplugin-auto-import').use( |
| | | AutoImport({ |
| | | imports: ['vue', 'pinia', 'vue-router', { '@/constants': ['RouterPath'] }], |
| | | imports: [ |
| | | 'vue', |
| | | 'pinia', |
| | | 'vue-router', |
| | | { '@/constants': ['RouterPath'] }, |
| | | { '@/utils': ['RouteHelper'] }, |
| | | ], |
| | | eslintrc: { |
| | | enabled: true, // Default `false` |
| | | filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json` |
| | |
| | | webpackChain(chain, webpack) { |
| | | chain.plugin('unplugin-auto-import').use( |
| | | AutoImport({ |
| | | imports: ['vue', 'pinia', 'vue-router', { '@/constants': ['RouterPath'] }], |
| | | imports: [ |
| | | 'vue', |
| | | 'pinia', |
| | | 'vue-router', |
| | | { '@/constants': ['RouterPath'] }, |
| | | { '@/utils': ['RouteHelper'] }, |
| | | ], |
| | | eslintrc: { |
| | | enabled: true, // Default `false` |
| | | filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json` |
| | |
| | | }); |
| | | |
| | | function goPolicy() { |
| | | Taro.navigateTo({ |
| | | RouteHelper.navigateTo({ |
| | | url: RouterPath.userPolicy, |
| | | }); |
| | | } |
| | |
| | | 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 router = Taro.useRouter(); |
| | | |
| | | const channelId = router.params?.channelId ?? ''; |
| | | console.log('router.params: ', router); |
| | | console.log('router: params', router, blLifeRecharge.accountModel.channlesNum); |
| | | |
| | | Taro.useDidShow(() => { |
| | | console.log('latestRoute.value: ', latestRoute.value); |
| | | 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(''); |
| | | // }, |
| | | // }); |
| | | // } |
| | | const currentIsTabbarPage = Object.values(TabBarPageRouterForCheck).some((x) => |
| | | getRouterPath(router.path).toLowerCase().includes(x.toLowerCase()) |
| | | ); |
| | | console.log('currentIsTabbarPage: ', currentIsTabbarPage); |
| | | 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, |
| | |
| | | } |
| | | |
| | | function goPage(routeName: string) { |
| | | Taro.navigateTo({ |
| | | RouteHelper.navigateTo({ |
| | | url: routeName, |
| | | }); |
| | | } |
| | |
| | | const orderType = ref('1'); |
| | | |
| | | function goApplyRefund(id: string) { |
| | | Taro.navigateTo({ |
| | | RouteHelper.navigateTo({ |
| | | url: `${RouterPath.orderApplyRefund}?id=${id}`, |
| | | // events: { |
| | | // submitApplyRefund: function () {}, |
| | |
| | | }); |
| | | } |
| | | function goRefundDetail(orderNo: string) { |
| | | Taro.navigateTo({ |
| | | RouteHelper.navigateTo({ |
| | | url: `${RouterPath.orderRefundResult}?orderNo=${orderNo}`, |
| | | }); |
| | | } |
| | |
| | | import { TabBarPageRouter } from '@/constants'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { useSystemStoreWithOut } from '@/stores/modules/system'; |
| | | import { query2object, object2query } from '@life-payment/utils'; |
| | | import { blLifeRecharge } from './blLifeRecharge'; |
| | | |
| | | export function goBack(delta = 1) { |
| | | const pages = Taro.getCurrentPages(); |
| | |
| | | url: TabBarPageRouter['Home'], |
| | | }); |
| | | } |
| | | |
| | | export function pathAddExtraParam(path: string, object: Record<string, string | number>) { |
| | | console.log('path: ', path, object); |
| | | const pathList = path.split('?'); |
| | | if (pathList.length > 1) { |
| | | const query = query2object(pathList[1]); |
| | | for (const key in object) { |
| | | query[key] = object[key] as any; |
| | | } |
| | | return `${pathList[0]}?${object2query(query)}`; |
| | | } else { |
| | | return `${pathList[0]}?${object2query(object)}`; |
| | | } |
| | | } |
| | | |
| | | export class RouteHelper { |
| | | static switchTab(option: Taro.switchTab.Option) { |
| | | return Taro.switchTab({ |
| | | ...option, |
| | | url: pathAddExtraParam(option.url, { channelId: blLifeRecharge.accountModel.channlesNum }), |
| | | }); |
| | | } |
| | | |
| | | static navigateTo(option: Taro.navigateTo.Option) { |
| | | Taro.navigateTo({ |
| | | ...option, |
| | | url: pathAddExtraParam(option.url, { channelId: blLifeRecharge.accountModel.channlesNum }), |
| | | }); |
| | | } |
| | | } |