去掉打印 和改接口地址
This commit is contained in:
+17
-17
@@ -50,7 +50,7 @@ export default {
|
||||
this.center.lat = e.lat
|
||||
this.center.lng = e.lng
|
||||
}
|
||||
console.log(e)
|
||||
// console.log(e)
|
||||
this.initMap()
|
||||
},
|
||||
methods:{
|
||||
@@ -76,15 +76,15 @@ export default {
|
||||
confirm(item){
|
||||
var that = this
|
||||
// var latlng = JSON.parse(JSON.stringify(place.geometry.location))
|
||||
console.log("place===", item.description)
|
||||
// console.log("place===", item.description)
|
||||
that.value = item.description
|
||||
that.cityInfo.address=item.description
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
// var address = document.getElementById("address").value;
|
||||
geocoder.geocode( { 'address': item.description}, function(results, status) {
|
||||
console.log(results)
|
||||
// console.log(results)
|
||||
var latlng = JSON.parse(JSON.stringify(results[0].geometry.location))
|
||||
console.log(latlng)
|
||||
// console.log(latlng)
|
||||
// // 将地图中心点指向用户所选位置,并设置标记
|
||||
that.map.setCenter(latlng);
|
||||
that.cityInfo.lat=latlng.lat
|
||||
@@ -140,13 +140,13 @@ export default {
|
||||
const geocoder = new google.maps.Geocoder();
|
||||
geocoder.geocode({ location: position }, (results, status) => {
|
||||
if (status === 'OK' && results[0]) {
|
||||
console.log(results)
|
||||
console.log(position)
|
||||
// console.log(results)
|
||||
// console.log(position)
|
||||
that.cityInfo.address = results[0].formatted_address;
|
||||
that.cityInfo.lat = position.lat();
|
||||
that.cityInfo.lng = position.lng();
|
||||
that.value = results[0].formatted_address;
|
||||
console.log(that.cityInfo)
|
||||
// console.log(that.cityInfo)
|
||||
} else {
|
||||
alert('无法获取地址信息');
|
||||
}
|
||||
@@ -158,17 +158,17 @@ export default {
|
||||
uni.getLocation({
|
||||
type: 'wgs84', // 默认为 wgs84 坐标系,可选 gcj02
|
||||
success: function (res) {
|
||||
console.log('当前位置的经度:' + res.longitude);
|
||||
console.log('当前位置的纬度:' + res.latitude);
|
||||
// console.log('当前位置的经度:' + res.longitude);
|
||||
// console.log('当前位置的纬度:' + res.latitude);
|
||||
that.addmapmarkfn(res.latitude,res.longitude)
|
||||
// 如果需要将经纬度转换为具体地址,可以使用逆地理编码
|
||||
// 这里调用 uni.chooseLocation 或第三方地图服务(如高德、腾讯地图)
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log('获取位置失败:', err);
|
||||
// console.log('获取位置失败:', err);
|
||||
},
|
||||
complete: function () {
|
||||
console.log('获取位置完成');
|
||||
// console.log('获取位置完成');
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -183,11 +183,11 @@ export default {
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(position) => {
|
||||
console.log('当前位置的经度:' + position.coords.longitude);
|
||||
console.log('当前位置的纬度:' + position.coords.latitude);
|
||||
// console.log('当前位置的经度:' + position.coords.longitude);
|
||||
// console.log('当前位置的纬度:' + position.coords.latitude);
|
||||
that.addmapmarkfn(position.coords.latitude,position.coords.longitude)
|
||||
this.error = '';
|
||||
console.log("获取位置成功:", position);
|
||||
// console.log("获取位置成功:", position);
|
||||
},
|
||||
(error) => {
|
||||
that.unigetLocation()
|
||||
@@ -196,7 +196,7 @@ export default {
|
||||
// title: this.error,
|
||||
// icon: 'none'
|
||||
// });
|
||||
console.error("获取位置失败:", error);
|
||||
// console.error("获取位置失败:", error);
|
||||
},
|
||||
{
|
||||
enableHighAccuracy: true,
|
||||
@@ -211,14 +211,14 @@ export default {
|
||||
// title: this.error,
|
||||
// icon: 'none'
|
||||
// });
|
||||
console.error("浏览器不支持 Geolocation API");
|
||||
// console.error("浏览器不支持 Geolocation API");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e)
|
||||
// console.log(e)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user