master
loveflow 1 year ago
parent c8deafe9b2
commit d6cbeefb1c

@ -1740,7 +1740,7 @@ window.BMAP_AUTHENTIC_KEY = "iSZit9hpxlgGq28nmIyFk8lQQ21widby";
B.url = B.N0[B.xz]; B.url = B.N0[B.xz];
B.Rp = B.url.proto + B.url.domain.baidumap + "/"; B.Rp = B.url.proto + B.url.domain.baidumap + "/";
B.jc = B.url.proto + ("2" == B.xz ? B.url.domain.main_domain_nocdn.other : B.url.domain.main_domain_nocdn.baidu) + "/"; B.jc = B.url.proto + ("2" == B.xz ? B.url.domain.main_domain_nocdn.other : B.url.domain.main_domain_nocdn.baidu) + "/";
B.la = bmapcfg.home B.la = bmapcfg&&bmapcfg.home
// B.la = B.url.proto + ("2" == B.xz ? B.url.domain.main_domain_cdn.other[0] : B.url.domain.main_domain_nocdn.baidu) + "/"; // B.la = B.url.proto + ("2" == B.xz ? B.url.domain.main_domain_cdn.other[0] : B.url.domain.main_domain_nocdn.baidu) + "/";
B.gj = B.url.proto + B.url.domain.main_domain_cdn.webmap[0] + "/"; B.gj = B.url.proto + B.url.domain.main_domain_cdn.webmap[0] + "/";
B.ZN = B.url.proto + B.url.domain.panoVerify + "/"; B.ZN = B.url.proto + B.url.domain.panoVerify + "/";

@ -4,13 +4,17 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" /> <meta name="viewport" content="width=device-width,initial-scale=1.0" />
<script src="./static/config.js"></script>
<script>
document.title = window.$SYSTEMCONFIG.SYS_NAME || "镇海平安企业(园区)";
</script>
<script src="<%= BASE_URL %>baiduapi.js"></script> <script src="<%= BASE_URL %>baiduapi.js"></script>
<script src="<%= BASE_URL %>TextIconOverlay_min.js"></script> <script src="<%= BASE_URL %>TextIconOverlay_min.js"></script>
<script src="<%= BASE_URL %>MarkerClusterer_min.js"></script> <script src="<%= BASE_URL %>MarkerClusterer_min.js"></script>
<script src="<%= BASE_URL %>map_load.js"></script> <script src="<%= BASE_URL %>map_load.js"></script>
<script src="<%= BASE_URL %>liveplayer-lib.min.js"></script> <script src="<%= BASE_URL %>liveplayer-lib.min.js"></script>
<!-- <title>镇海平安企业(园区)</title> --> <!-- <title></title> -->
<title>vue</title> <title></title>
</head> </head>
<style> <style>
body { body {
@ -24,9 +28,5 @@
</noscript> --> </noscript> -->
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
<script src="./static/config.js"></script>
<script>
console.log(window.mapCfg);
</script>
</body> </body>
</html> </html>

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

@ -1,8 +1,13 @@
window.mapCfg = { window.$mapCfg = {
type: "onLine",//离线地图;地图类型 onLine:在线地图
lgt: "", //经度 lgt: "", //经度
lat: "", //纬度 lat: "", //纬度
center: [], center: [121.619992, 30.025703],
zoom: 12, zoom: 12,
tiles_dir: "" + "/static/newTiles/{z}/{x}/{y}.png", //瓦片地址 tiles_path: "http://172.18.113.50:8118",
tiles_hybrid: "", //卫星瓦片图的地址,为空默认在 offlinemap/tiles_hybrid/ 目录
tiles_self: "", //自定义图层的地址,为空默认在 offlinemap/tiles_self/ 目录
};
window.$SYSTEMCONFIG = {
SYS_NAME: "镇海平安企业(园区)", //系统名称
}; };

@ -17,29 +17,12 @@
} }
</style> </style>
<!-- <script src="https://unpkg.com/mapv-three@1.0.10/dist/mapvthree.umd.js"></script> --> <!-- <script src="https://unpkg.com/mapv-three@1.0.10/dist/mapvthree.umd.js"></script> -->
<!-- <script <script src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=CSfWwqFqSVkQaqcAAMxKyXg6Moe9UUqA"></script>
src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=CSfWwqFqSVkQaqcAAMxKyXg6Moe9UUqA"
></script> -->
</head> </head>
<body> <body>
<div id="container"></div> <div id="container"></div>
<script> <script>
let mapCfg = window.parent.mapCfg;
if (mapCfg.type === "offLine") {
}
if (mapCfg.type === "onLine") {
loadScript();
}
// map.setHeading(64.5);
// map.setTilt(73);
// 禁止地图旋转和倾斜可以通过配置项进行设置
// var map = new BMapGL.Map("allmap", {
// enableRotate: false,
// enableTilt: false
// });
function initMap() {
// 创建地图实例 // 创建地图实例
var map = new BMapGL.Map("container"); // 创建地图实例 var map = new BMapGL.Map("container"); // 创建地图实例
var point = new BMapGL.Point(121.619992, 30.025703); // 创建点坐标 var point = new BMapGL.Point(121.619992, 30.025703); // 创建点坐标
@ -150,15 +133,6 @@
map.centerAndZoom(point, 14); // 初始化地图,设置中心点坐标和地图级别 map.centerAndZoom(point, 14); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(); map.enableScrollWheelZoom();
map.setMapType(BMAP_SATELLITE_MAP); // 卫星地图模式 map.setMapType(BMAP_SATELLITE_MAP); // 卫星地图模式
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src =
"//api.map.baidu.com/api?type=webgl&v=1.0&ak=CSfWwqFqSVkQaqcAAMxKyXg6Moe9UUqA&callback=initMap";
document.body.appendChild(script);
}
</script> </script>
</body> </body>
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -0,0 +1,135 @@
<template>
<div class="map" id="container"></div>
</template>
<script>
import { topRanking } from "@/api/safetyIndex";
//import styleJson from "../../../../public/custom_map_config.json";
//import MapPoint from "../../../../public/zhenhaiPoint.json";
//import MapLine from "../../../../public/zhenhaiLine.json";
export default {
name: "mapWrap",
data() {
return {
center_point: window.$mapCfg.center,
};
},
mounted() {
this.get_rank();
},
methods: {
async get_rank() {
let params = {
scoreType: "month",
};
let res = await topRanking(params);
this.initMap(res.data);
},
initMap(data) {
//
let BMapGL = window.BMap;
let map = new BMapGL.Map("container"); //
let company_list = data;
console.log("data01", company_list);
company_list.forEach((item) => {
let company_point = new BMapGL.Point(item.longitude, item.latitude);
//
let myIcon = new BMapGL.Icon(
require("@/assets/images/map/top0" + item.areaRank + ".png"),
new BMapGL.Size(40, 60),
{
imageOffset: new BMapGL.Size(0, 0, 5),
}
);
myIcon.setImageSize(new BMapGL.Size(40, 60)); //
let marker = new BMapGL.Marker(company_point, {
icon: myIcon,
}); //
marker.disableMassClear();
map.addOverlay(marker);
//
let content = item.companyName;
let label = new BMapGL.Label(content, {
position: company_point, //
offset: new BMapGL.Size(-20, -50), //
});
label.setStyle({
backgroundColor: "#f9d2e4",
border: "0",
color: "#01847f",
fontSize: "16px",
cursor: "pointer",
});
label.disableMassClear();
map.addOverlay(label);
//
label.addEventListener("click", function () {
map.clearOverlays(); //
// clearOverlaysdisableMassClear
var point_text = new BMapGL.Label(); //
point_text.setStyle({
color: "blue",
borderRadius: "5px",
borderColor: "#ccc",
padding: "10px",
fontSize: "16px",
fontFamily: "微软雅黑",
backgroundColor: "#b5ebff",
transform: "translateX(-50%) translateY(calc(-100% - 10px))",
});
//
point_text.setPosition(
new BMapGL.Point(item.longitude, item.latitude)
);
point_text.setOffset(new BMapGL.Size(130, -10));
point_text.setStyle({
width: "340px",
height: "238px",
background: "url(../pbImg/dialogback.png) no-repeat",
backgroundSize: "100% 100%",
border: "0",
color: "#fff",
zIndex: 2000000000,
});
point_text.setContent(`
<div style='width:100%;display:flex;justify-content: space-between;align-items: center;'>
<h4 style='margin:12px;font-size: 14px;color: #FFE6D9;overflow: hidden;text-overflow: ellipsis;white-space: nowrap; cursor: pointer;'>${item.companyName}</h4>
<div class='closeBtn' style='background: url(../pbImg/close.png) no-repeat;width:20px;height:20px;background-size: 100% 100%;margin-right:10px; cursor: pointer;"'></div></div>
<div style='margin:0 auto;font-size: 14px;width:316px;height:108px;padding:0 12px;background: rgba(108,128,151,0.20);border: 1px solid rgba(73,84,97,1);'>
<h4 style='height:33%;opacity: 0.8;margin:0;line-height:38px;font-weight:300;'><span style="color:#D0DEEE;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">单位地址</span>${item.companyAddress}</h4>
<div title="${item.levelIndexThree}" style='height:33%;opacity: 0.8;margin:0;line-height:38px;font-weight:300;overflow:hidden; text-overflow: ellipsis;white-space: nowrap'><span style="color:#D0DEEE;">安全负责人</span>${item.emergencyContact}</div>
<h4 style='height:33%;opacity: 0.8;margin:0;line-height:38px;font-weight:300;'><span style="color:#D0DEEE;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">综合得分</span>${item.score}</h4>
`);
map.addOverlay(point_text);
let closebtn = document.querySelector(".closeBtn");
closebtn.addEventListener("click", () => {
map.removeOverlay(point_text);
});
});
});
map.centerAndZoom(
new BMapGL.Point(this.center_point[0], this.center_point[1]),
14
); //
map.setMinZoom(12); //
map.setMaxZoom(19);
map.enableScrollWheelZoom(true);
},
},
};
</script>
<style lang="less" scoped>
/* 去除百度地图logo */
.anchorBL {
display: none;
}
.map {
width: 100vw;
height: 91vh;
}
</style>

@ -4,7 +4,7 @@
<!-- 最底层地图框 --> <!-- 最底层地图框 -->
<div class="map_box"> <div class="map_box">
<!-- 嵌入在线地图 --> <!-- 嵌入在线地图 -->
<iframe <!-- <iframe
name="zhenhaimap" name="zhenhaimap"
id="iframeMap" id="iframeMap"
class="iframeMap" class="iframeMap"
@ -14,7 +14,10 @@
frameborder="0" frameborder="0"
scrolling="no" scrolling="no"
ref="iframeDom" ref="iframeDom"
></iframe> ></iframe> -->
<div class="map_body">
<mapWrap ref="mapWrap"></mapWrap>
</div>
<!-- <div class="map_body"> <!-- <div class="map_body">
<HomeMap ref="homeMap"></HomeMap> <HomeMap ref="homeMap"></HomeMap>
</div> --> </div> -->
@ -65,7 +68,8 @@ import Notification from "./components/notification";
import Endanger from "./components/endanger"; import Endanger from "./components/endanger";
// import HomeMap from "./components/homeMap"; // import HomeMap from "./components/homeMap";
// import LineMap from "./components/lineMap" // import LineMap from "./components/lineMap"
import { topRanking } from '@/api/safetyIndex' import mapWrap from "./components/mapWrap";
import { topRanking } from "@/api/safetyIndex";
export default { export default {
name: "CompositeIndex", name: "CompositeIndex",
components: { components: {
@ -75,12 +79,13 @@ export default {
CompanyService, CompanyService,
Notification, Notification,
Endanger, Endanger,
mapWrap,
// HomeMap, // HomeMap,
// LineMap // LineMap
}, },
data() { data() {
return { return {
getPageUrl:'static/map.html', // 线 getPageUrl: "static/map.html", // 线
options: [ options: [
{ {
value: "1", value: "1",
@ -92,10 +97,11 @@ export default {
}, },
], ],
select_value: "地图", select_value: "地图",
mapData: [],
}; };
}, },
mounted() { mounted() {
this.get_rank() //this.get_rank();
}, },
methods: { methods: {
change_map(val) { change_map(val) {
@ -109,13 +115,12 @@ export default {
// //
async get_rank() { async get_rank() {
let params = { let params = {
scoreType: 'month' scoreType: "month",
} };
let res = await topRanking(params) let res = await topRanking(params);
//console.log('restop',res); //console.log('restop',res);
let iframe_window = this.$refs.iframeDom.contentWindow let iframe_window = this.$refs.iframeDom.contentWindow;
let data = res.data iframe_window.postMessage(res.data, "*");
iframe_window.postMessage(data,'*')
}, },
}, },
}; };

@ -37,10 +37,11 @@ export default {
}, },
data() { data() {
return { return {
center_point: [121.619992, 30.025703], center_point: window.$mapCfg.center,
}; };
}, },
mounted() { mounted() {
console.log(this.center_point)
this.init_map(); this.init_map();
}, },
methods: { methods: {

Loading…
Cancel
Save