Browse Source

修改环境

shuhao 4 months ago
parent
commit
d69673ae5d
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/views/authentic/authenticMap.js

+ 4 - 3
src/views/authentic/authenticMap.js

@@ -311,17 +311,18 @@ class AuthenticMap {
         if (fs.length > 0) {
           const feature = fs[0];
           const geometry = feature.getGeometry();
-          const coordinates = geometry.getCoordinates()[0]; // 获取多边形的顶点坐标
+          let coordinates = geometry.getCoordinates()[0]; // 获取多边形的顶点坐标
             ElMessage.success("已选择该点位")
             const features = f
             //代码可优化,明天优化
               if(mapData.selectPointArr.length>0){
                 if(features.get("id")===mapData.selectPointArr[0].get("id")){
-                    // const list = features.getGeometry().getCoordinates();
+                    const list = features.getGeometry().getCoordinates();
+                  coordinates = list[0][0]
                     // const arr = list[0][0].find(subArray => subArray.includes(coordinates))
                   let arr = []
                   let i = 0;let curDistance = 0
-                  for(let subArray of coordinates[0]){
+                  for(let subArray of coordinates){
                     let from = turf.point(subArray);
                     let to = turf.point(lonlat);
                     let options = { units: "miles" };