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('📱 飞书外环境,显示登录选项')