fix: 修复飞书内免登功能

- 动态加载飞书 JSBridge SDK(多 CDN 备用)
- 等待 tt 对象加载后尝试免登
- 超时后降级为二维码登录

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-02-27 22:34:03 +08:00
parent ba9b1f9d2b
commit 5855546a7c
2 changed files with 54 additions and 4 deletions
+41
View File
@@ -7,6 +7,47 @@
<title>frontend</title>
<!-- 飞书扫码登录 SDK -->
<script src="https://lf-package-cn.feishucdn.com/obj/feishu-static/lark/passport/qrcode/LarkSSOSDKWebQRCode-1.0.3.js"></script>
<!-- 飞书 H5 JSBridge SDK(多 CDN 备用) -->
<script>
// 尝试加载飞书 JSBridge,如果失败则尝试其他 CDN
var scripts = [
'https://lf1-cdn-tos.bytegoofy.com/goofy/lark/passport/h5-jsbridge-1.0.3.js',
'https://lf9-cn.feishucdn.com/obj/lark/passport/h5-jsbridge-1.0.3.js'
];
function loadScript(url) {
return new Promise(function(resolve, reject) {
var script = document.createElement('script');
script.src = url;
script.onload = function() { console.log('JSBridge loaded from:', url); resolve(); };
script.onerror = function() { reject(url); };
document.head.appendChild(script);
});
}
// 按顺序尝试加载 JSBridge
function loadJSBridge() {
var index = 0;
function tryNext() {
if (index < scripts.length) {
loadScript(scripts[index])
.catch(function() {
console.warn('JSBridge load failed:', scripts[index]);
index++;
tryNext();
});
} else {
console.error('All JSBridge CDNs failed');
}
}
tryNext();
}
// 页面加载后尝试加载 JSBridge
if (navigator.userAgent.includes('Lark') || navigator.userAgent.includes('feishu')) {
loadJSBridge();
}
</script>
</head>
<body>
<div id="root"></div>