From 6534723050297ed9bb05cce861e6267a06fd3c43 Mon Sep 17 00:00:00 2001 From: kk <875203880@qq.com> Date: Thu, 2 Jul 2026 19:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/dev.js | 4 ++-- src/config/prod.js | 4 ++-- src/pages/auth/loading.vue | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/config/dev.js b/src/config/dev.js index 52e4e4c..9d73c37 100644 --- a/src/config/dev.js +++ b/src/config/dev.js @@ -8,8 +8,8 @@ const dev = { // 网关地址(vms-gateway,端口 4001)— 用户授权、短信等接口走网关 apiGatewayUrl: 'https://gateway.arklinksmart.cn', - // 授权回调地址(支付宝/微信 OAuth redirect_uri) - authRedirectUri: 'https://gateway.arklinksmart.cn/api/v1/user/auth/callback', + // 授权回调地址(微信 OAuth redirect_uri,必须 HTTPS,指向前端页面) + authRedirectUri: 'https://m.arklinksmart.cn/pages/auth/loading', // 开发阶段硬编码 Token(生产环境应从登录流程获取) bearerToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRlZXB2ZW5kaW5nIiwic3ViIjoiMTY0MDI0MTEyNiIsImZyb20iOiJwb3MiLCJyb2xlIjoicG9zIiwibWFpbmJvYXJkX2lkIjoiVDEwMDIiLCJwb3Nfc24iOiIxNjQwMjQxMTI2IiwiaWF0IjoxNzc4NDkxOTA3LCJleHAiOjE3NzkwOTY3MDd9.DjscZtrTCr30XOngToUifxoel4q2EGES_uqGQernkvg', diff --git a/src/config/prod.js b/src/config/prod.js index 0ca7694..8b6223c 100644 --- a/src/config/prod.js +++ b/src/config/prod.js @@ -8,8 +8,8 @@ const prod = { // 网关地址(vms-gateway)— 用户授权、短信等接口走网关 apiGatewayUrl: 'https://gateway.arklinksmart.cn', - // 授权回调地址(支付宝/微信 OAuth redirect_uri) - authRedirectUri: 'https://gateway.arklinksmart.cn/api/v1/user/auth/callback', + // 授权回调地址(微信 OAuth redirect_uri,必须 HTTPS,指向前端页面) + authRedirectUri: 'https://m.arklinksmart.cn/pages/auth/loading', // 生产环境 Token 从登录流程获取,此处为空 bearerToken: '', diff --git a/src/pages/auth/loading.vue b/src/pages/auth/loading.vue index 9000b71..57b00c5 100644 --- a/src/pages/auth/loading.vue +++ b/src/pages/auth/loading.vue @@ -56,9 +56,9 @@ export default { try { this.statusText = '正在获取授权...'; - // 构建回调地址(当前页面地址) - const redirectUri = encodeURIComponent( - window.location.origin + window.location.pathname + // 回调地址必须是 HTTPS,使用配置文件中的地址 + const redirectUri = config.authRedirectUri || ( + window.location.origin.replace(/^http:/, 'https:') + window.location.pathname ); const res = await gatewayGet('/api/v1/user/auth/url', {