From ae2d769eedcb56bf3220f0f82a23d1c9702efb92 Mon Sep 17 00:00:00 2001 From: bootx Date: Thu, 9 Jul 2026 19:06:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(h5):=20=E6=96=B0=E5=A2=9E=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E8=AE=A4=E8=AF=81=E8=90=BD=E5=9C=B0=E9=A1=B5(?= =?UTF-8?q?=E8=B7=A8=E7=AB=AF,=E6=94=AF=E6=8C=81=20PC=20=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E8=AE=BF=E9=97=AE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mobile/router/modules.ts | 9 + src/mobile/views/auth/wechat/index.vue | 293 +++++++++++++++++++ src/pc/router/index.ts | 7 + src/pc/views/auth/wechat/Index.vue | 384 +++++++++++++++++++++++++ src/shared/locales/en-US/auth.json | 13 + src/shared/locales/zh-CN/auth.json | 13 + src/shared/router/paths.ts | 2 + 7 files changed, 721 insertions(+) create mode 100644 src/mobile/views/auth/wechat/index.vue create mode 100644 src/pc/views/auth/wechat/Index.vue diff --git a/src/mobile/router/modules.ts b/src/mobile/router/modules.ts index 86301fe..d57461d 100644 --- a/src/mobile/router/modules.ts +++ b/src/mobile/router/modules.ts @@ -84,6 +84,15 @@ const routeModuleList: Array = [ title: '支付宝认证', }, }, + // 微信认证落地页(跨端:与 PC 端同 path 各指各 view,微信公众号 OAuth 重定向回调取 code) + { + path: RoutePath.AUTH_WECHAT, + name: 'WechatAuth', + component: () => import('@/mobile/views/auth/wechat/index.vue'), + meta: { + title: '微信认证', + }, + }, ] export default routeModuleList diff --git a/src/mobile/views/auth/wechat/index.vue b/src/mobile/views/auth/wechat/index.vue new file mode 100644 index 0000000..4e1cca3 --- /dev/null +++ b/src/mobile/views/auth/wechat/index.vue @@ -0,0 +1,293 @@ + + + + + diff --git a/src/pc/router/index.ts b/src/pc/router/index.ts index 9c824e0..cc88c47 100644 --- a/src/pc/router/index.ts +++ b/src/pc/router/index.ts @@ -40,6 +40,13 @@ const routes: RouteRecordRaw[] = [ component: () => import('@/pc/views/protocol/Index.vue'), meta: { title: '协议' }, }, + // 微信认证落地页(跨端:与移动端同 path 各指各 view,PC 微信内置浏览器可访问) + { + path: RoutePath.AUTH_WECHAT, + name: 'PcWechatAuth', + component: () => import('@/pc/views/auth/wechat/Index.vue'), + meta: { title: '微信认证' }, + }, ...mobileOnlyStubs, // 兜底:移动端专属路径(如 /home/index)或任何未匹配路径,渲染 PC 404 页 // 用 component 而非 redirect——vue-router 5 下 catch-all + redirect 在初始导航不触发 diff --git a/src/pc/views/auth/wechat/Index.vue b/src/pc/views/auth/wechat/Index.vue new file mode 100644 index 0000000..d838501 --- /dev/null +++ b/src/pc/views/auth/wechat/Index.vue @@ -0,0 +1,384 @@ + + + + + diff --git a/src/shared/locales/en-US/auth.json b/src/shared/locales/en-US/auth.json index f7d3ffd..430ef9c 100644 --- a/src/shared/locales/en-US/auth.json +++ b/src/shared/locales/en-US/auth.json @@ -13,5 +13,18 @@ "paramMissing": "Missing auth parameters", "authCodeFail": "Failed to get auth code", "authFail": "Failed to get user id" + }, + "wechat": { + "loading": "Fetching authorization...", + "secureTip": "WeChat secure auth", + "successTitle": "Success", + "failTitle": "Failed", + "openId": "WeChat OpenId", + "copy": "Copy", + "close": "Close", + "copySuccess": "Copied", + "copyFail": "Copy failed", + "codeMissing": "No auth code received, please retry", + "authFail": "Failed to get user id" } } diff --git a/src/shared/locales/zh-CN/auth.json b/src/shared/locales/zh-CN/auth.json index ad0207f..a310153 100644 --- a/src/shared/locales/zh-CN/auth.json +++ b/src/shared/locales/zh-CN/auth.json @@ -13,5 +13,18 @@ "paramMissing": "授权参数缺失", "authCodeFail": "获取授权码失败", "authFail": "获取用户标识失败" + }, + "wechat": { + "loading": "正在获取授权信息...", + "secureTip": "微信安全认证", + "successTitle": "获取成功", + "failTitle": "获取失败", + "openId": "微信OpenId", + "copy": "复制信息", + "close": "关闭页面", + "copySuccess": "复制成功", + "copyFail": "复制失败", + "codeMissing": "未获取到授权码,请重新发起认证", + "authFail": "获取用户标识失败" } } diff --git a/src/shared/router/paths.ts b/src/shared/router/paths.ts index c6da301..17824e2 100644 --- a/src/shared/router/paths.ts +++ b/src/shared/router/paths.ts @@ -25,4 +25,6 @@ export const RoutePath = { PROTOCOL: '/protocol/:protocolType', /** 支付宝认证落地页(移动独占:JSAPI 取码) */ AUTH_ALIPAY: '/auth/alipay/:aliAppId/:queryCode', + /** 微信认证落地页(跨端:公众号 OAuth 重定向回调,PC 微信内置浏览器也可访问) */ + AUTH_WECHAT: '/auth/wechat/:authToken', } as const