diff --git a/frontend/index.html b/frontend/index.html index 96e9f3e..ee4fc07 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7,8 +7,6 @@ 企业工具台 - -
diff --git a/frontend/src/pages/login/index.tsx b/frontend/src/pages/login/index.tsx index 4b0433e..499bc4e 100644 --- a/frontend/src/pages/login/index.tsx +++ b/frontend/src/pages/login/index.tsx @@ -9,9 +9,6 @@ import styles from './login.module.css' declare global { interface Window { tt?: any - h5sdk?: { - ready: (callback: () => void) => void - } } } @@ -82,24 +79,6 @@ export default function Login() { return } - // 如果 h5sdk 存在,使用 h5sdk.ready() 等待 - if (window.h5sdk?.ready) { - let readyCalled = false - const timeoutId = setTimeout(() => { - if (!readyCalled) { - console.error('h5sdk.ready() 超时') - setLoading(false) - } - }, 5000) - - window.h5sdk.ready(() => { - readyCalled = true - clearTimeout(timeoutId) - performFeishuLogin(companyParam) - }) - return - } - // 轮询等待 tt 对象(最多 5 秒) let attempts = 0 const maxAttempts = 50 @@ -143,22 +122,25 @@ export default function Login() { } if (!appId) { + console.error('appId 获取失败') setLoading(false) Toast.show('飞书应用配置错误') return } - // 调用飞书免登(使用 tt.requestAccess) - window.tt.requestAccess({ - appID: appId, - scopeList: [], + console.log('开始免登,appId:', appId) + + // 调用飞书免登 + window.tt.requestAuthCode({ + appId: appId, success: (res: any) => { + console.log('免登成功,code:', res.code) handleFeishuLogin(res.code, companyParam) }, fail: (error: any) => { - console.error('requestAccess 失败:', error) + console.error('免登失败:', error) setLoading(false) - Toast.show('免登失败:' + (error.errMsg || JSON.stringify(error))) + Toast.show('免登失败:' + (error.errMsg || error.errorMessage || JSON.stringify(error))) }, }) } catch (e) {