From 2d4afa25d167bc158b6ca4fb3a5d09dec1f0ec6e Mon Sep 17 00:00:00 2001
From: guanqp <2634859599@qq.com>
Date: Tue, 19 Jul 2022 18:21:04 +0800
Subject: [PATCH] 更改

---
 src/store/modules/mobilePosition.js |  122 ++++++++++++++++++++--------------------
 1 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/store/modules/mobilePosition.js b/src/store/modules/mobilePosition.js
index a6ebee9..50f08f1 100644
--- a/src/store/modules/mobilePosition.js
+++ b/src/store/modules/mobilePosition.js
@@ -1,51 +1,51 @@
 import {
   Message
-} from "element-ui";
+} from 'element-ui'
 // import BMap from "./mobilePositionLID";
-import RemoGeoLocation from "./mobilePositionLID1";
+import RemoGeoLocation from './mobilePositionLID1'
 
 const mobilePosition = {
   state: {
     getSPosition: null
   },
   mutations: {
-    GET_NOWPOSITION(state, val) {
-      let outData =
+    GET_NOWPOSITION (state, val) {
+      const outData =
         val ||
         function (res) {
-          console.log(res);
-        };
-      let startTime = new Date().getTime(),
-        endTime;
-      console.log(startTime, "startTime");
-      let times = (dateBegin) => {
-        var dateDiff = new Date().getTime() - dateBegin; //时间差的毫秒数
-        var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000)); //计算出相差天数
-        var leave1 = dateDiff % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
-        var hours = Math.floor(leave1 / (3600 * 1000)); //计算出小时数
-        //计算相差分钟数
-        var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
-        var minutes = Math.floor(leave2 / (60 * 1000)); //计算相差分钟数
-        //计算相差秒数
-        var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
-        var seconds = Math.round(leave3 / 1000);
-        var leave4 = leave3 % (60 * 1000); //计算分钟数后剩余的毫秒数
-        var minseconds = Math.round(leave4 / 1000);
+          console.log(res)
+        }
+      const startTime = new Date().getTime()
+        let endTime
+      console.log(startTime, 'startTime')
+      const times = (dateBegin) => {
+        var dateDiff = new Date().getTime() - dateBegin // 时间差的毫秒数
+        var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000)) // 计算出相差天数
+        var leave1 = dateDiff % (24 * 3600 * 1000) // 计算天数后剩余的毫秒数
+        var hours = Math.floor(leave1 / (3600 * 1000)) // 计算出小时数
+        // 计算相差分钟数
+        var leave2 = leave1 % (3600 * 1000) // 计算小时数后剩余的毫秒数
+        var minutes = Math.floor(leave2 / (60 * 1000)) // 计算相差分钟数
+        // 计算相差秒数
+        var leave3 = leave2 % (60 * 1000) // 计算分钟数后剩余的毫秒数
+        var seconds = Math.round(leave3 / 1000)
+        var leave4 = leave3 % (60 * 1000) // 计算分钟数后剩余的毫秒数
+        var minseconds = Math.round(leave4 / 1000)
         var timeFn =
-          "耗时:" +
+          '耗时:' +
           dayDiff +
-          "天 " +
+          '天 ' +
           hours +
-          "小时 " +
+          '小时 ' +
           minutes +
-          " 分钟" +
+          ' 分钟' +
           seconds +
-          " 秒" +
+          ' 秒' +
           minseconds +
-          "毫秒";
-        console.log(timeFn);
-        return timeFn;
-      };
+          '毫秒'
+        console.log(timeFn)
+        return timeFn
+      }
       if (navigator.geolocation) {
         // let success = function (position) {
         //   console.log(position);
@@ -147,7 +147,7 @@
         // }
         // return
         // console.log(BMap);
-        //百度定位
+        // 百度定位
         //       <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=zTNaMXHcfGsG0nFvwd6G72aMOo98uzH2">
         // </script>
         // var geolocation = new BMap.Geolocation();
@@ -244,13 +244,13 @@
         // });
         window.AMap.plugin('AMap.Geolocation', function () {
           var geolocation = new AMap.Geolocation({
-            enableHighAccuracy: true, //是否使用高精度定位,默认:true
+            enableHighAccuracy: true // 是否使用高精度定位,默认:true
             // timeout: 10000, //超过10秒后停止定位,默认:5s
             // buttonPosition: 'RB', //定位按钮的停靠位置
             // buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
             // zoomToAccuracy: true, //定位成功后是否自动调整地图视野到定位点
 
-          });
+          })
           // map.addControl(geolocation);
           geolocation.getCurrentPosition(function (status, result) {
             if (status == 'complete') {
@@ -258,15 +258,15 @@
             } else {
               onError(result)
             }
-          });
-        });
-        //解析定位结果
-        function onComplete(data) {
+          })
+        })
+        // 解析定位结果
+        function onComplete (data) {
           // let lngLat = [data.position.lng, data.position.lat]
           // console.log(position);
           // times(startTime);
-          var lat = data.position.lat;
-          var lon = data.position.lng;
+          var lat = data.position.lat
+          var lon = data.position.lng
           // console.log("成功返回经纬度信息");
           // Message({
           //   showClose: true,
@@ -279,45 +279,45 @@
           //   type: "success",
           //   duration: 2000,
           // });
-          console.log(lon, lat, "成功");
-          outData([lon, lat]);
+          console.log(lon, lat, '成功')
+          outData([lon, lat])
         }
-        //解析定位错误信息
-        function onError(data) {
+        // 解析定位错误信息
+        function onError (data) {
           // console.log(data, "see")
           Message({
             showClose: true,
-            message: "未开启位置权限",
-            type: "error",
-            duration: 2000,
-          });
+            message: '未开启位置权限',
+            type: 'error',
+            duration: 2000
+          })
         }
 
-        return;
+        return
         state.getSPosition = navigator.geolocation.getCurrentPosition(
           success,
           error,
           options
-        );
+        )
       } else {
-        console.log("不支持navigator.geolocation");
+        console.log('不支持navigator.geolocation')
         Message({
           showClose: true,
-          message: "不支持定位",
-          type: "warning",
-          duration: 0,
-        });
-        return "不支持navigator.geolocation";
+          message: '不支持定位',
+          type: 'warning',
+          duration: 0
+        })
+        return '不支持navigator.geolocation'
       }
     },
-    CLOSE_NOWPOSITION(state) {
+    CLOSE_NOWPOSITION (state) {
       // if (state.getSPosition && navigator.geolocation) {
       //   navigator.geolocation.clearWatch(state.getSPosition);
       //   state.getSPosition = null;
       // }
-    },
+    }
   },
-  actions: {},
-};
+  actions: {}
+}
 
-export default mobilePosition;
\ No newline at end of file
+export default mobilePosition

--
Gitblit v1.9.3