From 3cf0a535cafa9d0c41fc03ef27bf1983cfd681ce Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 28 Jul 2022 17:58:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(h5=20chooseLocation):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=AB=98=E5=BE=B7=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system-routes/choose-location/index.vue | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/platforms/h5/components/system-routes/choose-location/index.vue b/src/platforms/h5/components/system-routes/choose-location/index.vue index 42d3840cd..b4466a27e 100644 --- a/src/platforms/h5/components/system-routes/choose-location/index.vue +++ b/src/platforms/h5/components/system-routes/choose-location/index.vue @@ -198,7 +198,7 @@ export default { this.list.push({ name: item.title, address: item.address, - distance: item._distance, + distance: item._distance || item.distance, latitude: item.location.lat, longitude: item.location.lng }) @@ -265,6 +265,39 @@ export default { }, () => { this.loading = false }) + } else if (mapInfo.type === MapType.AMAP) { + const self = this + + window.AMap.plugin('AMap.PlaceSearch', function () { + var autoOptions = { + city: '全国', + pageSize: 10, + pageIndex: self.pageIndex + } + var placeSearch = new window.AMap.PlaceSearch(autoOptions) + if (self.searching) { + placeSearch.searchNearBy(self.keyword, [self.longitude, self.latitude], 50000, function (status, result) { + if (status === 'error') { + console.error(result) + } else if (status === 'no_data') { + self.hasNextPage = false + } else { + self.pushData(result.poiList.pois) + } + }) + } else { + placeSearch.searchNearBy('', [self.longitude, self.latitude], 5000, function (status, result) { + if (status === 'error') { + console.error(result) + } else if (status === 'no_data') { + self.hasNextPage = false + } else { + self.pushData(result.poiList.pois) + } + }) + } + self.loading = false + }) } }, loadMore () { -- GitLab