From 5206e7a4f4c5b71c9ddeccdbbe5e7fba5b3eeb9b Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期五, 22 三月 2024 01:05:38 +0800
Subject: [PATCH] YOUHAU

---
 src/components/rightMenu/bottom2.vue |   62 ++++++++++++++++++------------
 1 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/src/components/rightMenu/bottom2.vue b/src/components/rightMenu/bottom2.vue
index 85a6458..e716acf 100644
--- a/src/components/rightMenu/bottom2.vue
+++ b/src/components/rightMenu/bottom2.vue
@@ -1,16 +1,16 @@
 <template>
   <div class="bottom" id="bottom" :style="customStyle" v-if="state1.show">
-    <!-- <div class="mapTool">
-      <div class="tool-rotate" @click="PointingNorth" title="鎸囧寳">
+    <div class="mapTool">
+      <div class="tool-rotate" @click="flyToCurrentPosition" title="瀹氫綅">
         <img src="@/assets/img/collection/compass.png" />
       </div>
-    </div> -->
+    </div>
     <div class="mapTool">
       <div class="tool-rotate" @click="flyBack" title="澶嶄綅">
         <img src="@/assets/img/collection/recover.png" />
       </div>
     </div>
-    <div class="mapTool2" v-show="test.fwval">
+    <div class="mapTool2">
       <div class="tool-rotate" @click="zoomIn" title="鏀惧ぇ">
         <img src="@/assets/img/collection/add.png" />
       </div>
@@ -24,40 +24,43 @@
 
 <style scoped>
 .mapTool {
-  width: 51px;
+  width: 0.42rem;
   /* border-radius: 10px; */
   /* background: #ffffff; */
   /* margin-bottom: 8px; */
 }
+
 .mapTool .tool-rotate img {
   width: 100%;
 }
+
 .mapTool2 {
-  width: 40px;
-  height: 80px;
-  margin: 0 auto;
+  width: 0.32rem;
+  margin: auto;
   background: #ffffff;
   box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.21);
-  border-radius: 13px;
+  border-radius: 10px;
   display: flex;
   flex-direction: column;
-  justify-content: space-evenly;
   align-items: center;
+  justify-content: center;
 }
-.mapTool2 .tool-rotate img {
-  width: 18px;
-}
-.border {
-  width: 36px;
-  height: 1px;
-  border: 1px solid #e5e5e5;
+.mapTool2 .tool-rotate {
+  height: 0.33rem;
+  line-height: 0.33rem;
 }
 
-/* .tool-rotate {
-  padding: 8px;
-} */
+.mapTool2 .tool-rotate img {
+  width: 0.17rem;
+}
+
+.border {
+  width: 100%;
+  height: 1px;
+  border: 0.005rem solid #f3f3f3;
+}
 </style>
-    
+
 <script>
 import Bus from "../../js/bus.js";
 import store from "@/utils/store2";
@@ -102,6 +105,7 @@
       window.mapapi.getView().animate({
         // 鍙缃渶瑕佺殑灞炴�у嵆鍙�
         center: window.mapapi.getView().getCenter(), // 涓績鐐�
+        projection: "EPSG:3857",
         zoom: zoom + 1, // 缂╂斁绾у埆
         rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害
         duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃�
@@ -113,6 +117,7 @@
       window.mapapi.getView().animate({
         // 鍙缃渶瑕佺殑灞炴�у嵆鍙�
         center: window.mapapi.getView().getCenter(), // 涓績鐐�
+        projection: "EPSG:3857",
         zoom: zoom - 1, // 缂╂斁绾у埆
         rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害
         duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃�
@@ -121,15 +126,22 @@
     flyBack() {
       window.mapapi.getView().animate({
         // 鍙缃渶瑕佺殑灞炴�у嵆鍙�
-        center: [116.52217697339846, 39.75979421847914], // 涓績鐐�
+        center: ol.proj.fromLonLat([116.52217697339846, 39.75979421847914]), // 涓績鐐�
+        projection: "EPSG:3857",
         zoom: 12, // 缂╂斁绾у埆
         rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害
         duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃�
       });
     },
-    PointingNorth() {
-      alert("鎸囧寳閽堝紑鍙戜腑");
-      // console.log("鎸囧寳閽堝紑鍙戜腑")
+    flyToCurrentPosition() {
+      window.mapapi.getView().animate({
+        // 鍙缃渶瑕佺殑灞炴�у嵆鍙�
+        center: window.personalPoi, // 涓績鐐�
+        projection: "EPSG:3857",
+        zoom: 17, // 缂╂斁绾у埆
+        rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害
+        duration: 1500, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃�
+      });
     },
   },
 };

--
Gitblit v1.9.3