zhaoxiaohai 3 лет назад
Родитель
Сommit
7549e61ffd
2 измененных файлов с 29 добавлено и 0 удалено
  1. 8 0
      app.json
  2. 21 0
      packageA/saleClue/addFollow.js

+ 8 - 0
app.json

@@ -177,5 +177,13 @@
         "navigationBarTitleText": "Weixin",
         "navigationBarTextStyle": "white"
     },
+    "permission": {
+        "scope.userLocation": {
+            "desc": "您的位置信息将用于小程序位置接口的效果展示"
+        }
+    },
+    "requiredPrivateInfos": [
+        "getLocation"
+    ],
     "sitemapLocation": "sitemap.json"
 }

+ 21 - 0
packageA/saleClue/addFollow.js

@@ -17,6 +17,8 @@ Page({
         })
         this.getFollowType()
         this.init();
+
+
     },
     /* 跟进初始化 */
     init() {
@@ -50,6 +52,25 @@ Page({
                     time: res.data.createdate,
                     deleteItem: true,
                 });
+                wx.getLocation({
+                    type: 'wgs84',
+                    altitude: true,
+                    isHighAccuracy: true,
+                    success({
+                        latitude,
+                        longitude
+                    }) {
+                        console.log("获取经纬度", latitude,
+                            longitude)
+                        this.setData({
+                            "content.latitude": latitude,
+                            "content.longitude": longitude
+                        })
+                    },
+                    fail(err) {
+                        console.log(err)
+                    }
+                })
             }
         })
     },