linwenxin пре 7 месеци
родитељ
комит
e85bb599f1
1 измењених фајлова са 15 додато и 24 уклоњено
  1. 15 24
      src/common/utils/common.js

+ 15 - 24
src/common/utils/common.js

@@ -238,32 +238,23 @@ export const openLocation = (options = {}) => {
 // 获取当前定位
 export const getLocation = async function () {
   return new Promise((resolve, reject) => {
-    getConfigInfo().then(configInfo => {
-      wxConfig(
-        configInfo,
-        {
-          nickName: store.state.user.name,
-          userId: store.state.user.userId
+    wxConfig(undefined, undefined, () => {
+      wx.getLocation({
+        type: 'gcj02',
+        // isHighAccuracy: true,
+        // geocode: true,
+        success: res => {
+          resolve(res)
         },
-        () => {
-          wx.getLocation({
-            type: 'gcj02',
-            // isHighAccuracy: true,
-            // geocode: true,
-            success: res => {
-              resolve(res)
-            },
-            fail: err => {
-              reject('获取当前定位失败')
-              modal({
-                title: '提示',
-                content: '获取当前定位失败',
-                showCancel: false
-              }).then(() => {})
-            }
-          })
+        fail: err => {
+          reject('获取当前定位失败')
+          modal({
+            title: '提示',
+            content: '获取当前定位失败',
+            showCancel: false
+          }).then(() => {})
         }
-      )
+      })
     })
   })
 }