From e59c69c9caaca21079a071a2a2ddb5b48bb907fc Mon Sep 17 00:00:00 2001 From: yuanshan <42023847+piercezzs@users.noreply.github.com> Date: Mon, 2 Feb 2026 15:14:24 +0800 Subject: [PATCH] feat: update routing to use localePath for navigation across various components and pages --- README.md | 2 +- composables/useAuth.js | 25 +++++++----- .../customFooter/size1440/index.vue | 10 +---- .../customFooter/size1920/index.vue | 18 ++++----- src/components/customFooter/size375/index.vue | 10 +---- src/components/customFooter/size768/index.vue | 10 +---- .../customHeader/size1440/index.vue | 2 +- src/utils/changeLanguage.js | 6 +-- .../secfilings/size1440/index.vue | 15 ++++--- .../secfilings/size1920/index.vue | 15 ++++--- .../secfilings/size375/index.vue | 15 ++++--- .../secfilings/size768/index.vue | 15 ++++--- .../footerLinks/siteMap/size1440/index.vue | 31 ++++++++------- .../footerLinks/siteMap/size1920/index.vue | 31 ++++++++------- .../footerLinks/siteMap/size375/index.vue | 31 ++++++++------- .../footerLinks/siteMap/size768/index.vue | 31 ++++++++------- src/views/myHome/size1440/index.vue | 15 ++++--- src/views/myHome/size1920/index.vue | 15 ++++--- src/views/myHome/size375/index.vue | 15 ++++--- src/views/myHome/size768/index.vue | 15 ++++--- src/views/press-releases/size1440/index.vue | 15 ++++--- src/views/press-releases/size1920/index.vue | 15 ++++--- src/views/press-releases/size375/index.vue | 39 +++++++++++++------ src/views/press-releases/size768/index.vue | 15 ++++--- 24 files changed, 224 insertions(+), 187 deletions(-) diff --git a/README.md b/README.md index bc9d384..aff6cd4 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ node .output/server/index.mjs 服务器运行 ## 必应搜索 - + ## 📝 License diff --git a/composables/useAuth.js b/composables/useAuth.js index c3c6112..8b0372e 100644 --- a/composables/useAuth.js +++ b/composables/useAuth.js @@ -14,6 +14,7 @@ import { showToast } from "vant"; export const useAuth = createGlobalState(() => { const router = useRouter(); + const localePath = useLocalePath(); // Use Nuxt useCookie for SSR compatibility const token = useCookie("token", { default: () => "" }); @@ -52,10 +53,12 @@ export const useAuth = createGlobalState(() => { const res = await voteAPI({ workUid: workUid.value }); if (res.status === 0) { showToast("投票成功"); - router.push({ - path: "/result", - query: { type: "hasVoted" }, - }); + router.push( + localePath({ + path: "/result", + query: { type: "hasVoted" }, + }) + ); } }; @@ -145,10 +148,12 @@ export const useAuth = createGlobalState(() => { const res = await competitionApply(formData.value); if (res.status === 0) { showToast("报名成功"); - router.push({ - path: "/result", - query: { type: "success" }, - }); + router.push( + localePath({ + path: "/result", + query: { type: "success" }, + }) + ); } }; @@ -163,10 +168,10 @@ export const useAuth = createGlobalState(() => { if (res.data.status === 1) { showToast("您已经报名"); await getDetail(); - router.push("/details"); + router.push(localePath("/details")); } else { showToast("登录成功"); - router.push("/signup"); + router.push(localePath("/signup")); } } }; diff --git a/src/components/customFooter/size1440/index.vue b/src/components/customFooter/size1440/index.vue index 19b6d16..b0f4d58 100644 --- a/src/components/customFooter/size1440/index.vue +++ b/src/components/customFooter/size1440/index.vue @@ -15,17 +15,11 @@ diff --git a/src/components/customFooter/size1920/index.vue b/src/components/customFooter/size1920/index.vue index 476d859..9455c07 100644 --- a/src/components/customFooter/size1920/index.vue +++ b/src/components/customFooter/size1920/index.vue @@ -3,8 +3,12 @@