5855546a7c
- 动态加载飞书 JSBridge SDK(多 CDN 备用) - 等待 tt 对象加载后尝试免登 - 超时后降级为二维码登录 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.9 KiB
HTML
57 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<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>
|
|
<script type="module" src="/src/main.tsx"></script>
|
|
</body>
|
|
</html>
|