You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pingAnQiYeWeb/public/map_load.js

37 lines
1.4 KiB

console.log(window.$mapCfg);
let mapType = window.$mapCfg.mapType;
let bmapcfg = {
imgext: ".png", //瓦片图的后缀 ------ 根据需要修改,一般是 .png .jpg
tiles_dir: "roadmap", //普通瓦片图的地址,为空默认在 offlinemap/tiles/ 目录
//'tiles_path': `http://${window.location.host}`,
tiles_path: window.$mapCfg.tiles_path || "",
tiles_hybrid: window.$mapCfg.tiles_hybrid || "", //卫星瓦片图的地址,为空默认在 offlinemap/tiles_hybrid/ 目录
tiles_self: window.$mapCfg.tiles_self || "", //自定义图层的地址,为空默认在 offlinemap/tiles_self/ 目录
};
//////////////////下面的保持不动///////////////////////////////////
var scripts = document.getElementsByTagName("script");
var JS__FILE__ = scripts[scripts.length - 1].getAttribute("src"); //获得当前js文件路径
bmapcfg.home = JS__FILE__.substr(0, JS__FILE__.lastIndexOf("/") + 1); //地图API主目录
(function () {
window.BMap_loadScriptTime = new Date().getTime();
//加载地图API主文件
if (mapType === "offline") {
document.write(
'<script type="text/javascript" src="' +
bmapcfg.home +
'baiduapi.js"></script>'
);
}
if (mapType === "online") {
document.write(
'<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=CSfWwqFqSVkQaqcAAMxKyXg6Moe9UUqA"></script>'
);
}
})();
///////////////////////////////////////////////////////////////////