diff --git a/frontend/index.html b/frontend/index.html index ee4fc07..96e9f3e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7,6 +7,8 @@ 企业工具台 + +
diff --git a/frontend/src/pages/login/index.tsx b/frontend/src/pages/login/index.tsx index 499bc4e..8fad2de 100644 --- a/frontend/src/pages/login/index.tsx +++ b/frontend/src/pages/login/index.tsx @@ -9,6 +9,9 @@ import styles from './login.module.css' declare global { interface Window { tt?: any + h5sdk?: { + ready: (callback: () => void) => void + } } } @@ -73,6 +76,20 @@ export default function Login() { // 飞书内免登 const attemptFeishuAutoLogin = async (companyParam?: string) => { + // 如果 h5sdk 存在,使用 h5sdk.ready() 等待环境就绪 + if (window.h5sdk?.ready) { + window.h5sdk.ready(() => { + console.log('h5sdk ready, tt对象:', !!window.tt) + if (window.tt) { + performFeishuLogin(companyParam) + } else { + console.error('h5sdk ready 后 tt 对象仍不存在') + setLoading(false) + } + }) + return + } + // 如果 tt 对象已存在,直接使用 if (window.tt) { performFeishuLogin(companyParam)