Преглед изворни кода

修改土地和载体地图

xyg пре 6 месеци
родитељ
комит
264f94cb29

+ 0 - 1
nngkxxdp/src/main/resources/static/naxsb/syyggyy.html

@@ -404,7 +404,6 @@ border: 1px solid #EFA34E;color: #EFA34E;"><span>企业人才</span><span>服务
                     type: "get",
                     dataType: "json",
                     success: function (data) {
-                        console.log(data)
                         var pointlist = data.addr.split('@');
                         that.jbqk = data;
                         document.title = that.jbqk.title;

+ 25 - 13
nngkxxdp/src/main/resources/static/naxsb/tdcr.html

@@ -277,12 +277,16 @@
                 }
                 this.imgUrl = imgurl;
             },
-            loadMap(points, currPoints) {
+            loadMap(points, namePoint, centerPoint) {
                 let map = new BMap.Map("mapcontainer");
                 map.enableScrollWheelZoom();// 启用滚轮缩放
                 map.enableDragging(); // 启用拖拽功能
                 // 设定中心点和地图级别
-                map.centerAndZoom(new BMap.Point(106.651444, 29.48682), 15);
+                if (!centerPoint) { map.centerAndZoom(new BMap.Point(106.64100001869987, 29.479255312672327), 17); } else {
+                    let centerarr = centerPoint.split(',');
+                    map.centerAndZoom(new BMap.Point(centerarr[0], centerarr[1]), 17);
+                }
+                // map.centerAndZoom(new BMap.Point(106.64100001869987, 29.479255312672327), 17);
                 map.setMapType(BMAP_SATELLITE_MAP);
                 if (!points) return;
                 let pointList = points.split('@');
@@ -303,10 +307,16 @@
                 // 将多边形添加到地图中
                 map.addOverlay(polygon);
                 // 创建文本标签
+                if (!namePoint) return;
+                let namearr = namePoint.split(',');
                 var opts = {
-                    position: new BMap.Point(106.644876, 29.491868), // 指定文本标签所在的地理位置
+                    position: new BMap.Point(namearr[0], namearr[1]), // 指定文本标签所在的地理位置
                     offset: new BMap.Size(10, 10) // 设置文本偏移量
                 };
+                // var opts = {
+                //     position: new BMap.Point(106.64000001869987, 29.481385312672327), // 指定文本标签所在的地理位置
+                //     offset: new BMap.Size(10, 10) // 设置文本偏移量
+                // };
                 // 创建文本标签对象,并添加到地图
                 var label = new BMap.Label(this.tdcrDetail.landName, opts);
                 // 自定义文本标签样式
@@ -325,15 +335,15 @@
                 });
                 map.addOverlay(label);
 
-                // 添加选择地址
-                if (!currPoints) return;
-                let pList = currPoints.split('@');
-                pList.forEach(function (point) {
-                    let arr = point.split(',');
-                    let p = new BMap.Point(arr[0], arr[1]);
-                    let marker = new BMap.Marker(p);
-                    map.addOverlay(marker);
-                });
+                // // 添加选择地址
+                // if (!currPoints) return;
+                // let pList = currPoints.split('@');
+                // pList.forEach(function (point) {
+                //     let arr = point.split(',');
+                //     let p = new BMap.Point(arr[0], arr[1]);
+                //     let marker = new BMap.Marker(p);
+                //     map.addOverlay(marker);
+                // });
             },
             getLandDetail(id) {
                 let that = this;
@@ -344,6 +354,7 @@
                     dataType: "json",
                     success: function (d) {
                         let data = d.data;
+                        console.log(data)
                         if (!data) return;
                         that.tdcrDetail = data;
                         that.swiperList = data.imgUrl ? data.imgUrl.split(",") : [];
@@ -352,7 +363,8 @@
                         }
                         that.imgUrl = that.swiperList[0];
                         let points = data.parkData.addr;
-                        that.loadMap(points, data.point);
+                        that.loadMap(data.point, data.namePoint, data.centerPoint)
+                        // that.loadMap("106.644876,29.494949@106.635821,29.481304@106.638048,29.480675@106.645379,29.481744@106.648397,29.479921@106.65429,29.480675@106.66392,29.481367@106.663057,29.486209@106.662985,29.486901@106.666076,29.48885@106.666507,29.490233@106.665573,29.493817@106.66162,29.49564@106.661692,29.493503@106.659105,29.49344@106.658171,29.491868@106.654721,29.492874@106.65314,29.494383@106.651415,29.496143@106.649475,29.493251");
                     }
                 });
             }

+ 55 - 21
nngkxxdp/src/main/resources/static/naxsb/ztcrdetail.html

@@ -319,6 +319,7 @@
                     type: "get",
                     dataType: "json",
                     success: function (data) {
+                        console.log(data)
                         let mdata = data.data;
                         mdata.tags = mdata.tag ? mdata.tag.split(",") : []
                         console.log(mdata)
@@ -330,35 +331,39 @@
                         }
                         that.imgUrl = that.swiperList[0];
                         let points = mdata.parkData.addr;
-                        that.loadMap(points, mdata.point);
+                        that.loadMap(points, mdata.point, mdata.namePoint, mdata.centerPoint);
                     }
                 });
             },
-            loadMap(points, currPoints) {
+            loadMap(points, currPoints, namePoint, centerPoint) {
                 let map = new BMap.Map("mapcontainer");
                 map.enableScrollWheelZoom();// 启用滚轮缩放
                 map.enableDragging(); // 启用拖拽功能
                 // 设定中心点和地图级别
-                map.centerAndZoom(new BMap.Point(106.651444, 29.48682), 15);
+                if (!centerPoint) { map.centerAndZoom(new BMap.Point(106.6438551, 29.480752), 17); } else {
+                    let centerarr = centerPoint.split(',');
+                    map.centerAndZoom(new BMap.Point(centerarr[0], centerarr[1]), 17);
+                }
+                // map.centerAndZoom(new BMap.Point(106.6438551, 29.480752), 17);
                 map.setMapType(BMAP_SATELLITE_MAP);
-                if (!points) return;
-                let pointList = points.split('@');
-                let result = [];
-                pointList.forEach(function (point) {
-                    let arr = point.split(',');
-                    result.push(new BMap.Point(arr[0], arr[1]));
-                });
-                // 创建多边形
-                let polygon = new BMap.Polygon(result, {
-                    strokeColor: "blue",
-                    strokeWeight: 2,
-                    strokeOpacity: 0.5,
-                    strokeStyle: "dashed",
-                    fillColor: "#4B98F6",
-                    fillOpacity: 0.3
-                });
-                // 将多边形添加到地图中
-                map.addOverlay(polygon);
+                // if (!points) return;
+                // let pointList = points.split('@');
+                // let result = [];
+                // pointList.forEach(function (point) {
+                //     let arr = point.split(',');
+                //     result.push(new BMap.Point(arr[0], arr[1]));
+                // });
+                // // 创建多边形
+                // let polygon = new BMap.Polygon(result, {
+                //     strokeColor: "blue",
+                //     strokeWeight: 2,
+                //     strokeOpacity: 0.5,
+                //     strokeStyle: "dashed",
+                //     fillColor: "#4B98F6",
+                //     fillOpacity: 0.3
+                // });
+                // // 将多边形添加到地图中
+                // map.addOverlay(polygon);
 
                 // 添加选择地址
                 if (!currPoints) return;
@@ -369,6 +374,35 @@
                     let marker = new BMap.Marker(p);
                     map.addOverlay(marker);
                 });
+                console.log(namePoint)
+                // 创建文本标签
+                if (!namePoint) return;
+                let namearr = namePoint.split(',');
+                var opts = {
+                    position: new BMap.Point(namearr[0], namearr[1]), // 指定文本标签所在的地理位置
+                    offset: new BMap.Size(10, 10) // 设置文本偏移量
+                };
+                // var opts = {
+                //     position: new BMap.Point(106.643551, 29.487952), // 指定文本标签所在的地理位置
+                //     offset: new BMap.Size(10, 10) // 设置文本偏移量
+                // };
+                // 创建文本标签对象,并添加到地图
+                var label = new BMap.Label(this.ztcrDetail.carrierName, opts);
+                // 自定义文本标签样式
+                label.setStyle({
+                    color: "#FFFFFF",
+                    fontSize: "18px",
+                    height: "auto",
+                    lineHeight: "20px",
+                    fontFamily: "微软雅黑",
+                    fontWeight: 'bold',
+                    backgroundColor: 'transparent',
+                    border: 'none',
+                    textShadow: '0 0 4px #4B97F5',
+                    textStrokeColor: "#4B97F5", // 文本描边颜色
+                    textStrokeWidth: "4px", // 文本描边宽度
+                });
+                map.addOverlay(label);
             },
         }
     })