From c1551d5aae68c1d92e810903cdd99ff821f43317 Mon Sep 17 00:00:00 2001 From: Vce Date: Thu, 28 Mar 2024 11:42:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=87=E7=BA=A7=E5=9C=B0=E5=9B=BEAPI?= =?UTF-8?q?=E4=B8=BA2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 7 +- .../digitalConstruction/carPosition/index.vue | 1 + .../equipmentPosition/index.vue | 1 + .../smartSafeHat/index.vue | 73 ++++++++++--------- 4 files changed, 44 insertions(+), 38 deletions(-) diff --git a/index.html b/index.html index 71d8da5..fbdc89e 100644 --- a/index.html +++ b/index.html @@ -106,9 +106,12 @@ } - + defer="defer"> --> + diff --git a/src/views/sevenLargeScreen/digitalConstruction/carPosition/index.vue b/src/views/sevenLargeScreen/digitalConstruction/carPosition/index.vue index b4bb95b..5952844 100644 --- a/src/views/sevenLargeScreen/digitalConstruction/carPosition/index.vue +++ b/src/views/sevenLargeScreen/digitalConstruction/carPosition/index.vue @@ -953,6 +953,7 @@ function initMap() { // // this.placeSearch = new AMap.PlaceSearch({ // // map: map // // }); //构造地点查询类 + // // 升级2.0后AMap.event.addListener()此方法已废弃 // // AMap.event.addListener(auto, "select", this.select); //注册监听,当选中某条记录时会触发 // mouseTool = new AMap.MouseTool(map); // mouseTool.on("draw", function (event) { diff --git a/src/views/sevenLargeScreen/digitalConstruction/equipmentPosition/index.vue b/src/views/sevenLargeScreen/digitalConstruction/equipmentPosition/index.vue index 166dff1..a67186b 100644 --- a/src/views/sevenLargeScreen/digitalConstruction/equipmentPosition/index.vue +++ b/src/views/sevenLargeScreen/digitalConstruction/equipmentPosition/index.vue @@ -1140,6 +1140,7 @@ function initMap() { // this.placeSearch = new AMap.PlaceSearch({ // map: map // }); //构造地点查询类 + // 升级2.0后AMap.event.addListener()此方法已废弃 // AMap.event.addListener(auto, "select", this.select); //注册监听,当选中某条记录时会触发 mouseTool = new AMap.MouseTool(map); mouseTool.on("draw", function (event) { diff --git a/src/views/sevenLargeScreen/digitalConstruction/smartSafeHat/index.vue b/src/views/sevenLargeScreen/digitalConstruction/smartSafeHat/index.vue index a0ca029..bdbd29f 100644 --- a/src/views/sevenLargeScreen/digitalConstruction/smartSafeHat/index.vue +++ b/src/views/sevenLargeScreen/digitalConstruction/smartSafeHat/index.vue @@ -149,7 +149,8 @@
-
+ +
@@ -546,39 +547,38 @@ function closeDetail(){ isOpenDetail.value = false } -let addressStr = ref(""); -function localtionLotLat(longitude: number | null, latitude: number | null) { - if (longitude && latitude) { - const fixedLongitude = longitude.toFixed(6); - const fixedLatitude = latitude.toFixed(6); - return `经纬度 ${fixedLongitude}, ${fixedLatitude}`; - } - return "未知位置"; -} +// let addressStr = ref(""); +// function localtionLotLat(longitude: number | null, latitude: number | null) { +// if (longitude && latitude) { +// const fixedLongitude = longitude.toFixed(6); +// const fixedLatitude = latitude.toFixed(6); +// return `经纬度 ${fixedLongitude}, ${fixedLatitude}`; +// } +// return "未知位置"; +// } -const resolveAddStr = computed(() => async (longitude: any, latitude: any) => { - //计算属性传递参数 - console.log("👇传参"); - console.log(longitude, latitude); - if (longitude && latitude) { - var addressResolve = new AMap.LngLat(longitude, latitude); - let geocoder2 = new AMap.Geocoder(); - await geocoder2.getAddress(addressResolve, function (status, result) { - console.log("👇解析地址"); - console.log(status, result); - if (status === "complete") { - addressStr.value = result.regeocode.formattedAddress; - // console.log(result.regeocode.formattedAddress); - console.log(addressStr); - return addressStr.value; - } else { - return `未知位置1`; - } - }); - } - - return "未知位置2"; -}); +// const resolveAddStr = computed(() => async (longitude: any, latitude: any) => { +// //计算属性传递参数 +// console.log("👇传参"); +// console.log(longitude, latitude); +// if (longitude && latitude) { +// var addressResolve = new AMap.LngLat(longitude, latitude); +// let geocoder2 = new AMap.Geocoder(); +// await geocoder2.getAddress(addressResolve, function (status, result) { +// console.log("👇解析地址"); +// console.log(status, result); +// if (status === "complete") { +// addressStr.value = result.regeocode.formattedAddress; +// // console.log(result.regeocode.formattedAddress); +// console.log(addressStr); +// return addressStr.value; +// } else { +// return `未知位置1`; +// } +// }); +// } +// return "未知位置2"; +// }); function areaRadiusChange() { if (addForm.value.locationList.length === 1) { @@ -1447,6 +1447,7 @@ function initMap() { // placeSearch = new AMap.PlaceSearch({ // map: map // }); //构造地点查询类 + // 升级2.0后AMap.event.addListener()此方法已废弃 // AMap.event.addListener(auto, "select", select); //注册监听,当选中某条记录时会触发 // >>>>>>>>>>>>>>>>>此部分代码会导致大屏页面跳转时产生窗口抖动<<<<<<<<<<<<<<<<<<< @@ -1542,15 +1543,15 @@ function addMarker() { // 图标的取图地址 image: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png", // 图标所用图片大小 - imageSize: new AMap.Size(25, 34) + imageSize: new AMap.Size(25, 34), // 图标取图偏移量 // imageOffset: new AMap.Pixel(-9, -3) }); var marker = new AMap.Marker({ icon: startIcon, position: [locationList.value[0].longitude, locationList.value[0].latitude], - size: new AMap.Size(25, 34) - // offset: new AMap.Pixel(-13, -30) + size: new AMap.Size(25, 34), + offset: new AMap.Pixel(-13, -30) }); marker.setMap(map); }