pyt
2025-02-27 cb429a55a72f46bc8b749e0870b4a006fd066c78
H5/pages/location/location.vue
@@ -96,7 +96,7 @@
                     result.id = index + 1
                     return result
                  });
                  console.log(this.locationList);
               }
            })
            return
@@ -111,7 +111,7 @@
                  ak: '3mHKIXMArjgIkgADzOlTYp4XssNSNkwr' // 替换为你自己的 AK
               },
               success: (res) => {
                  console.log(res, '-------');
                  if (res.data.status === 0) {
                     this.searchResults = res.data.results;
                     this.latitude = res.data.results[0].location.lat
@@ -135,7 +135,7 @@
      },
      onReady() {
         this.map = new BMapGL.Map("container"); // 创建地图实例 
         console.log(this.map);
         // uni.getLocation({
         //    type: 'wgs84',
         //    success: (res) => {
@@ -146,12 +146,12 @@
            const longitude = position.coords.longitude;
            const accuracy = position.coords.accuracy; // 精度,单位米
            console.log(`纬度: ${latitude}, 经度: ${longitude}, 精度: ${accuracy}`);
            //  在这里可以使用获取到的经纬度信息,例如在地图上显示位置等。
         }
         function error(err) {
            console.log(err);
            switch (err.code) {
               case err.PERMISSION_DENIED:
                  console.error("用户拒绝了位置请求。");
@@ -191,7 +191,7 @@
               item.id = index + 1
               return item
            })
            console.log(this.locationList);
         })
         this.map.addEventListener('click', (e) => {
            this.clearMarkers()
@@ -203,7 +203,7 @@
            var myGeo = new BMapGL.Geocoder();
            // 根据坐标得到地址描述    
            myGeo.getLocation(new BMapGL.Point(e.latlng.lng, e.latlng.lat), (result) => {
               console.log(result, 'result');
               this.locationList = result.surroundingPois.map((item, index) => {
                  item.id = index + 1
                  return item
@@ -216,7 +216,7 @@
         });
         // },
         // error:err=>{
         //    console.log(err,'err');
         //
         // }
         // });