添加获取公路服务区地址信息的JS方法
This commit is contained in:
parent
7d665ee664
commit
352c779b84
10
myCSS.css
Normal file
10
myCSS.css
Normal file
@ -0,0 +1,10 @@
|
||||
.myCSS.inputNum .wf-form-input input {
|
||||
text-align: right !important;
|
||||
padding-right: 7px !important;
|
||||
}
|
||||
|
||||
.myCSS.inputOnlyButtomBorder .wf-form-input input {
|
||||
border-top-style: none !important;
|
||||
border-left-style: none !important;
|
||||
border-right-style: none !important;
|
||||
}
|
24
获取公路服务区地址.js
Normal file
24
获取公路服务区地址.js
Normal file
@ -0,0 +1,24 @@
|
||||
async function getExpresswayServiceAreaAddress(location_name) {
|
||||
fetch('https://restapi.amap.com/v3/geocode/geo?key=53a92850ca00d7f77aef3297effd8d59&s=rsv3&jscode=220df7c191b808547be3626cbaa9d2bf&callback=&platform=JS&logversion=2.0&appname=http%3A%2F%2F192.168.2.221%3A8088%2Fwui%2Findex.html%23%2Fmain%2Fcube%2Fsearch&csid=AE54D9C0-AC7B-469C-BB7F-F677AFB04F05&sdkversion=1.4.27&address=' + location_name)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.info == "OK") {
|
||||
let res = data.geocodes.find(e => e.province == "广东省" && e.level == "道路");
|
||||
if (res != undefined) {
|
||||
return (res.district);
|
||||
} else {
|
||||
res = data.geocodes.find(e => e.province == "广东省");
|
||||
if (res != undefined) {
|
||||
return (res.district);
|
||||
} else {
|
||||
return ("no matched");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ("no matched");
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user