From a7f9fbe2fbf536cb8b18ad62c778ff804d869588 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 11 Apr 2023 06:55:39 +0000 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E4=B8=9A=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20=E5=B7=A1=E6=A3=80=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: java110 <928255095@qq.com> --- manifest.json | 8 ++- .../excuteOneInspection.vue | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) 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;