fix: 优化飞书内免登功能,移除外部 JSBridge SDK 加载
- tt 对象由飞书客户端自动注入,无需加载外部 SDK - 增加轮询超时时间到 10 秒 - 添加更详细的调试日志 - 超时时降级到扫码登录 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-42
@@ -5,49 +5,9 @@
|
||||
<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 -->
|
||||
<!-- 飞书扫码登录 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>
|
||||
<!-- 飞书内免登说明:tt 对象由飞书客户端自动注入,无需加载外部 SDK -->
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Reference in New Issue
Block a user