From abfe3ffe5f6d161f2a6466c8bdbcbc17de1e64b6 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 05 十一月 2026 17:43:27 +0800
Subject: [PATCH] fix(map): v2.0 补 HOST_TYPE;诊断页延长等待并修正协议
---
src/components/map/src/utils.ts | 2 ++
public/bmap-test.html | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/public/bmap-test.html b/public/bmap-test.html
index 7d817a7..773d7b9 100644
--- a/public/bmap-test.html
+++ b/public/bmap-test.html
@@ -494,7 +494,10 @@
(function () {
var el = document.getElementById('log9');
function lg(m, c) { var d = document.createElement('div'); d.className = c || ''; d.textContent = m; el.appendChild(d); }
- lg('鍔犺浇 /bmap-sdk2d.js 骞剁洃鍚綉缁滆姹�...');
+ // v2.0 蹇呴渶锛歛pi?v=2.0 浼氳缃� window.HOST_TYPE='2'锛岀洿鎺ョ敤 getscript 鏃惰鑷繁琛ヤ笂
+ window.HOST_TYPE = '2';
+ window.BMAP_PROTOCOL = window.location.protocol.replace(':', '');
+ lg('鍔犺浇 /bmap-sdk2d.js 骞剁洃鍚綉缁滆姹�...锛�226KB锛屽甫瀹芥參鐨勮瘽瑕佺瓑 10 绉掍互涓婏級');
var s = document.createElement('script');
s.src = '/bmap-sdk2d.js';
s.addEventListener('load', function () {
@@ -527,7 +530,7 @@
if (tile.length === 0) {
lg(' 鈿� 娌℃湁浠讳綍鐡︾墖璇锋眰鍙戝嚭 鈫� SDK 鍐呴儴鐡︾墖 URL 鍙兘浠嶆寚鍚戣 IPv6 鎷︽埅鐨勫師濮嬪煙鍚�', 'bad');
}
- }, 5000);
+ }, 15000);
});
document.body.appendChild(s);
})();
diff --git a/src/components/map/src/utils.ts b/src/components/map/src/utils.ts
index 5af755a..5fbfe95 100644
--- a/src/components/map/src/utils.ts
+++ b/src/components/map/src/utils.ts
@@ -85,6 +85,8 @@
// 鐧惧害瀹樻柟瑕佹眰锛氬厛澹版槑鍗忚锛岄伩鍏� HTTPS 椤甸潰涓� SDK 鎷煎嚭 http 瀛愯祫婧愬湴鍧�
window.BMAP_PROTOCOL = window.location.protocol.replace(':', '');
+ // v2.0 蹇呴渶锛氬畼鏂� api?v=2.0 浼氳缃� HOST_TYPE='2'锛岀洿鎺ョ敤 getscript 鏃惰鑷繁琛�
+ (window as any).HOST_TYPE = '2';
window.BMapGL_loadScriptTime = Date.now();
const query = `type=webgl&v=1.0&ak=${accessKey}&services=&t=${Date.now()}`;
--
Gitblit v1.9.3