3a1c2e26 by 任超

feat:地图

1 parent 9ff25577
$('.area_list li').click(function(){
$('.area_list li').click(function () {
$(".area_list li").removeClass("active1")
$(this).addClass("active1");
})
$(".single_input").on("click",function(){
$(".single_input").on("click", function () {
var par_label = $(this).parent();
if(this.checked){
if (this.checked) {
$(".input_label").removeClass("choose_radioed").addClass("choose_radio");
par_label.removeClass("choose_radio").addClass("choose_radioed");
}else{
} else {
}
});
......@@ -41,18 +41,18 @@ layui.use(['form', 'common'], function () {
});
//办事大厅
form.on('select(officehall)', function (data) {
let latitude= undefined
let longitude= undefined
let title= ''
if(data.value==1) {
let latitude = undefined
let longitude = undefined
let title = ''
if (data.value == 1) {
latitude = 116.397469
longitude = 39.908821
title = '北京'
}else if(data.value==2){
} else if (data.value == 2) {
latitude = 121.491119
longitude = 31.235172
title = '上海'
}else {
} else {
latitude = 120.21201
longitude = 30.2084
title = '杭州'
......@@ -90,17 +90,39 @@ geolocation.getCurrentPosition(function (r) {
}
}, { enableHighAccuracy: true });
var map = new BMapGL.Map('container');
var point = new BMapGL.Point(108.95309828, 34.2777999);
map.centerAndZoom(point, 15);
var map = new BMap.Map('container');
var point = new BMap.Point(108.95309828, 34.2777999);
map.centerAndZoom(point, 20);
var cityName = '陕西省';
map.centerAndZoom(cityName, 15); // 初始化地图,设置中心点坐标和地图级别。 map.addControl(new BMap.ScaleControl()); // 添加比例尺控件
map.addControl(new BMap.OverviewMapControl()); //添加缩略地图控件
map.enableScrollWheelZoom();
map.addControl(new BMap.NavigationControl({ type: BMAP_NAVIGATION_CONTROL_LARGE, anchor: BMAP_ANCHOR_TOP_LEFT, offset: new BMap.Size(40, 250) }));
var bdary = new BMap.Boundary();
bdary.get(cityName, function (rs) { //获取行政区域
var EN_JW = "180, 90;"; //东北角
var NW_JW = "-180, 90;"; //西北角
var WS_JW = "-180, -90;"; //西南角
var SE_JW = "180, -90;"; //东南角
//4.添加环形遮罩层
var ply1 = new BMap.Polygon(rs.boundaries[0] + SE_JW + SE_JW + WS_JW + NW_JW + EN_JW + SE_JW, { strokeColor: "none", fillColor: "rgb(246,246,246)", fillOpacity: 1, strokeOpacity: 0.5 }); //建立多边形覆盖物
map.addOverlay(ply1);
//5. 给目标行政区划添加边框,其实就是给目标行政区划添加一个没有填充物的遮罩层
var ply = new BMap.Polygon(rs.boundaries[0], { strokeWeight: 2, strokeColor: "#00f", fillColor: "" });
map.addOverlay(ply);
//map.setViewport(ply.getPath()); //调整视野
});
var opts = {
width: 100,
height: 60,
title: '办事大厅'
};
var infoWindow = new BMapGL.InfoWindow('雁塔区南二环西段', opts);
var infoWindow = new BMap.InfoWindow('雁塔区南二环西段', opts);
map.openInfoWindow(infoWindow, point);
map.centerAndZoom(new BMapGL.Point(108.95309828, 34.2777999), 12); // 初始化地图,设置中心点坐标和地图级别
map.centerAndZoom(new BMap.Point(108.95309828, 34.2777999), 15); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放
\ No newline at end of file
......
......@@ -13,7 +13,6 @@
<link rel='icon' href='favicon.ico' type='image/x-ico' />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=0NWXXsCSawnWID4UYI7Uhrl9WgtI2IGs"></script>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=0NWXXsCSawnWID4UYI7Uhrl9WgtI2IGs"></script>
<link rel="stylesheet" type="text/css" href="../../staticCss/common.css" />
<link rel="stylesheet" type="text/css" href="../../staticLib/layui/css/layui.css" />
......