From 26385d2c91d763259eb1ef55c3255e5ca01717a5 Mon Sep 17 00:00:00 2001
From: ZhAkps <46207005+ZhAkps@users.noreply.github.com>
Date: 星期二, 06 二月 2024 18:18:08 +0800
Subject: [PATCH] Merge branch 'master' of http://106.120.22.35:48888/r/PM20221203225_MobileWeb

---
 src/utils/map2.js |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/src/utils/map2.js b/src/utils/map2.js
index 2fc2edd..9d08ec4 100644
--- a/src/utils/map2.js
+++ b/src/utils/map2.js
@@ -2203,6 +2203,7 @@
 
 
 //openlayer 鍒涘缓鐐逛綅
+window.pointArr = [];
 export function createPointMarker(position, obj) {
     let startFeature = new ol.Feature({
         geometry: new ol.geom.Point(position),
@@ -2210,6 +2211,12 @@
     startFeature.setProperties({
         desc: obj,
     });
+    if (window.pointArr && window.pointArr.length > 0) {
+        window.pointArr.forEach(item => {
+            window.map.removeLayer(item)
+        })
+        window.pointArr = []
+    }
     let MarkerLayer = new ol.layer.Vector({
         id: 'LocationPoint',
         name: '鏍囪鐐�',
@@ -2229,22 +2236,12 @@
         }),
         zIndex: 1099,
     })
+    window.pointArr.push(MarkerLayer)
     return MarkerLayer;
 }
 
 //openlayer 鍦板浘鐐瑰嚮浜嬩欢
 export function setClick(state) {
-    console.log('setClick');
-    let ponitPanel = document.getElementById('ponitPanel');
-    let overlay = new ol.Overlay({
-        element: ponitPanel,
-        autoPan: {
-            animation: {
-                duration: 250,
-            },
-        },
-    });
-    window.map.addOverlay(overlay);
     function handleClick(e) {
         console.log(e.coordinate);
         // 鍦熷湴绠$悊
@@ -2365,7 +2362,6 @@
             return;
         }
 
-
         window.map.forEachFeatureAtPixel(e.pixel, function (feature) {
             if (feature && feature.values_.desc) {
                 let obj = feature.values_.desc
@@ -2376,15 +2372,18 @@
                     lon: obj.lng,
                     lat: obj.lat
                 }
-                console.log('objdata');
+                overlay.setPosition(e.coordinate);
                 store.setPoplayerShowAction(true);
                 store.setPoplayerListAction(objdata);
-                window.instance = new PoiLayerConstructor({
-                    data: {
-                        list1: objdata
-                    }
-                });
-                window.instance.$mount();
+                // if (window.instance) {
+                //     window.instance.$destroy();
+                // }
+                // window.instance = new PoiLayerConstructor({
+                //     data: {
+                //         list: objdata
+                //     }
+                // });
+                // window.instance.$mount();
             }
         });
     }

--
Gitblit v1.9.3