From 344e8f26ee8e646f1e2052fc20b39ef84c95cf9b Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 2 Jan 2026 13:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=92=89=E9=92=89=E7=99=BB?= =?UTF-8?q?=E5=BD=95=EF=BC=9A=E4=BF=AE=E6=AD=A3=E5=93=8D=E5=BA=94=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=A0=BC=E5=BC=8F=E5=A4=84=E7=90=86=EF=BC=8Crequest?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E5=99=A8=E5=B7=B2=E8=BF=94=E5=9B=9EResult?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Login.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/Login.vue b/frontend/src/views/Login.vue index c169679..296ad44 100644 --- a/frontend/src/views/Login.vue +++ b/frontend/src/views/Login.vue @@ -392,21 +392,23 @@ const handleDingTalkLogin = async () => { dingTalkLoginLoading.value = true try { // 获取钉钉登录URL + // 注意:request 拦截器已经处理了 Result 包装,返回的就是 Result 对象 const response = await request.get>('/dingtalk/oauth/login', { params: { redirectUrl: `${window.location.origin}/auth/dingtalk/callback` } }) - if (response.data.code === 200 && response.data.data) { + // response 已经是 Result 对象,直接使用 response.data + if (response.code === 200 && response.data) { // 跳转到钉钉登录页面 - window.location.href = response.data.data.authUrl + window.location.href = response.data.authUrl } else { - message.error(response.data.message || '获取钉钉登录地址失败') + message.error(response.message || '获取钉钉登录地址失败') } } catch (error: any) { console.error('钉钉登录失败:', error) - message.error(error.response?.data?.message || '钉钉登录失败,请稍后重试') + message.error(error.response?.data?.message || error.message || '钉钉登录失败,请稍后重试') } finally { dingTalkLoginLoading.value = false }