From 5855546a7c9e95f0739d2db9400ba65499a6a513 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 22:34:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E5=86=85=E5=85=8D=E7=99=BB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 动态加载飞书 JSBridge SDK(多 CDN 备用) - 等待 tt 对象加载后尝试免登 - 超时后降级为二维码登录 Co-Authored-By: Claude Opus 4.6 --- frontend/index.html | 41 ++++++++++++++++++++++++++++++ frontend/src/pages/login/index.tsx | 17 ++++++++++--- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 2d555fe..fbd9950 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7,6 +7,47 @@ frontend + +
diff --git a/frontend/src/pages/login/index.tsx b/frontend/src/pages/login/index.tsx index 3299083..e38af2e 100644 --- a/frontend/src/pages/login/index.tsx +++ b/frontend/src/pages/login/index.tsx @@ -110,11 +110,20 @@ export default function Login() { setEnvironment('feishu') handleFeishuAutoLogin() } else if (isInFeishu) { - // 飞书内但 tt 对象不可用:自动显示二维码登录 - console.log('⚠️ 在飞书内但 tt 对象不可用,使用二维码登录') - setEnvironment('external') + // 飞书内环境,等待 tt 对象加载后尝试免登 + console.log('⏳ 在飞书内环境,等待 tt 对象加载...') + setEnvironment('feishu') setLoading(false) - setShowQRCode(true) + // 给 tt 对象一些时间来加载(最多 2 秒) + setTimeout(() => { + if (window.tt) { + console.log('✅ tt 对象已加载,开始免登') + handleFeishuAutoLogin() + } else { + console.log('⚠️ tt 对象仍未加载,显示二维码登录') + setShowQRCode(true) + } + }, 2000) } else { // 飞书外:显示登录选项 console.log('📱 飞书外环境,显示登录选项')