diff --git a/src/main/resources/static/assets/js/baidumap-select.js b/src/main/resources/static/assets/js/baidumap-select.js new file mode 100644 index 0000000..c0b231c --- /dev/null +++ b/src/main/resources/static/assets/js/baidumap-select.js @@ -0,0 +1,202 @@ + //#region 百度地图相关代码 + /*************************百度地图 **************************/ + function loadDefulatMap(initData) { + var point = new BMap.Point(initData && initData.lng ? initData.lng : 116.404 , initData && initData.lat ? initData.lat : 39.915); // 创建点坐标 + map.centerAndZoom(point, 15); // 初始化地图,设置中心点坐标和地图级别 + map.addControl(new BMap.NavigationControl()); + map.addControl(new BMap.ScaleControl()); + map.addControl(new BMap.OverviewMapControl()); + createMarker(point, true); + //map.addControl(new BMap.MapTypeControl()); //不同类型的百度地图 + //map.setCurrentCity("北京"); // 仅当设置城市信息时,MapTypeControl的切换功能才能可用 + } + + function Autocomplete() { + //建立一个自动完成的对象 + var ac = new BMap.Autocomplete( + { + "input": "baiduAddress", + "location": map + }); + ac.addEventListener("onhighlight", function (e) { //鼠标放在下拉列表上的事件 + var str = ""; + var _value = e.fromitem.value; + var value = ""; + if (e.fromitem.index > -1) { + value = _value.province + _value.city + _value.district + _value.street + _value.business; + } + str = "FromItem
index = " + e.fromitem.index + "
value = " + value; + + value = ""; + if (e.toitem.index > -1) { + _value = e.toitem.value; + value = _value.province + _value.city + _value.district + _value.street + _value.business; + } + str += "
ToItem
index = " + e.toitem.index + "
value = " + value; + $(".area_tip").innerHTML = str; + }); + ac.addEventListener("onconfirm", function (e) {//鼠标点击下拉列表后的事件 + var _value = e.item.value; + var myValue = _value.street + _value.business; + $(".area_tip").innerHTML = "onconfirm
index = " + e.item.index + "
myValue = " + myValue; + setPlace(myValue); + }) + } + //地图选点点击事件 + function clickCoordinate(e) { + var point = e.point; + //请先选择省市区 + //var area = $(".store_Area").val(); + //if (area == null || area == "") { + // alert(baiduParam.SelectRegion_Error); + // return; + //} + createMarker(point); + } + function setPlace(value) { + function myFun() { + if (local.getResults().getPoi(0)) { + var point = local.getResults().getPoi(0).point; //获取第一个智能搜索的结果 + createMarker(point); + } else { + alert("未搜索到结果,请重新输入"); + } + } + var local = new BMap.LocalSearch(map, { //智能搜索 + onSearchComplete: myFun + }); + local.search(value); + } + + var baiduParam = { + oldPoint: null//记录旧值,用于地图拖拽失败后回到原来位置 + , Exceed_Error: "定位地址失败,您搜索或定位超出县级范围,请重新选择定位" + , SelectRegion_Error: "定位地址失败,您搜索或定位超出县级范围,请先选择省市区" + , Location_Div: "
已将坐标定位为
{address}
地址:{title}

" + , Location_Sure_Div: "已将坐标定位为
{address}
地址:{title}

" + } + + function createMarker(point, isLoad) { + //反向解析地址 + myGeo.getLocation(point, function (rs) { + + //验证区域是否在区域内 + //if (rs.addressComponents.province != $(".store_Province").find("option:selected").text() || + // rs.addressComponents.city != $(".store_City").find("option:selected").text() || + // rs.addressComponents.district != $(".store_Area").find("option:selected").text()) { + // alert(baiduParam.Exceed_Error); + // if (baiduParam.oldPoint) { + // createMarker(baiduParam.oldPoint); + // } + // return; + //} + map.clearOverlays();//清除之前所有的标志 + + //红点开始 + var marker = new BMap.Marker(point);// 创建标注 + map.addOverlay(marker); // 将标注添加到地图中 + marker.enableDragging();//可拖拽 自定义拖拽 + //拖拽前事件 + marker.addEventListener("dragstart", function (e) { + baiduParam.oldPoint = e.point; + }) + //拖拽完成事件 + marker.addEventListener("dragend", function (e) { + createMarker(e.point); + }) + //红点完成 + + baiduParam.oldPoint = null; + /******** 图层初始化 ********/ + /**图层样式文字处理开始**/ + var html = baiduParam.Location_Div; + if (isLoad == true) { + map.centerAndZoom(point, map.getZoom()); //重置地图位置 + html = baiduParam.Location_Sure_Div; + } + //如果缩放等级小于当前的 ,则为18 + if (map.getZoom() < 18) { + map.setZoom(18); + } + //解析地址 + var rsaddress = rs.address; + var rstitle = rs.surroundingPois[0] != null ? rs.surroundingPois[0].title : ""; + html = html.replace("{address}", rsaddress).replace("{title}", rstitle); + /**图层样式文字处理结束**/ + + var infoWindow = new BMap.InfoWindow(html, { offset: { width: 0, height: -25 } }); + // 创建信息窗口对象 + map.openInfoWindow(infoWindow, point); //开启信息窗口 + //确定事件绑定 + infoWindow.addEventListener("open", function (a) { + $("#saveLngLat").unbind("click"); + $("#saveLngLat").click(function () { + infoWindow.setContent("已将坐标定位为
" + rs.address + "
地址:" + (rs.surroundingPois[0] != null ? rs.surroundingPois[0].title : "") + "

"); + $(".store_Address").val(rs.address + " " + (rs.surroundingPois[0] != null ? rs.surroundingPois[0].title : "") ); + $(".store_Lng").val(rs.point.lng); + $(".store_Lat").val(rs.point.lat); + }) + }) + infoWindow.redraw(function () { + $("#saveLngLat").unbind("click"); + $("#saveLngLat").click(function () { + infoWindow.setContent("已将坐标定位为
" + rs.address + "
地址:" + (rs.surroundingPois[0] != null ? rs.surroundingPois[0].title : "") + "

"); + $(".store_Address").val(rs.address + " " + (rs.surroundingPois[0] != null ? rs.surroundingPois[0].title : "") ); + $(".store_Lng").val(rs.point.lng); + $(".store_Lat").val(rs.point.lat); + }) + }); + /******** 图层初始化 ********/ + }); + } + //#region /****查询控件类****/ + function BigZoomControl() { + // 设置默认停靠位置和偏移量 + this.defaultAnchor = BMAP_ANCHOR_TOP_RIGHT; + this.defaultOffset = new BMap.Size(150, 20); + } + // 通过JavaScript的prototype属性继承于BMap.Control + BigZoomControl.prototype = new BMap.Control(); + // 自定义控件必须实现自己的initialize方法,并且将控件的DOM元素返回 + // 在本方法中创建个div元素作为控件的容器,并将其添加到地图容器中 + BigZoomControl.prototype.initialize = function (map) { + // 创建一个DOM元素 + var div = document.createElement("div"); + // 设置样式 + div.style.cursor = "pointer"; + div.style.margin = "0 auto"; + div.style.backgroundColor = "white"; + div.innerHTML = "
"; + // 添加DOM元素到地图中 + map.getContainer().appendChild(div); + // 将DOM元素返回 + return div; + } + //#endregion + //#endregion + + //#region 百度地图初始化 + /****************百度地图初始化开始****************/ + //去除默认点击 + var map = new BMap.Map("myMap", { enableMapClick: false }); + map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 + // 创建地址解析器实例 + var myGeo = new BMap.Geocoder(); + loadDefulatMap({});//初始化地图以及加载初始化数据 + // 创建控件 + var myZoomCtrl = new BigZoomControl(); + //// 查询控件类到地图当中 + map.addControl(myZoomCtrl); + //查询控件的点击事件 + $(".searchMap").click(function () { + setPlace($("#baiduAddress").val()); + }); + Autocomplete();//构建自动 + bindEvent(); + function bindEvent() { + //查询百度地图 + map.addEventListener("click", clickCoordinate); //地图点击事件 + } + /****************百度地图初始化完成****************/ + //#endregion + diff --git a/src/main/resources/static/route/196794dd-bfba-49ff-ba88-5693ff33227a.html b/src/main/resources/static/route/196794dd-bfba-49ff-ba88-5693ff33227a.html new file mode 100644 index 0000000..5058ab7 --- /dev/null +++ b/src/main/resources/static/route/196794dd-bfba-49ff-ba88-5693ff33227a.html @@ -0,0 +1,3240 @@ + + + + + + 乌兰察布市生态委数据总览 + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/shoptemplateconfig/baseinfo.html b/src/main/resources/templates/shoptemplateconfig/baseinfo.html new file mode 100644 index 0000000..ead6638 --- /dev/null +++ b/src/main/resources/templates/shoptemplateconfig/baseinfo.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + +
+
+
+
+

+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/templates/shoptemplateconfig/companyinfo.html b/src/main/resources/templates/shoptemplateconfig/companyinfo.html new file mode 100644 index 0000000..e601630 --- /dev/null +++ b/src/main/resources/templates/shoptemplateconfig/companyinfo.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+ + + + \ No newline at end of file