BUG 25666

This commit is contained in:
aixianling
2021-12-23 15:17:41 +08:00
parent 19015f5294
commit 93e836ce24

View File

@@ -68,6 +68,41 @@
</div>
<div class="popup-btn" @click="toDetail(detailInfo.build.communityId)">查看楼栋模型</div>
</u-popup>
<u-popup v-model="buildPopup" mode="bottom" border-radius="14">
<div class="popup">
<div class="bg"/>
<div class="title">{{ building.createAddress || '' }}</div>
<div class="info-flex">
<span class="label">所属社区</span>
<span class="value">{{ building.areaName }}</span>
</div>
<div class="info-flex">
<span class="label">所属小区</span>
<span class="value">{{ building.communityName }}</span>
</div>
<div class="info-flex">
<span class="label">房屋类型</span>
<span class="value">{{ $dict.getLabel('communityBuildingType', building.buildingType) }}</span>
</div>
<div class="info-flex">
<span class="label">所属网格</span>
<span class="value" v-text="building.girdName||''"/>
</div>
<div class="info-flex">
<span class="label">网格管理员</span>
<span class="value" v-text="building.girdMemberNames||''"/>
</div>
<div class="info-flex">
<span class="label">楼栋长</span>
<span
class="value">{{ building.managerName || '' }}&nbsp;&nbsp;{{building.managerPhone || '' }}
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(detailInfo.build.managerPhone)"
class="phone-icon" v-if="detailInfo.build.managerPhone">
</span>
</div>
</div>
<div class="popup-btn" @click="toDetail(building.communityId)">查看楼栋模型</div>
</u-popup>
</div>
</template>
@@ -93,7 +128,9 @@ export default {
build: {}
},
showPop: false,
retryMapCount: 0
retryMapCount: 0,
building: {},
buildPopup: false
}
},
computed: {...mapState(['user'])},
@@ -145,7 +182,8 @@ export default {
enableDefaultStyle: false, // 关闭默认样式
geometries: points?.map(e => ({
position: new TMap.LatLng(e.lat, e.lng),
content: `${e.createAddress} | ${e.houseNum}`
content: `${e.createAddress} | ${e.houseNum}`,
properties: {...e}
})) || [],
zoomOnClick: true
})
@@ -170,53 +208,60 @@ export default {
})
} else {
//点标记样式
// 以下代码为基于DOMOverlay实现聚合点气泡
function ClusterBubble(options) {
TMap.DOMOverlay.call(this, options);
// 创建气泡DOM元素
class ClusterBubble extends TMap.DOMOverlay {
constructor(options) {
super(options);
}
onInit(options) {
this.content = options.content;
this.position = options.position;
};
onDestroy() {
this.dom.removeEventListener('click', this.onClick);
this.removeAllListeners();
}
createDOM() {
let dom = document.createElement('div');
dom.classList.add('marker');
dom.innerText = this.content;
// 监听点击事件实现zoomOnClick
this.onClick = this.onClick.bind(this);
// pc端注册click事件移动端注册touchend事件
dom.addEventListener('click', this.onClick);
dom.addEventListener('touchend', this.onClick);
return dom;
};
updateDOM() {
if (!this.map) {
return;
}
// 经纬度坐标转容器像素坐标
let pixel = this.map.projectToContainer(this.position);
// 使文本框中心点对齐经纬度坐标点
let left = pixel.getX() - this.dom.clientWidth / 2 + 'px';
let top = pixel.getY() - this.dom.clientHeight / 2 + 'px';
this.dom.style.transform = `translate(${left}, ${top})`;
this.emit('dom_updated');
};
onClick() {
this.emit('click');
}
}
ClusterBubble.prototype = new TMap.DOMOverlay();
ClusterBubble.prototype.onInit = function (options) {
this.content = options.content;
this.position = options.position;
};
// 销毁时需要删除监听器
ClusterBubble.prototype.onDestroy = function () {
this.dom.removeEventListener('click', this.onClick);
this.removeAllListeners();
};
ClusterBubble.prototype.onClick = function () {
this.emit('click');
};
// 创建气泡DOM元素
ClusterBubble.prototype.createDOM = function () {
var dom = document.createElement('div');
dom.classList.add('marker');
dom.innerText = this.content;
// 监听点击事件实现zoomOnClick
this.onClick = this.onClick.bind(this);
// pc端注册click事件移动端注册touchend事件
dom.addEventListener('click', this.onClick);
return dom;
};
ClusterBubble.prototype.updateDOM = function () {
if (!this.map) {
return;
}
// 经纬度坐标转容器像素坐标
let pixel = this.map.projectToContainer(this.position);
// 使文本框中心点对齐经纬度坐标点
let left = pixel.getX() - this.dom.clientWidth / 2 + 'px';
let top = pixel.getY() - this.dom.clientHeight / 2 + 'px';
this.dom.style.transform = `translate(${left}, ${top})`;
this.emit('dom_updated');
};
let {content} = item.geometries?.[0] || {},
overlay = new ClusterBubble({map, position: item.center, content})
overlay.on('click', () => {
map.fitBounds(item.bounds);
this.buildPopup = true
this.building = item.geometries?.[0]?.properties || {}
console.log(this.building)
})
markers.push(overlay)
}
@@ -288,7 +333,7 @@ export default {
},
getBuildingInfo(item) {
this.$http.post(`/app/appcommunityhouseinfo/queryDetailByIdWithBuilding?buildId=${item.buildingId}&houseId=${item.id}`).then(res => {
if (res.code == 0) {
if (res?.data) {
this.show = false
this.showPop = true
this.detailInfo = res.data