Browse Source

feature_20250827_地图添加搜索当前范围功能

zhujindu 3 months ago
parent
commit
f0792a8ec0
1 changed files with 21 additions and 17 deletions
  1. 21 17
      src/views/deviceOutside/rangeStore.vue

+ 21 - 17
src/views/deviceOutside/rangeStore.vue

@@ -140,9 +140,11 @@
         <!-- 地图中心坐标 -->
         <!-- 地图中心坐标 -->
         <bm-marker
         <bm-marker
           :position="{ lng: currentCenter.lng, lat: currentCenter.lat }"
           :position="{ lng: currentCenter.lng, lat: currentCenter.lat }"
+          :dragging="true"
+          animation="BMAP_ANIMATION_BOUNCE"
           :icon="{
           :icon="{
             url: 'http://developer.baidu.com/map/jsdemo/img/location.gif',
             url: 'http://developer.baidu.com/map/jsdemo/img/location.gif',
-            size: { width: 150, height: 160 },
+            size: { width: 14, height: 23 },
           }">
           }">
         </bm-marker>
         </bm-marker>
         <bm-marker
         <bm-marker
@@ -169,14 +171,14 @@
           }"
           }"
           :offset="{ width: -10, height: -10 }" />
           :offset="{ width: -10, height: -10 }" />
       </baidu-map>
       </baidu-map>
+      <img src="./../../assets/sbpm.png" @click="onMaps" class="mapimg" style="bottom: 340px" />
       <img
       <img
-        src="./../../assets/sbpm.png"
+        src="./../../assets/list.png"
         @click="onClickLeft"
         @click="onClickLeft"
         class="mapimg"
         class="mapimg"
-        style="bottom: 340px" />
-      <img src="./../../assets/sbpm.png" @click="onMaps" class="mapimg" style="bottom: 286px" />
+        style="bottom: 286px" />
       <!-- 获取当前中心位置数据 -->
       <!-- 获取当前中心位置数据 -->
-      <img src="./../../assets/list.png" @click="getLocationData" class="mapimg" />
+      <img src="./../../assets/sbpm.png" @click="getLocationData" class="mapimg" />
       <div v-if="show" class="mapStoreList">
       <div v-if="show" class="mapStoreList">
         <van-icon
         <van-icon
           name="close"
           name="close"
@@ -974,7 +976,11 @@ export default {
       // this.mapk.clearOverlays()
       // this.mapk.clearOverlays()
       this.getposition();
       this.getposition();
     },
     },
-    getLocationData() {},
+    getLocationData() {
+      this.lon = this.currentCenter.lng;
+      this.lat = this.currentCenter.lat;
+      this.getUserOutPlaList();
+    },
     getStoreTypeList() {
     getStoreTypeList() {
       getStoreTypeListlp({}).then((res) => {
       getStoreTypeListlp({}).then((res) => {
         this.storeTypeLists = res.data;
         this.storeTypeLists = res.data;
@@ -1117,7 +1123,10 @@ export default {
     dragend(e) {
     dragend(e) {
       // const currentCenter = this.mapk.getCenter();
       // const currentCenter = this.mapk.getCenter();
       // console.log(`当前中心点纬度: ${currentCenter.lat}, 经度: ${currentCenter.lng}`);
       // console.log(`当前中心点纬度: ${currentCenter.lat}, 经度: ${currentCenter.lng}`);
-      this.getMapposition(e, '2', this.$route.query.tabVal);
+      // this.getMapposition(e, '2', this.$route.query.tabVal);
+      var input = [e.target.re.lat, e.target.re.lng];
+      this.currentCenter = new TMap.LatLng(Number(input[0]), Number(input[1]));
+      console.log(`当前中心点纬度: ${this.currentCenter.lat}, 经度: ${this.currentCenter.lng}`);
     },
     },
     zoomend(e) {
     zoomend(e) {
       this.getMapposition(e, '1', this.$route.query.tabVal);
       this.getMapposition(e, '1', this.$route.query.tabVal);
@@ -1125,11 +1134,6 @@ export default {
     getMapposition(e, type, listType) {
     getMapposition(e, type, listType) {
       var that = this;
       var that = this;
       var typeList = -1;
       var typeList = -1;
-      var input = [e.target.re.lat, e.target.re.lng];
-      this.currentCenter = new TMap.LatLng(Number(input[0]), Number(input[1]));
-      console.log(`当前中心点纬度: ${this.currentCenter.lat}, 经度: ${this.currentCenter.lng}`);
-      // console.log(this.currentCenter);
-
       var Zoom = e.target.getZoom();
       var Zoom = e.target.getZoom();
       if (listType == 1) {
       if (listType == 1) {
         typeList = 1;
         typeList = 1;
@@ -1154,11 +1158,11 @@ export default {
         var PointSum = that.twoPointSum(lat, lon, that.latsave, that.lonsave).toFixed(2);
         var PointSum = that.twoPointSum(lat, lon, that.latsave, that.lonsave).toFixed(2);
         this.lon = this.mapk.getCenter().lng;
         this.lon = this.mapk.getCenter().lng;
         this.lat = this.mapk.getCenter().lat;
         this.lat = this.mapk.getCenter().lat;
-        if (PointSum > 3000) {
-          setTimeout(() => {
-            this.getUserOutPlaList();
-          }, 1000);
-        }
+        // if (PointSum > 3000) {
+        //   setTimeout(() => {
+        //     this.getUserOutPlaList();
+        //   }, 1000);
+        // }
       }
       }
     },
     },
     getStoreMapInfo(val) {
     getStoreMapInfo(val) {