Quellcode durchsuchen

pc端无定位依然支持访问

zhujindu vor 1 Jahr
Ursprung
Commit
692904fc84
3 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. 3 3
      src/utils/TXApiFun.js
  2. 2 1
      src/views/deviceOutside/index.vue
  3. 2 1
      src/views/deviceWithin/index.vue

+ 3 - 3
src/utils/TXApiFun.js

@@ -8,13 +8,13 @@ const wx = Vue.prototype.wx;
 // 腾讯位置服务 key
 const TxMapKey = 'WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6';
 // 当前设备
-const isDevice = !localStorage.getItem('isDevice');
-console.log(isDevice);
+// const isDevice = localStorage.getItem('isDevice');
+// console.log(isDevice);
 
 /**
  * 获取当前定位 调用之前确保当前页面已经授权(getTicketFun)
  * */
-export function getPosition() {
+export function getPosition(isDevice) {
   return new Promise((resolve, reject) => {
     toastLoading(0, '定位中...', true);
     // PC端没有定位权限依然可以访问

+ 2 - 1
src/views/deviceOutside/index.vue

@@ -1135,7 +1135,8 @@ export default {
       });
     },
     positionFn(val) {
-      getPosition()
+      const isDevice = localStorage.getItem('isDevice');
+      getPosition(isDevice)
         .then((res) => {
           let { TXisBD } = res;
           this.lat = TXisBD.lat;

+ 2 - 1
src/views/deviceWithin/index.vue

@@ -656,7 +656,8 @@ export default {
       this.endShow = false;
       this.toastLoading(0, '加载中...', true);
       localStorage.removeItem('visitId');
-      getPosition()
+      const isDevice = localStorage.getItem('isDevice');
+      getPosition(isDevice)
         .then((res) => {
           let { TXisBD } = res;
           this.getUserInPlanListFun(TXisBD);