地图问题处理

This commit is contained in:
BianLzhaoMin 2024-11-07 15:45:24 +08:00
parent 4d36f9769f
commit 90ae4eec8c
2 changed files with 63 additions and 25 deletions

View File

@ -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"
}
}
},

View File

@ -80,7 +80,7 @@
>
<uni-forms-item label="当前位置" required name="address">
<view class="address-content">
<u--input type="text" placeholder="请填写" v-model="submitParams.address" />
<u--textarea placeholder="请填写" autoHeight v-model="submitParams.address" />
<view class="address-info">
<text>
{{ submitParams.lat }}
@ -88,7 +88,11 @@
<text>
{{ submitParams.lon }}
</text>
<view @tap="getLocationAddress">点击获取</view>
</view>
</view>
</uni-forms-item>
<uni-forms-item label="附件上传(1-6张照片)" required>
@ -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;
}
}
}