From 037471d88000040e751f697678330ef89ef6a670 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 26 Nov 2025 14:52:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=20Mock=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E4=BB=8E=20h5-auth-url=20=E2=86=92=20h5-auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mocks/handlers/auth.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/mocks/handlers/auth.js b/src/mocks/handlers/auth.js index 9de78675..ea30f63c 100644 --- a/src/mocks/handlers/auth.js +++ b/src/mocks/handlers/auth.js @@ -326,25 +326,22 @@ export const authHandlers = [ }); }), - // 6. 获取微信 H5 授权 URL - http.post('/api/auth/wechat/h5-auth-url', async ({ request }) => { + // 6. 获取微信 H5 授权 URL(手机浏览器用) + http.post('/api/auth/wechat/h5-auth', async ({ request }) => { await delay(NETWORK_DELAY); const body = await request.json(); const { redirect_url } = body; const state = generateWechatSessionId(); - const authUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=mock&redirect_uri=${encodeURIComponent(redirect_url)}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`; + // Mock 模式下直接返回前端回调地址(模拟授权成功) + const authUrl = `${redirect_url}?wechat_login=success&state=${state}`; console.log('[Mock] 生成微信 H5 授权 URL:', authUrl); return HttpResponse.json({ - code: 0, - message: '成功', - data: { - auth_url: authUrl, - state - } + auth_url: authUrl, + state }); }),