From 90ae4eec8cf01c88c9ed6e0a1f9d6b76bd4a2d1a Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Thu, 7 Nov 2024 15:45:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 15 +++++-- pages/workPlan/custody/index.vue | 73 +++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 25 deletions(-) diff --git a/manifest.json b/manifest.json index 1b5337f..305393c 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,8 @@ "VideoPlayer" : {}, "Barcode" : {}, "FaceID" : {}, - "Geolocation" : {} + "Geolocation" : {}, + "Maps" : {} }, "distribute" : { "android" : { @@ -89,13 +90,19 @@ "geolocation" : { "system" : { "__platform__" : [ "ios", "android" ] + }, + "amap" : { + "name" : "amapsF2g340W", + "__platform__" : [ "android" ], + "appkey_ios" : "", + "appkey_android" : "52a219b5ada12742d4b5a1ff924928d5" } }, "maps" : { "amap" : { - "name" : "", - "appkey_ios" : "", - "appkey_android" : "" + "name" : "amapsF2g340W", + "appkey_ios" : "52a219b5ada12742d4b5a1ff924928d5", + "appkey_android" : "52a219b5ada12742d4b5a1ff924928d5" } } }, diff --git a/pages/workPlan/custody/index.vue b/pages/workPlan/custody/index.vue index 6368ffd..7ca3578 100644 --- a/pages/workPlan/custody/index.vue +++ b/pages/workPlan/custody/index.vue @@ -80,7 +80,7 @@ > - + {{ submitParams.lat }} @@ -88,7 +88,11 @@ {{ submitParams.lon }} + + 点击获取 + + @@ -249,7 +253,9 @@ export default { date: '', remark: '' }, - detailsList: [] + detailsList: [], + demoAddress: '', + demoAddress_2: '' } }, methods: { @@ -439,6 +445,17 @@ export default { if (res.resMsg == 'success') { this.riskInfo = res.obj[0] } + }, + getLocationAddress() { + const this_ = this + uni.chooseLocation({ + success: function (res) { + + this_.submitParams.address = res.address + this_.submitParams.lon = res.longitude + this_.submitParams.lat = res.latitude + } + }) } }, @@ -446,25 +463,37 @@ export default { this.getMySceneListData() this.getTodayRiskData() // 获取定位位置信息 - uni.getLocation({ - type: 'gcj02', // 默认为 gcj02,可以选择 'wgs84' - // altitude: true, - geocode: true, - success: res => { - console.log(res, '位置信息--') - const { latitude, longitude } = res - const { province, city, district, street, streetNum, poiName } = res.address + // uni.getLocation({ + // type: 'wgs84', // 默认为 gcj02,可以选择 'wgs84' + // // altitude: false, + // // geocode: true, + // success: res => { + // console.log(res, '位置信息--') + // // this.demoAddress = res + // const { latitude, longitude } = res + // // const { province, city, district, street, streetNum, poiName } = res.address - this.submitParams.lon = longitude - this.submitParams.lat = latitude - console.log(province, 'province') - this.submitParams.address = `${province}${city}${district}${street}${streetNum}${poiName}` - }, - fail: err => { - console.error('获取位置失败:', err) - uni.showToast({ title: '位置获取失败,请稍后尝试', icon: 'none' }) - } - }) + // this.submitParams.lon = longitude + // this.submitParams.lat = latitude + // // console.log(province, 'province') + // // this.submitParams.address = `${province}${city}${district}${street}${streetNum}${poiName}` + // }, + // fail: err => { + // console.error('获取位置失败:', err) + // uni.showToast({ title: '位置获取失败,请稍后尝试', icon: 'none' }) + // } + // }) + + // uni.chooseLocation({ + // success: function (res) { + // // this.demoAddress_2 = res + // console.log('获取位置--',res) + // // console.log('位置名称:' + res.name); + // // console.log('详细地址:' + res.address); + // // console.log('纬度:' + res.latitude); + // // console.log('经度:' + res.longitude); + // } + // }) const _this = this uni.$on('update', function (data) { @@ -611,9 +640,11 @@ export default { position: absolute; right: 0; top: -30px; + display: flex; + align-items: center; text { - margin-right: 46rpx; + margin-right: 16rpx; } } }