diff --git a/manifest.json b/manifest.json index f933852..2ca0b41 100644 --- a/manifest.json +++ b/manifest.json @@ -63,7 +63,13 @@ "setting" : { "urlCheck" : false }, - "usingComponents" : true + "usingComponents" : true, + "permission" : { + "scope.userLocation" : { + "desc" : "物业员工巡检需要获取巡检地方位置" + } + }, + "requiredPrivateInfos": ["getLocation"] }, "mp-alipay" : { "usingComponents" : true diff --git a/pages/excuteOneInspection/excuteOneInspection.vue b/pages/excuteOneInspection/excuteOneInspection.vue index 97ce1a6..0eda1bd 100644 --- a/pages/excuteOneInspection/excuteOneInspection.vue +++ b/pages/excuteOneInspection/excuteOneInspection.vue @@ -53,6 +53,8 @@ import uploadImageAsync from "../../components/vc-upload-async/vc-upload-async.vue"; import Vue from 'vue' Vue.prototype.$preventClick = preventClick; + + import QQMapWX from '@/lib/qqmap-wx-jssdk.min.js'; export default { data() { return { @@ -103,7 +105,20 @@ success: (res) => { this.latitude = res.latitude; this.longitude = res.longitude; + + // #ifdef H5 + this.getCurrentLocation(); + + // #endiff + + + // #ifdef MP-WEIXIN + + this.getMiniWechatLocation(); + + // #endif + } }); this.taskDetailId = option.taskDetailId; @@ -157,6 +172,48 @@ that.titles = _data.data; }) }, + + getMiniWechatLocation:function(){ + + let qqmapsdk = new QQMapWX({ + + key:this.mapKey + + }); + + qqmapsdk.reverseGeocoder({ + + location: { + + latitude: this.latitude, + + longitude: this.longitude + + }, + + success:(locaRes)=>{ + + //这里能获取到地址相关信息 + + console.log(locaRes); + + // this.defaultRegionList.push(locaRes.result.ad_info.province) + + // this.defaultRegionList.push(locaRes.result.ad_info.city) + + this.reverseGeocoderSimplify = locaRes.result.address + + }, + + fail:(err)=>{ + + + + } + + }) + + }, // 地址逆解析 getCurrentLocation: function(){ let locationObj = this.latitude + ',' + this.longitude;