This commit is contained in:
A1300399510 2023-07-05 16:56:47 +08:00
commit 9a7d7371fd
4 changed files with 61 additions and 7 deletions

BIN
mapFind/img/pcMarker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -98,7 +98,9 @@ Page({
//设置地图房源列表滚动条高度
mapSelectScrollTop: 0,
//是否初次加载地区
mapFirstLoading: true
mapFirstLoading: true,
platform:'',//平台
mapMarkerTime:'',//计时器
},
get_config() {
var that = this;
@ -206,6 +208,7 @@ Page({
},
callouttap(e) { //点击地图marker
let id = e.detail.markerId;
console.log(id)
let object = null;
if (this.data.headerObjTab === 'apartment') { //公寓
this.data.areaMarkerList.find((obj) => {
@ -484,15 +487,27 @@ Page({
let repeatArr={}
if (data.length) {
let dataObj = {
iconPath: "/img/lucency.png",
width: 10,
height: 10,
iconPath:this.data.platform==='windows'?"/mapFind/img/pcMarker.png":'/img/lucency.png',
width: this.data.platform==='windows'?20:0,
height: this.data.platform==='windows'?20:0,
joinCluster: this.data.headerObjTab !== 'apartment' && this.data.showPlace ? false : false,
customCallout: {
anchorY: 0,
anchorX: 0,
display: 'ALWAYS',
},
// callout: {
// content:'1',
// anchorY: 0,
// anchorX: 0,
// display: 'ALWAYS',
// },
// label:{
// content:'1',
// anchorY: 0,
// anchorX: 0,
// display: 'ALWAYS',
// }
}
data.map((res, index) => { //latitude longitude
if (this.data.showPlace || this.data.headerObjTab === 'apartment' ? true : res.count > 0) {
@ -528,13 +543,41 @@ Page({
obj=this.data.placePriceList
}
if (this.data.headerObjTab !== 'apartment' && this.data.showPlace) List = this.handleDetailData(List, setLangs)
List=this.repeatSetList(List,repeatArr)
if(this.data.headerObjTab !== 'apartment' && this.data.showPlace)List=this.repeatSetList(List,repeatArr)
console.log(List)
return {
List,
arr,
obj
}
},
// windowsMarkerSet(data,type){
// this.data.mapMarkerTime=setInterval(()=>{
// let datas=JSON.parse(JSON.stringify(data))
// while(datas.length){
// let num=Math.floor(Math.random()*datas.length)
// let markerNum=null
// let key=null
// data.map((res,index)=>{
// if(res.id===datas[num].id){
// markerNum=index
// }
// })
// key=`${type}[${markerNum}]`
// this.setData({
// [key]:{
// ...datas[num],
// alpha:datas[num].alpha?0:1
// }
// })
// datas.splice(num,1)
// }
// // this.setData({
// // markersList:data
// // })
// },500)
// },
//坐标重叠处理
repeatSetList(data,idList){
let List=JSON.parse(JSON.stringify(data))
@ -659,6 +702,7 @@ Page({
longitude:'114.13295',
})
}
// this.windowsMarkerSet(this.data.markersList,'markersList')
}
})
},
@ -807,6 +851,16 @@ Page({
this.mapCtx.on('markerClusterClick', res => {
console.log('markerClusterClick', res)
})
wx.getSystemInfo({
success: (res) => {
// windows | mac为pc端
// android | ios为手机端
this.setData({
platform:res.platform
})
console.log(res.platform)
}
});
var that = this;
// this.getMapContxt()
// this.get_config()

View File

@ -73,7 +73,7 @@
</view>
</view>
<view class="map">
<map id="map" enable-poi='true' longitude="{{longitude}}" latitude="{{latitude}}" markers="{{headerObjTab==='apartment'?areaMarkerList:showPlace?priceList:markersList}}" scale="{{mapScale}}" bindregionchange="mapViewChange" style="width: 100%; height: 100%;" bindcallouttap="callouttap" enable-scroll="{{mapEnableScroll}}" bindmarkertap="callouttap">
<map id="map" enable-poi='true' longitude="{{longitude}}" latitude="{{latitude}}" markers="{{headerObjTab==='apartment'?areaMarkerList:showPlace?priceList:markersList}}" scale="{{mapScale}}" bindregionchange="mapViewChange" style="width: 100%; height: 100%;" bindcallouttap="callouttap" enable-scroll="{{mapEnableScroll}}" bindmarkertap="callouttap" >
<cover-view slot="callout" style="position: relative;">
<block wx:for="{{headerObjTab==='apartment'?areaMarkerIds:showPlace?priceIdList:customCalloutMarkerIds}}" wx:key="index">
<cover-view class="customCallout {{headerObjTab==='apartment'||showPlace?'price-box':tabValue==='school'?'':'circles'}}" marker-id="{{item}}" wx:if="{{headerObjTab==='apartment'?true:showPlace?true:customCalloutMarkerIdsObj[item].num>0}}">

View File

@ -601,4 +601,4 @@ page {
color: #aaaaaa;
margin: 0 auto;
font-size: 21rpx;
}
}