物业小程序支持 巡检定位

Signed-off-by: java110 <928255095@qq.com>
This commit is contained in:
java110 2023-04-11 06:55:39 +00:00 committed by Gitee
parent 5658df9a7e
commit a7f9fbe2fb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 64 additions and 1 deletions

View File

@ -63,7 +63,13 @@
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "物业员工巡检需要获取巡检地方位置"
}
},
"requiredPrivateInfos": ["getLocation"]
},
"mp-alipay" : {
"usingComponents" : true

View File

@ -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;