init
This commit is contained in:
113
ruoyi-ui/public/baidu/regionSelect.html
Normal file
113
ruoyi-ui/public/baidu/regionSelect.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<!-- <link rel="stylesheet" type="text/css" href="./script/bmap.css" /> -->
|
||||
<style>
|
||||
html,
|
||||
body,
|
||||
#container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// 这里一定要配置ak 否则无法使用
|
||||
window.BMAP_AUTHENTIC_KEY = "t6k6UC2IZR40Un8kkqM4RXlaQb4FulyM"
|
||||
</script>
|
||||
<script>
|
||||
const result = new URLSearchParams(window.location.search)
|
||||
const params = {}
|
||||
for (const [key, value] of result) {
|
||||
params[key] = value
|
||||
}
|
||||
if(params.NODE_ENV === 'production'){
|
||||
document.write('<link rel="stylesheet" type="text/css" href="./script/bmap.pro.css" />')
|
||||
document.write('<script type="text/javascript" src="./script/getscript.pro.js?type=webgl&v=1.0&services=&t=20230529114224"><\/script>')
|
||||
}else if(params.NODE_ENV === 'pre'){
|
||||
document.write('<link rel="stylesheet" type="text/css" href="./script/bmap.pre.css" />')
|
||||
document.write('<script type="text/javascript" src="./script/getscript.pre.js?type=webgl&v=1.0&services=&t=20230529114224"><\/script>')
|
||||
}else{
|
||||
document.write('<link rel="stylesheet" type="text/css" href="./script/bmap.css" />')
|
||||
document.write('<script type="text/javascript" src="./script/getscript.js?type=webgl&v=1.0&services=&t=20230529114224"><\/script>')
|
||||
}
|
||||
</script>
|
||||
<!-- <script type="text/javascript" src="./script/getscript.js?type=webgl&v=1.0&services=&t=20230529114224"></script> -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script>
|
||||
window.parent['mapProps']('map loading');
|
||||
var map = new BMapGL.Map('container', {
|
||||
backgroundColor: [192, 214, 213, 100]
|
||||
});
|
||||
const _params = new URLSearchParams(window.location.search)
|
||||
const type = _params.get('type')
|
||||
if (type === 'first') {
|
||||
map.centerAndZoom('临海农商银行', 13);
|
||||
} else {
|
||||
map.centerAndZoom('杭州市', 13);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
// const localCity = new BMapGL.LocalCity();
|
||||
// localCity.get(result => {
|
||||
// map.centerAndZoom(result.center, 12);
|
||||
// map.setCenter(result.name);
|
||||
// })
|
||||
window.parent['mapProps']('map loading finish');
|
||||
|
||||
function centerAndZoom(center, zoom) {
|
||||
map.centerAndZoom(center, zoom)
|
||||
}
|
||||
|
||||
|
||||
function addPolygon(regionMapVOList) {
|
||||
window.parent['mapProps']('map loading');
|
||||
map.clearOverlays();
|
||||
var allPoints = []
|
||||
var regionPoints = []
|
||||
regionMapVOList.forEach(polygonList => {
|
||||
polygonList.forEach(polygon => {
|
||||
polygon.forEach(points => {
|
||||
var areaPoints = []
|
||||
points.forEach(point => {
|
||||
var point = new BMapGL.Point(parseFloat(point['x']), parseFloat(point['y']));
|
||||
areaPoints.push(point);
|
||||
allPoints.push(point)
|
||||
})
|
||||
regionPoints.push(areaPoints)
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
var geom = new BMapGL.Polygon(regionPoints, { strokeColor: "blue", strokeWeight: 3, strokeOpacity: 0.5 });
|
||||
geom.addEventListener("mouseout", function () {
|
||||
geom.setStrokeWeight(3);
|
||||
geom.setFillOpacity(0);
|
||||
});
|
||||
geom.addEventListener("mouseover", function () {
|
||||
geom.setStrokeWeight(5);
|
||||
geom.setFillOpacity(0.8);
|
||||
});
|
||||
map.addOverlay(geom);
|
||||
map.setViewport(allPoints);
|
||||
window.parent['mapProps']('map loading finish');
|
||||
|
||||
}
|
||||
|
||||
function cleanPolygon() {
|
||||
map.clearOverlays();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user