From 45e02578775f7e05e41923af4294c3617e26bd13 Mon Sep 17 00:00:00 2001 From: wzp <2040239371@qq.com> Date: 星期日, 04 五月 2025 18:58:50 +0800 Subject: [PATCH] feat: 优化匿名,和详情页 --- ruoyi-ui/src/views/system/gps/map.vue | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ruoyi-ui/src/views/system/gps/map.vue b/ruoyi-ui/src/views/system/gps/map.vue index c659550..f96f1a6 100644 --- a/ruoyi-ui/src/views/system/gps/map.vue +++ b/ruoyi-ui/src/views/system/gps/map.vue @@ -356,7 +356,6 @@ marker.setLabel(label); } else { // 缁堢偣鏄剧ず杞﹁締鍥炬爣 - const myIcon = new BMap.Icon( "/car_blue.png", new BMap.Size(20, 20), @@ -384,7 +383,6 @@ borderRadius: "3px", }); marker.setLabel(label); - // 鑾峰彇鍦板潃淇℃伅 const geoc = new BMap.Geocoder(); @@ -397,13 +395,14 @@ addComp.street + addComp.streetNumber; - // 娣诲姞淇℃伅绐楀彛 - const infoWindow = new BMap.InfoWindow( - `鏃堕棿锛�${item.collectTime}<br/>閫熷害锛�${ - item.speed - }km/h<br/>鏂瑰悜锛�${item.direction}掳<br/>鍦板潃锛�${address}` - ); + // 娣诲姞鐐瑰嚮浜嬩欢鐩戝惉鍣� marker.addEventListener("click", () => { + // 鍒涘缓淇℃伅绐楀彛 + const infoWindow = new BMap.InfoWindow( + `鏃堕棿锛�${currentSegment[index].collectTime}<br/>閫熷害锛�${ + currentSegment[index].speed + }km/h<br/>鏂瑰悜锛�${currentSegment[index].direction}掳<br/>鍦板潃锛�${address}` + ); this.map.openInfoWindow(infoWindow, bdPoint); }); }); @@ -475,12 +474,25 @@ }); marker.setLabel(label); - // 娣诲姞淇℃伅绐楀彛 - const infoWindow = new BMap.InfoWindow( - `鏃堕棿锛�${row.collectTime}<br/>閫熷害锛�${row.speed}km/h<br/>鏂瑰悜锛�${row.direction}掳<br/>鍦板潃锛�${row.address}` - ); - marker.addEventListener("click", () => { - this.map.openInfoWindow(infoWindow, data.points[0]); + // 鑾峰彇鍦板潃淇℃伅 + const geoc = new BMap.Geocoder(); + geoc.getLocation(data.points[0], (rs) => { + const addComp = rs.addressComponents; + const address = + addComp.province + + addComp.city + + addComp.district + + addComp.street + + addComp.streetNumber; + + // 娣诲姞鐐瑰嚮浜嬩欢鐩戝惉鍣� + marker.addEventListener("click", () => { + // 鍒涘缓淇℃伅绐楀彛 + const infoWindow = new BMap.InfoWindow( + `鏃堕棿锛�${row.collectTime}<br/>閫熷害锛�${row.speed}km/h<br/>鏂瑰悜锛�${row.direction}掳<br/>鍦板潃锛�${address}` + ); + this.map.openInfoWindow(infoWindow, data.points[0]); + }); }); // 淇濆瓨褰撳墠鏍囪鐐瑰紩鐢� -- Gitblit v1.9.1