// wx.config({ // debug: true, // appId: 'wxa3991865de920847', // timestamp: 1583378561, // nonceStr: '', // signature: '7c909d41d5f99a35fd9d39c179dae233b001678d', // jsApiList: [ // // 所有要调用的 API 都要加到这个列表中 // 'getLocation', // ] // }); function getLocation() { wx.getLocation({ type: 'wgs84', success: function (res) { // alert(JSON.stringify(res)); var geocoder = new qq.maps.Geocoder({ complete: function (result) { if ('当阳市' === result.detail.addressComponents.district) { autoLocal='当阳市'; } else { autoLocal = result.detail.addressComponents.city; } autoAddr = result.detail.address; // alert(result.detail.address) console.log(result); } }) var coord = new qq.maps.LatLng(res.latitude, res.longitude) geocoder.getAddress(coord) }, cancel: function (res) { alert('用户拒绝授权获取地理位置'); } }); }