master
wangxinglong 2021-12-20 16:28:03 +08:00
parent 89056b7d1c
commit 36f40d27dc
3 changed files with 41 additions and 38 deletions

View File

@ -0,0 +1,32 @@
// 经纬度逆解析成地址
//lat = 30.65805;
//lng = 104.136153;
function getAddress(lat,lng,obj){
$.ajax({
type: 'get',
url: 'http://apis.map.qq.com/ws/geocoder/v1',
dataType: 'jsonp',
data: {
key: "XJXBZ-7EBCD-2MB45-HB73N-R362T-WRFJR",//开发密钥
location: lat + "," + lng,//位置坐标
get_poi: "0",//是否返回周边POI列表1.返回0不返回(默认)
coord_type: "1",//输入的locations的坐标类型,1 GPS坐标
parameter: { "scene_type": "tohome", "poi_num": 20 },//附加控制功能
output: "jsonp"
},
success: function (data, textStatus) {
if (data.status == 0) {
var address = data.result.formatted_addresses.recommend;
//$("#address").html(address);
// console.log(data.result.address)
// console.log(address)
$(obj).text(data.result.address + address);
} else {
alert("位置获取错误,请联系管理员!")
}
},
error: function () {
alert("位置获取错误,请联系管理员!")
}
});
}

View File

@ -71,8 +71,14 @@
<!-- 列 轮播图 -->
<script type="text/html" id="row-other">
经纬度:{{ d.bill!=undefined?d.bill.lng:'' }},{{ d.bill!=undefined?d.lat:'' }}
经纬度:{{ d.bill!=undefined?d.bill.lng:'' }},{{ d.bill!=undefined?d.bill.lat:'' }}
{{# if(d.bill!=undefined ){ }}
<a onclick="getAddress({{d.bill.lat}},{{d.bill.lng}},this)" target="_blank">点击查看</a>
{{# } }}
</script>
<script src="__MANAGER__/js/business/business_deduction_list.js?v={:mt_rand()}"></script>
<script src="__MANAGER__/js/business/business_deduction_list.js?v={:mt_rand()}"></script>
<script src="__STATIC__/js/jquery-3.3.1.js?v={:mt_rand()}"></script>
<script src="__MANAGER__/js/get_addredss.js?v={:mt_rand()}"></script>

View File

@ -136,39 +136,4 @@
<script src="__MANAGER__/js/consumer/info.js?v={:mt_rand()}"></script>
<script src="__STATIC__/js/jquery-3.3.1.js?v={:mt_rand()}"></script>
<script>
// 经纬度逆解析成地址
//lat = 30.65805;
//lng = 104.136153;
function getAddress(lat,lng,obj){
$.ajax({
type: 'get',
url: 'http://apis.map.qq.com/ws/geocoder/v1',
dataType: 'jsonp',
data: {
key: "XJXBZ-7EBCD-2MB45-HB73N-R362T-WRFJR",//开发密钥
location: lat + "," + lng,//位置坐标
get_poi: "0",//是否返回周边POI列表1.返回0不返回(默认)
coord_type: "1",//输入的locations的坐标类型,1 GPS坐标
parameter: { "scene_type": "tohome", "poi_num": 20 },//附加控制功能
output: "jsonp"
},
success: function (data, textStatus) {
if (data.status == 0) {
var address = data.result.formatted_addresses.recommend;
//$("#address").html(address);
// console.log(data.result.address)
// console.log(address)
$(obj).text(data.result.address + address);
} else {
alert("位置获取错误,请联系管理员!")
}
},
error: function () {
alert("位置获取错误,请联系管理员!")
}
});
}
</script>
<script src="__MANAGER__/js/get_addredss.js?v={:mt_rand()}"></script>