From 22b526a7ab81da32a97d866831b9177a42e34a90 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 26 Jan 2022 08:36:54 +0800
Subject: [PATCH] +定位点击后显示等待图标,

---
 src/components/mobileWindow/index.vue |   12 +++++++++++-
 src/router/axios.js                   |    8 ++++----
 src/store/modules/mobile.js           |    1 +
 src/store/modules/mobilePosition.js   |   23 ++++++++++++++---------
 4 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/components/mobileWindow/index.vue b/src/components/mobileWindow/index.vue
index a453868..e570a75 100644
--- a/src/components/mobileWindow/index.vue
+++ b/src/components/mobileWindow/index.vue
@@ -67,7 +67,9 @@
                 : item.name == '图集'
                 ? 'el-icon-data-board'
                 : item.name == '去这'
-                ? 'el-icon-finished'
+                ? quzheD
+                  ? 'el-icon-loading'
+                  : 'el-icon-finished'
                 : item.name == '视频' || item.name == '返回'
                 ? 'el-icon-video-camera-solid'
                 : ''
@@ -103,6 +105,7 @@
   watch: {
     MobileWindowChangeData() {
       this.$store.dispatch("MSET_GETAUDIOBEGIN", "notOpen");
+      this.quzheD = false;
       //数据更改
       //   this.fullscreenLoading = true;
       if (!this.MobileWindowsHide) {
@@ -243,6 +246,7 @@
       seebut: [],
       center: [],
       panoramaurl: "",
+      quzheD: false, //是否点击了去这,并不能再按,以及不应用路线导航
     };
   },
   methods: {
@@ -253,6 +257,11 @@
       let query = this.query.query;
       // console.log(query);
       if (val == "去这") {
+        if (that.quzheD) {
+          console.log("不可点击");
+          return;
+        }
+        that.quzheD = true;
         // return;
         //定位
         // console.log(this.query.query);
@@ -267,6 +276,7 @@
             fn: function (datas) {
               //获取回调路径
               that.routerS.push(datas);
+              that.quzheD = false;
               if (once) {
                 once = false;
                 //加载第一条线路
diff --git a/src/router/axios.js b/src/router/axios.js
index d13c50f..dcf919e 100644
--- a/src/router/axios.js
+++ b/src/router/axios.js
@@ -8,10 +8,10 @@
 import axios from "axios";
 let httpName = window.location.protocol + "//" + window.location.hostname;
 let url = httpName + "/apis";
-setTimeout(() => {
-  console.log(window.location);
-  console.log(url);
-}, 3000);
+// setTimeout(() => {
+//   console.log(window.location);
+//   console.log(url);
+// }, 3000);
 const service = axios.create({
   //   baseURL: 'http://192.168.0.107:83',
   // baseURL: "http://192.168.0.107:80",
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index f1fb927..cfdaa84 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -468,6 +468,7 @@
       commit("MSET_POPUPDOM", popupsDom);
     },
     closeMobileWindowsDom({ state, commit, dispatch }) {
+      commit("CLOSE_NOWPOSITION");//中断定位获取
       if (!state.MobileWindowsHide && state.popupsDom) {
         state.popupsDom.closeOur();
         commit("MSET_MOBILEWINDOWSHIDE", true);
diff --git a/src/store/modules/mobilePosition.js b/src/store/modules/mobilePosition.js
index b322220..e9045bf 100644
--- a/src/store/modules/mobilePosition.js
+++ b/src/store/modules/mobilePosition.js
@@ -1,5 +1,5 @@
 const mobilePosition = {
-  state: {},
+  state: { getSPosition: null },
   mutations: {
     GET_NOWPOSITION(state, val) {
       let outData =
@@ -10,14 +10,16 @@
       if (navigator.geolocation) {
         console.log("支持navigator.geolocation-111111111111111");
         try {
-          navigator.geolocation.getCurrentPosition(function (position) {
-            console.log(position);
-            var lat = position.coords.latitude;
-            var lon = position.coords.longitude;
-            console.log("成功返回经纬度信息");
-            console.log(lon, lat);
-            outData([lon, lat]);
-          });
+          state.getSPosition = navigator.geolocation.getCurrentPosition(
+            function (position) {
+              console.log(position);
+              var lat = position.coords.latitude;
+              var lon = position.coords.longitude;
+              console.log("成功返回经纬度信息");
+              console.log(lon, lat);
+              outData([lon, lat]);
+            }
+          );
         } catch {
           console.log("支持navigator.geolocation-需要HTTPS");
         }
@@ -26,6 +28,9 @@
         return "不支持navigator.geolocation";
       }
     },
+    CLOSE_NOWPOSITION(state) {
+      state.getSPosition = null;
+    },
   },
   actions: {},
 };

--
Gitblit v1.9.3