From 525f94cb804127f5086bda7af86cbcde97f5ef7a Mon Sep 17 00:00:00 2001 From: kk <875203880@qq.com> Date: Thu, 2 Jul 2026 18:25:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=88=E6=9D=83/=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/GwKDMM6vRz.txt | 1 + public/MP_verify_sfIpUAfcT78BnMBv.txt | 1 + src/App.vue | 79 +++++----- src/pages.json | 12 +- src/pages/auth/loading.vue | 193 +++++++++++++++++++++++++ src/pages/index/scan.vue | 12 +- src/pages/register/register.vue | 111 ++++++++++---- src/utils/auth-guard.js | 201 +++----------------------- src/utils/request.js | 10 +- 9 files changed, 356 insertions(+), 264 deletions(-) create mode 100644 public/GwKDMM6vRz.txt create mode 100644 public/MP_verify_sfIpUAfcT78BnMBv.txt create mode 100644 src/pages/auth/loading.vue diff --git a/public/GwKDMM6vRz.txt b/public/GwKDMM6vRz.txt new file mode 100644 index 0000000..4eb0182 --- /dev/null +++ b/public/GwKDMM6vRz.txt @@ -0,0 +1 @@ +70011ed2d63c3cfa7094f5cb2a9aafea \ No newline at end of file diff --git a/public/MP_verify_sfIpUAfcT78BnMBv.txt b/public/MP_verify_sfIpUAfcT78BnMBv.txt new file mode 100644 index 0000000..ee9eb0f --- /dev/null +++ b/public/MP_verify_sfIpUAfcT78BnMBv.txt @@ -0,0 +1 @@ +sfIpUAfcT78BnMBv \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index ac4eab5..af3ba29 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,5 @@ diff --git a/src/pages.json b/src/pages.json index 0027213..5f6c315 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1,13 +1,19 @@ { "pages": [ { - "path": "pages/register/register", + "path": "pages/index/scan", "style": { "navigationStyle": "custom" } }, { - "path": "pages/index/scan", + "path": "pages/auth/loading", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/register/register", "style": { "navigationStyle": "custom" } @@ -43,4 +49,4 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" } -} \ No newline at end of file +} diff --git a/src/pages/auth/loading.vue b/src/pages/auth/loading.vue new file mode 100644 index 0000000..9000b71 --- /dev/null +++ b/src/pages/auth/loading.vue @@ -0,0 +1,193 @@ + + + + + diff --git a/src/pages/index/scan.vue b/src/pages/index/scan.vue index d8f7e3f..30dc544 100644 --- a/src/pages/index/scan.vue +++ b/src/pages/index/scan.vue @@ -67,7 +67,15 @@ export default { }; }, onLoad(options) { - // 1. query 参数中携带设备编号 + // 1. 检查 JWT(App.vue 已处理首次跳转,这里兜底) + const token = uni.getStorageSync('token'); + if (!token) { + // 无 JWT → 跳转授权 Loading 页 + uni.redirectTo({ url: '/pages/auth/loading' }); + return; + } + + // 2. 有 JWT + query 参数中携带设备编号 if (options.device_id) { uni.redirectTo({ url: '/pages/index/index?device_id=' + options.device_id, @@ -76,7 +84,7 @@ export default { } // #ifdef H5 - // 2. URL 路径中携带设备编号(如 http://xxx/A1036) + // 3. URL 路径中携带设备编号(如 http://xxx/A1036) const path = window.location.pathname; const segments = path.split('/').filter(Boolean); if (segments.length > 0) { diff --git a/src/pages/register/register.vue b/src/pages/register/register.vue index f74e765..1555e90 100644 --- a/src/pages/register/register.vue +++ b/src/pages/register/register.vue @@ -6,6 +6,12 @@ 请输入手机号获取验证码完成注册 + + + + {{ authInfo.nickname }} + + @@ -62,8 +68,7 @@