Browse Source

测试地图

peiguo 4 năm trước cách đây
mục cha
commit
dd4fa7587a
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      whepi-ui/templates/home/getLocation.js

+ 3 - 2
whepi-ui/templates/home/getLocation.js

@@ -13,13 +13,12 @@ function getLocation() {
   //return;
   wx.getLocation({
     type: 'wgs84',
-    isHighAccuracy: true,
     success: function (res) {
       // alert(JSON.stringify(res));
 
       var geocoder = new qq.maps.Geocoder({
         complete: function (result) {
-          alert(JSON.stringify(result));
+          alert(JSON.stringify(result.detail.addressComponents));
           if ('武汉市' === result.detail.addressComponents.city) {
             autoLocal = '武汉市';
             //今晚驻地
@@ -63,6 +62,8 @@ function getLocation() {
       var coord = new qq.maps.LatLng(res.latitude, res.longitude)
       longitude = res.longitude;
       latitude = res.latitude;
+      alert(longitude)
+      alert(latitude)
       $("#commit").removeAttr("disabled",true).css("pointer-events","");
       $("#commit").css("background-color","#1AAD19").css("color","#FFFFFF");
       $("#dingwei").hide();