From 92264a516c8c695c38d4cc9358c50bcfbed36f06 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期三, 03 九月 2025 14:00:15 +0800 Subject: [PATCH] fix: bug --- apps/cMiniApp/src/hooks/app.ts | 13 ++++++ apps/cMiniApp/src/subpackages/mine/mineAgreementSign/InnerPage.vue | 4 + apps/cMiniApp/auto-imports.d.ts | 2 + apps/cMiniApp/src/hooks/index.ts | 1 apps/cMiniApp/src/subpackages/mine/mineAgreementSignDetail/InnerPage.vue | 15 ++++--- apps/cMiniApp/.eslintrc-auto-import.json | 3 + apps/cMiniApp/src/stores/modules/user.ts | 6 +++ apps/cMiniApp/project.private.config.json | 7 +++ packages/utils/file.ts | 12 ++++++ 9 files changed, 55 insertions(+), 8 deletions(-) diff --git a/apps/cMiniApp/.eslintrc-auto-import.json b/apps/cMiniApp/.eslintrc-auto-import.json index c2eefd1..a8acf55 100644 --- a/apps/cMiniApp/.eslintrc-auto-import.json +++ b/apps/cMiniApp/.eslintrc-auto-import.json @@ -104,6 +104,7 @@ "watchPostEffect": true, "watchSyncEffect": true, "useUpdateResume": true, - "useAccessReal": true + "useAccessReal": true, + "useLaunchOptions": true } } diff --git a/apps/cMiniApp/auto-imports.d.ts b/apps/cMiniApp/auto-imports.d.ts index 59dcbc3..6ec898a 100644 --- a/apps/cMiniApp/auto-imports.d.ts +++ b/apps/cMiniApp/auto-imports.d.ts @@ -83,6 +83,7 @@ const useGoLogin: typeof import('./src/hooks/user')['useGoLogin'] const useId: typeof import('vue')['useId'] const useIsLogin: typeof import('./src/hooks/user')['useIsLogin'] + const useLaunchOptions: typeof import('./src/hooks/app')['useLaunchOptions'] const useLink: typeof import('vue-router')['useLink'] const useLoginedJump: typeof import('./src/hooks/login')['useLoginedJump'] const useModel: typeof import('vue')['useModel'] @@ -195,6 +196,7 @@ readonly useGoLogin: UnwrapRef<typeof import('./src/hooks/user')['useGoLogin']> readonly useId: UnwrapRef<typeof import('vue')['useId']> readonly useIsLogin: UnwrapRef<typeof import('./src/hooks/user')['useIsLogin']> + readonly useLaunchOptions: UnwrapRef<typeof import('./src/hooks/app')['useLaunchOptions']> readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']> readonly useLoginedJump: UnwrapRef<typeof import('./src/hooks/login')['useLoginedJump']> readonly useModel: UnwrapRef<typeof import('vue')['useModel']> diff --git a/apps/cMiniApp/project.private.config.json b/apps/cMiniApp/project.private.config.json index 5c9b9cc..1d1579b 100644 --- a/apps/cMiniApp/project.private.config.json +++ b/apps/cMiniApp/project.private.config.json @@ -10,6 +10,13 @@ "miniprogram": { "list": [ { + "name": "subpackages/mine/mineAgreementSignDetail/mineAgreementSignDetail", + "pathName": "subpackages/mine/mineAgreementSignDetail/mineAgreementSignDetail", + "query": "scene=66688", + "launchMode": "default", + "scene": 1047 + }, + { "name": "瀹炲悕璁よ瘉", "pathName": "subpackages/authentication/authenticationRealName/authenticationRealName", "query": "type=realName", diff --git a/apps/cMiniApp/src/hooks/app.ts b/apps/cMiniApp/src/hooks/app.ts new file mode 100644 index 0000000..dfe8750 --- /dev/null +++ b/apps/cMiniApp/src/hooks/app.ts @@ -0,0 +1,13 @@ +import Taro from '@tarojs/taro'; +import { useUserStoreWithOut } from '@/stores/modules/user'; + +export function useLaunchOptions() { + const options = Taro.getLaunchOptionsSync(); + const userStore = useUserStoreWithOut(); + console.log('userStore: ', userStore); + if (userStore.firstLaunch) { + userStore.setFirstLaunch(false); + return options; + } + return {} as Taro.getLaunchOptionsSync.LaunchOptions; +} diff --git a/apps/cMiniApp/src/hooks/index.ts b/apps/cMiniApp/src/hooks/index.ts index 04721e7..7c11112 100644 --- a/apps/cMiniApp/src/hooks/index.ts +++ b/apps/cMiniApp/src/hooks/index.ts @@ -3,3 +3,4 @@ export * from './access'; export * from './login'; export * from './authentication'; +export * from './app'; diff --git a/apps/cMiniApp/src/stores/modules/user.ts b/apps/cMiniApp/src/stores/modules/user.ts index f2c2654..cf8e0bf 100644 --- a/apps/cMiniApp/src/stores/modules/user.ts +++ b/apps/cMiniApp/src/stores/modules/user.ts @@ -33,6 +33,7 @@ refreshToken?: Nullable<string>; userDetail?: Nullable<API.GetPersonalLoginInfoQueryResult>; firstGetUserDetail?: boolean; + firstLaunch?: boolean; locationCity?: string; locationProvince?: string; @@ -71,6 +72,7 @@ refreshToken: userInfo?.refreshToken ?? '', userDetail: userDetail, firstGetUserDetail: true, + firstLaunch: true, locationCity: storageLocation?.city ?? '鍖椾含甯�', locationProvince: storageLocation?.province ?? '鍖椾含', firstSetLocation: true, @@ -277,6 +279,10 @@ // } LocationUtils.currentProvinceName = provinceName; }, + + setFirstLaunch(firstLaunch: boolean) { + this.firstLaunch = firstLaunch; + }, }, }); diff --git a/apps/cMiniApp/src/subpackages/mine/mineAgreementSign/InnerPage.vue b/apps/cMiniApp/src/subpackages/mine/mineAgreementSign/InnerPage.vue index 0153c1f..498c579 100644 --- a/apps/cMiniApp/src/subpackages/mine/mineAgreementSign/InnerPage.vue +++ b/apps/cMiniApp/src/subpackages/mine/mineAgreementSign/InnerPage.vue @@ -55,7 +55,9 @@ page: pageParam, orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }], }, - userSignContractStatus: queryState.userSignContractStatus, + userSignContractStatus: Number(queryState.userSignContractStatus) + ? queryState.userSignContractStatus + : null, }; return enterpriseEmployeeServices.getPersonalUserElectronSigns(params, { diff --git a/apps/cMiniApp/src/subpackages/mine/mineAgreementSignDetail/InnerPage.vue b/apps/cMiniApp/src/subpackages/mine/mineAgreementSignDetail/InnerPage.vue index 37ff142..6b779fe 100644 --- a/apps/cMiniApp/src/subpackages/mine/mineAgreementSignDetail/InnerPage.vue +++ b/apps/cMiniApp/src/subpackages/mine/mineAgreementSignDetail/InnerPage.vue @@ -77,7 +77,7 @@ EnumTaskUserSignContractStatus, EnumTaskUserSignContractStatusSignText, } from '@12333/constants'; -import { format, hiddenPhone, Message, setOSSLink } from '@12333/utils'; +import { format, hiddenPhone, Message, setOSSLink, openDocument } from '@12333/utils'; import Taro from '@tarojs/taro'; defineOptions({ @@ -86,8 +86,10 @@ const { userDetail } = useUser(); const router = Taro.useRouter(); +const launchOption = useLaunchOptions(); +//鐏靛伐Id const id = router.params?.id; -const code = router.params?.code; +const code = launchOption?.query?.scene || router.params?.code; const { isLoading, @@ -118,10 +120,11 @@ detail?.value?.userSignContractStatus === EnumTaskUserSignContractStatus.Stop || detail?.value?.userSignContractStatus === EnumTaskUserSignContractStatus.Pass ) { - const encodedUrl = encodeURIComponent(setOSSLink(detail?.value?.contractUrl)); - Taro.navigateTo({ - url: `${RouterPath.mineAgreementSignExtraPage}?url=${encodedUrl}`, - }); + if (!detail?.value?.contractUrl) { + Message.warning('鍗忚鏃犳硶鏌ョ湅锛岃绋嶅悗鍐嶈瘯'); + return; + } + openDocument(setOSSLink(detail?.value?.contractUrl)); } } diff --git a/packages/utils/file.ts b/packages/utils/file.ts index bb74f4c..a88fe99 100644 --- a/packages/utils/file.ts +++ b/packages/utils/file.ts @@ -86,3 +86,15 @@ return fileName; }); } + +export function openDocument(url: string) { + Taro.downloadFile({ + url: url, + success: function (res) { + var filePath = res.tempFilePath; + Taro.openDocument({ + filePath: filePath, + }); + }, + }); +} -- Gitblit v1.9.1