story#7074,地图搜索位置改动为后台接口
This commit is contained in:
@ -103,3 +103,13 @@ export function auditCarInfoAgain(data){
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 我的发布列表
|
||||||
|
export function getAddressForService(data){
|
||||||
|
return request({
|
||||||
|
url: '/base/gaodeMap/getPlaceByAddress',
|
||||||
|
method:'GET',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getAddressForService } from "@/api/secondHandCar"
|
||||||
// 获取定位, 返回 经纬度
|
// 获取定位, 返回 经纬度
|
||||||
export function getLocal(mapContext) {
|
export function getLocal(mapContext) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -46,7 +47,19 @@ export function getAddress(mapContext, lnglat) {
|
|||||||
// 输入提示
|
// 输入提示
|
||||||
export function searchFun(mapContext, cityCode, keyword) {
|
export function searchFun(mapContext, cityCode, keyword) {
|
||||||
return new Promise((resolve) => {
|
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 = {
|
var autoOptions = {
|
||||||
city: cityCode || '全国',
|
city: cityCode || '全国',
|
||||||
};
|
};
|
||||||
@ -61,7 +74,7 @@ export function searchFun(mapContext, cityCode, keyword) {
|
|||||||
resolve([])
|
resolve([])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})*/
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,13 +75,14 @@
|
|||||||
}
|
}
|
||||||
let content = '<div class="dest-position"></div>';
|
let content = '<div class="dest-position"></div>';
|
||||||
let activeObj = this.addressList[this.activeIndex];
|
let activeObj = this.addressList[this.activeIndex];
|
||||||
|
let lanLat = activeObj.location.split(',');
|
||||||
this.marker = new AMap.Marker({
|
this.marker = new AMap.Marker({
|
||||||
position: new AMap.LngLat( activeObj.location.lng, activeObj.location.lat ),
|
position: new AMap.LngLat( lanLat[0], lanLat[1] ),
|
||||||
content: content,
|
content: content,
|
||||||
offset: new AMap.Pixel(-13, -30)
|
offset: new AMap.Pixel(-13, -30)
|
||||||
});
|
});
|
||||||
this.map.add(this.marker)
|
this.map.add(this.marker)
|
||||||
this.map.setCenter([activeObj.location.lng, activeObj.location.lat])
|
this.map.setCenter([lanLat[0], lanLat[1]])
|
||||||
},
|
},
|
||||||
successHandler() {
|
successHandler() {
|
||||||
if( this.activeIndex == null ) {
|
if( this.activeIndex == null ) {
|
||||||
@ -89,10 +90,11 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let activeObj = this.addressList[this.activeIndex];
|
let activeObj = this.addressList[this.activeIndex];
|
||||||
|
let lanLat = activeObj.location.split(',');
|
||||||
let _tempObj = {
|
let _tempObj = {
|
||||||
startPoiAddress: activeObj?.district + activeObj?.address + activeObj?.name,
|
startPoiAddress: activeObj?.district + activeObj?.address + activeObj?.name,
|
||||||
startLat: activeObj?.location?.lat,
|
startLat: lanLat[0],
|
||||||
startLng: activeObj?.location?.lng,
|
startLng: lanLat[1],
|
||||||
adCode: activeObj?.adcode,
|
adCode: activeObj?.adcode,
|
||||||
}
|
}
|
||||||
sessionStorage.setItem('reportAddress', JSON.stringify(_tempObj))
|
sessionStorage.setItem('reportAddress', JSON.stringify(_tempObj))
|
||||||
|
Reference in New Issue
Block a user