邓洁 : 地图

This commit is contained in:
邓洁
2023-11-05 01:36:24 +08:00
parent 50722af798
commit 273fb7909d

View File

@@ -8,9 +8,12 @@
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<map id="map" @markertap="markerClick" class="map" :markers="marker" :show-location="true" :latitude="lat" <map id="map" @markertap="markerClick" :markers="marker" :show-location="true" :latitude="lat"
:longitude="lng"></map> :longitude="lng"></map>
</view> </view>
<view class="down-shop">
<ShowShopListItem :shopInfo="shopList"></ShowShopListItem>
</view>
</view> </view>
</template> </template>
@@ -18,23 +21,39 @@
export default { export default {
data() { data() {
return { return {
lat: '30.57', lat: '30.48772',
lng: '104.07', lng: '104.080145',
marker: [] 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() { 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();
// }
// }
// 地图 // 地图
this._mapContext = uni.createMapContext("map", this); this._mapContext = uni.createMapContext("map", this);
this._mapContext.initMarkerCluster({ this._mapContext.initMarkerCluster({
@@ -52,21 +71,15 @@
methods: { methods: {
// 图标点击 // 图标点击
markerClick(e) { markerClick(e) {
console.log('标点击', e); console.log('标点击', e);
// let markerId = e.markerId; let markerId = e.markerId; //点击标记点, 获取id, 查询店铺详情, 展示在下方
// this.marker.forEach(item => { this.marker.forEach(item => {
// if (markerId === item.id) { if (markerId === item.id) {
// if (this.isGd) { item.iconPath = ""
// uni.navigateTo({ } else {
// url: `/pages/communityLive/details?data=${item.label}&type=gd&name=${this.name}` item.iconPath = "../../../static/map/sp_icon_dw.png"
// }) }
// } else { })
// uni.navigateTo({
// url: `/pages/communityLive/details?id=${item.id}&name=${this.name}&type=fgd`
// })
// }
// }
// })
}, },
} }
} }
@@ -75,7 +88,7 @@
<style lang="scss"> <style lang="scss">
.search-box { .search-box {
position: absolute; position: absolute;
z-index: 2; z-index: 1;
top: 20rpx; top: 20rpx;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
@@ -93,10 +106,33 @@
.content { .content {
width: 100%; width: 100%;
height: 460rpx; height: 460rpx;
#map {
width: 100%;
height: 100vh;
}
} }
.map { .down-shop {
width: 100%; width: 710rpx;
height: 100vh; // background-color: red;
position: absolute;
z-index: 1;
bottom: 60rpx;
left: 10%;
transform: translateX(-10%);
.list-border {
margin: 0;
padding: 20rpx 20rpx 20rpx 27rpx;
width: 94.5%;
border-radius: 7rpx;
box-shadow: 0rpx 1rpx 2rpx 0rpx rgba(224, 224, 224, 0.5), 0rpx 4rpx 12rpx 1rpx rgba(102, 102, 102, 0.37);
.rent-and-date text {
margin-right: 30rpx !important;
font-size: 24rpx;
}
}
} }
</style> </style>