暂时提交

This commit is contained in:
2026-07-24 10:46:00 +08:00
parent 070f3bab4f
commit 9bf70e785e
15 changed files with 1133 additions and 630 deletions

View File

@@ -126,63 +126,107 @@
})
}
},
//获取poi列表
//获取poi列表
getAddressList(s = 0) {
//在ios下防止搜索返回时多次加载地址列表的问题
if(this.isSetTempAddress === 1){
return;
}
qqmapsdk.reverseGeocoder({
location: {
latitude: this.position.latitude,
longitude: this.position.longitude
// TODO: 接口联调时取消注释,删除 mock 数据
// qqmapsdk.reverseGeocoder({
// location: {
// latitude: this.position.latitude,
// longitude: this.position.longitude
// },
// get_poi: 1,
// poi_options: "page_size=30;page_index=1",
// success: res=> {
// res.result.pois.forEach(poi=>{
// if(!poi.ad_info){
// poi.ad_info = {
// adcode: poi.adcode,
// city: poi.city,
// district: poi.district,
// province: poi.province
// }
// }
// })
// if(this.tempAddress){
// if(this.tempAddress.title != res.result.pois[0].title){
// if(!this.tempAddress.ad_info){
// this.tempAddress.ad_info = {
// adcode: this.tempAddress.adcode,
// city: this.tempAddress.city,
// district: this.tempAddress.district,
// province: this.tempAddress.province
// }
// }
// res.result.pois.unshift(this.tempAddress);
// }
// this.tempAddress = null;
// this.isSetTempAddress = 1;
// setTimeout(()=>{
// this.isSetTempAddress = 0;
// }, 500)
// }
// if (s) {
// const ad_info = res.result.pois[0].ad_info;
// this.curCity = ad_info.city || '';
// res.result.pois[0].select = 1
// this.list = res.result.pois;
// this.checked = 0;
// } else {
// this.list = res.result.pois;
// }
// },
// fail: err=> {
// console.log(err)
// }
// })
// Mock 静态数据
const mockPois = [
{
title: '宜昌市西陵区东山大道435号',
address: '宜昌市西陵区东山大道435号',
location: { lng: 111.2842, lat: 30.7086 },
ad_info: { adcode: '420502', city: '宜昌市', district: '西陵区', province: '湖北省' }
},
get_poi: 1,
poi_options: "page_size=30;page_index=1",
success: res=> {
res.result.pois.forEach(poi=>{
if(!poi.ad_info){
poi.ad_info = {
adcode: poi.adcode,
city: poi.city,
district: poi.district,
province: poi.province
}
}
})
//有搜索结果时,手动追加到列表顶部
if(this.tempAddress){
if(this.tempAddress.title != res.result.pois[0].title){
if(!this.tempAddress.ad_info){
this.tempAddress.ad_info = {
adcode: this.tempAddress.adcode,
city: this.tempAddress.city,
district: this.tempAddress.district,
province: this.tempAddress.province
}
}
res.result.pois.unshift(this.tempAddress);
}
this.tempAddress = null;
this.isSetTempAddress = 1;
setTimeout(()=>{
this.isSetTempAddress = 0;
}, 500)
}
if (s) {
const ad_info = res.result.pois[0].ad_info;
this.curCity = ad_info.city || '';
res.result.pois[0].select = 1
this.list = res.result.pois;
this.checked = 0;
} else {
this.list = res.result.pois;
}
{
title: '宜昌市西陵区夷陵大道418号',
address: '宜昌市西陵区夷陵大道418号',
location: { lng: 111.2900, lat: 30.7120 },
ad_info: { adcode: '420502', city: '宜昌市', district: '西陵区', province: '湖北省' }
},
fail: err=> {
console.log(err)
{
title: '宜昌市西陵区解放路88号',
address: '宜昌市西陵区解放路88号',
location: { lng: 111.2800, lat: 30.7050 },
ad_info: { adcode: '420502', city: '宜昌市', district: '西陵区', province: '湖北省' }
},
{
title: '宜昌市西陵区沿江大道168号',
address: '宜昌市西陵区沿江大道168号',
location: { lng: 111.2750, lat: 30.7000 },
ad_info: { adcode: '420502', city: '宜昌市', district: '西陵区', province: '湖北省' }
},
{
title: '宜昌市伍家岗区中南路56号',
address: '宜昌市伍家岗区中南路56号',
location: { lng: 111.3100, lat: 30.7200 },
ad_info: { adcode: '420503', city: '宜昌市', district: '伍家岗区', province: '湖北省' }
}
})
];
if (s) {
this.curCity = '宜昌市';
mockPois[0].select = 1;
this.list = mockPois;
this.checked = 0;
} else {
this.list = mockPois;
}
},
//地图区域改变
onRegionchange(e) {