From 273fb7909d8dadf61e503366099b2d0332da36b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E6=B4=81?= <209192278@qq.com> Date: Sun, 5 Nov 2023 01:36:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=93=E6=B4=81=20:=20=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/map/map.vue | 106 +++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 35 deletions(-) diff --git a/pages/index/map/map.vue b/pages/index/map/map.vue index 69a70ae..6cf06d5 100644 --- a/pages/index/map/map.vue +++ b/pages/index/map/map.vue @@ -8,9 +8,12 @@ - + + + @@ -18,23 +21,39 @@ export default { data() { return { - lat: '30.57', - lng: '104.07', - marker: [] + lat: '30.48772', + lng: '104.080145', + marker: [{ + id: 1, + latitude: 30.488573, + longitude: 104.081248, + iconPath: '../../../static/map/sp_icon_dw.png', + width: '58rpx', + height: '72rpx', + rotate: 0, + alpha: 1 + }, + { + id: 2, + latitude: 30.48772, + longitude: 104.080145, + // iconPath: '../../../static/map/sp_icon_dw.png', + width: '58rpx', + height: '72rpx', + rotate: 0, + alpha: 1 + } + ], + shopList: { + imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg', + title: '琴行铺面转让', + promotionNum: 23, + price: 5000, + date: '2023-11-02' + } } }, - async onShow() { - // await this.getLifeTypeList(); - // await this.getStatusCode() - // if (!this.lat && !this.lng) { - // await this.chooseSpot() - // } else { - // if (this.isGd) { - // await this.getPoiAround(); - // } else { - // await this.getPoiPage(); - // } - // } + onShow() { // 地图 this._mapContext = uni.createMapContext("map", this); this._mapContext.initMarkerCluster({ @@ -52,21 +71,15 @@ methods: { // 图标点击 markerClick(e) { - console.log('图标点击', e); - // let markerId = e.markerId; - // this.marker.forEach(item => { - // if (markerId === item.id) { - // if (this.isGd) { - // uni.navigateTo({ - // url: `/pages/communityLive/details?data=${item.label}&type=gd&name=${this.name}` - // }) - // } else { - // uni.navigateTo({ - // url: `/pages/communityLive/details?id=${item.id}&name=${this.name}&type=fgd` - // }) - // } - // } - // }) + console.log('标记点击', e); + let markerId = e.markerId; //点击标记点, 获取id, 查询店铺详情, 展示在下方 + this.marker.forEach(item => { + if (markerId === item.id) { + item.iconPath = "" + } else { + item.iconPath = "../../../static/map/sp_icon_dw.png" + } + }) }, } } @@ -75,7 +88,7 @@ \ No newline at end of file