Merge remote-tracking branch 'yudao/master'

This commit is contained in:
puhui999
2026-01-28 17:37:04 +08:00
6 changed files with 27342 additions and 89 deletions

View File

@@ -15,13 +15,12 @@
<title><%= VITE_APP_TITLE %></title>
<link rel="icon" href="/favicon.ico" />
<script>
var HM_ID = '<%= VITE_APP_BAIDU_CODE %>'
var HM_ID = '<%= VITE_APP_BAIDU_CODE %>';
if (HM_ID) {
var _hmt = _hmt || [];
(function () {
var hm = document.createElement('script');
hm.src =
'https://hm.baidu.com/hm.js?' + HM_ID;
hm.src = 'https://hm.baidu.com/hm.js?' + HM_ID;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-dynamic-delete */
/**
* 百度地图 SDK 加载工具
*/
@@ -49,12 +50,12 @@ export const loadBaiduMapSdk = (timeout = 10_000): Promise<void> => {
script.src = `https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${
import.meta.env.VITE_BAIDU_MAP_KEY
}&callback=${CALLBACK_NAME}`;
script.onerror = () => {
script.addEventListener('onerror', () => {
clearTimeout(timeoutId);
loadPromise = null;
delete (window as any)[CALLBACK_NAME];
reject(new Error('百度地图 SDK 加载失败'));
};
});
document.body.append(script);
});