story#7074,地图搜索位置改动为后台接口

This commit is contained in:
2025-08-20 17:53:07 +08:00
parent 2c94eee160
commit 1abb7ac605
3 changed files with 32 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import { getAddressForService } from "@/api/secondHandCar"
// 获取定位, 返回 经纬度
export function getLocal(mapContext) {
return new Promise((resolve, reject) => {
@ -46,7 +47,19 @@ export function getAddress(mapContext, lnglat) {
// 输入提示
export function searchFun(mapContext, cityCode, keyword) {
return new Promise((resolve) => {
mapContext.plugin('AMap.AutoComplete', function(){
getAddressForService({
city: '',
address: keyword
}).then((res) => {
if(res.code == 200) {
resolve(res?.data?.pois || [])
} else {
resolve([])
}
}).catch(() => {
resolve([])
})
/*mapContext.plugin('AMap.AutoComplete', function(){
var autoOptions = {
city: cityCode || '全国',
};
@ -61,7 +74,7 @@ export function searchFun(mapContext, cityCode, keyword) {
resolve([])
}
})
})
})*/
})
}