From 59af55dc3e72f8f2655ae06af9d1b6f766bac423 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 20 三月 2026 16:02:19 +0800
Subject: [PATCH] 2026.3.20

---
 src/utils/map/index.js |   92 +++++++++++++++++++++++----------------------
 1 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/src/utils/map/index.js b/src/utils/map/index.js
index 76a1e7b..8e39c2c 100644
--- a/src/utils/map/index.js
+++ b/src/utils/map/index.js
@@ -1,28 +1,28 @@
-import AMapLoader from '@amap/amap-jsapi-loader';
+import AMapLoader from '@amap/amap-jsapi-loader'
 
-var mapInitDone = false;
-var onMapMountedEvents = [];
+var mapInitDone = false
+var onMapMountedEvents = []
 
-var AMap;
+var AMap
 // 鍦板浘瀵硅薄
-var map;
+var map
 // 鍗槦鍥惧眰
-var satellite;
+var satellite
 // 榧犳爣缁樺浘
-var mouseTool;
+var mouseTool
 // 3D鍥惧眰
-var object3Dlayer;
+var object3Dlayer
 // 鍦板浘鎷栧姩鐘舵��
-var isDragging = false;
+var isDragging = false
 
 // 鍦板浘鍔犺浇瀹屾垚瑙﹀彂
 function onMapMounted(...events) {
   if (mapInitDone) {
     events.forEach((e) => {
-      e();
-    });
+      e()
+    })
   } else {
-    onMapMountedEvents = onMapMountedEvents.concat(events);
+    onMapMountedEvents = onMapMountedEvents.concat(events)
   }
 }
 
@@ -36,50 +36,51 @@
       'AMap.ControlBar',
       'AMap.ToolBar',
       'AMap.Scale',
-      'AMap.DistrictSearch'
+      'AMap.DistrictSearch',
       // 'AMap.DragRoute',
       // 'AMap.MouseTool',
       // 'AMap.PolygonEditor'
-    ]
+    ],
   })
     .then((_AMap) => {
-      AMap = _AMap;
-      _initMap(id);
-      mapInitDone = true;
+      AMap = _AMap
+      _initMap(id)
+      mapInitDone = true
       onMapMountedEvents.forEach((e) => {
-        e();
-      });
-      onMapMountedEvents = [];
-      console.log('-------------------map init done');
+        e()
+      })
+      onMapMountedEvents = []
+      console.log('-------------------map init done')
     })
     .catch((e) => {
-      console.log(e);
-    });
+      console.log(e)
+    })
 }
 
 function destroyMap() {
-  map?.destroy();
-  map = null;
-  mapInitDone = false;
+  map?.destroy()
+  map = null
+  mapInitDone = false
 }
 
 function _initMap(elementId) {
   map = new AMap.Map(elementId, {
     // mapStyle: 'amap://styles/e1e78509de64ddcd2efb4cb34c6fae2a',
     features: ['bg', 'road'],
-    pitch: 45, // 鍦板浘淇话瑙掑害锛屾湁鏁堣寖鍥� 0 搴�- 83 搴�
-    viewMode: '2D', // 鍦板浘妯″紡
+    pitch: 0, // 鍦板浘淇话瑙掑害锛屾湁鏁堣寖鍥� 0 搴�- 83 搴�
+    viewMode: '3D', // 鍦板浘妯″紡
     resizeEnable: true,
     center: [121.6039283, 31.25295567],
     zooms: [2, 26],
-    zoom: 14
-  });
+    zoom: 11,
+  })
   // map = new AMap.Map(elementId);
 
   // 娣诲姞鍗槦鍦板浘
-  satellite = new AMap.TileLayer.Satellite();
-  satellite.hide();
-  map.add([satellite]);
+  satellite = new AMap.TileLayer.Satellite()
+  // const roadNet = new AMap.TileLayer.RoadNet()
+  satellite.hide()
+  map.add([satellite])
 
   // _initMouseTool();
   // _init3DLayer();
@@ -88,27 +89,27 @@
 
 // 榧犳爣缁樺浘鍒濆鍖�
 function _initMouseTool() {
-  mouseTool = new AMap.MouseTool(map);
+  mouseTool = new AMap.MouseTool(map)
 }
 
 // 3D鍥惧眰鍒濆鍖�
 function _init3DLayer() {
-  object3Dlayer = new AMap.Object3DLayer();
-  map.add(object3Dlayer);
+  object3Dlayer = new AMap.Object3DLayer()
+  map.add(object3Dlayer)
 }
 
 // 璁剧疆鍦板浘鎷栨嫿鐩戝惉浜嬩欢
 function _initDragEvent() {
-  let dragEndEvent;
+  let dragEndEvent
   map.on('dragstart', () => {
-    clearTimeout(dragEndEvent);
-    isDragging = true;
-  });
+    clearTimeout(dragEndEvent)
+    isDragging = true
+  })
   map.on('dragend', function () {
     dragEndEvent = setTimeout(() => {
-      isDragging = false;
-    }, 8000);
-  });
+      isDragging = false
+    }, 8000)
+  })
 }
 
 export {
@@ -117,7 +118,8 @@
   onMapMounted,
   map,
   AMap,
+  satellite,
   mouseTool,
   object3Dlayer,
-  isDragging
-};
+  isDragging,
+}

--
Gitblit v1.9.3