feat:对接首页地图异常提示数据

This commit is contained in:
张先生
2025-03-13 21:19:59 +08:00
parent 3651b4e0a9
commit a7b4f42df0
4 changed files with 2402 additions and 856 deletions

View File

@@ -32,10 +32,15 @@
<div class="rela">
<div class="alarm-box">
<ul class="flex">
<li class="alarm-item" v-for="(item, index) in list" :key="index">
<img class="alarm-item__icon" :src="item.icon" />
<span>{{ item.label }}</span>
</li>
<template v-for="(item, index) in homeStore.notifyInfo">
<li v-if="item.value > 0" class="alarm-item" :key="index">
<img v-if="index == 0" class="alarm-item__icon" :src="icon8" />
<img v-if="index == 1" class="alarm-item__icon" :src="icon9" />
<img v-if="index == 2" class="alarm-item__icon" :src="icon10" />
<img v-if="index == 3" class="alarm-item__icon" :src="icon11" />
<span>{{ item.name }}</span>
</li>
</template>
</ul>
</div>
<div class="map" id="map" />
@@ -132,8 +137,6 @@
import icon9 from '@/assets/images/icon-9.png'
import icon10 from '@/assets/images/icon-10.png'
import icon11 from '@/assets/images/icon-11.png'
import carIcon from '@/assets/images/car.png'
import shipIcon from '@/assets/images/ship.png'
import { useMap } from '@/hooks/map'
import { useHomeStore } from '@/stores/home'
@@ -142,59 +145,10 @@
let emit = defineEmits(['switch-spot'])
const { map, marker, initMap, addMarker, clearOverlays } = useMap()
const { map, initMap } = useMap()
let spotList = ref([])
let list = ref([
{
label: '安全异常',
icon: icon8
},
{
label: '排队异常',
icon: icon9
},
{
label: '停车异常',
icon: icon10
},
{
label: '舆论异常',
icon: icon11
}
])
let current = ref(0)
let markers = []
let timter = null
watch(
() => [map.value, homeStore.carShipData],
() => {
return
if (map.value && homeStore.carShipData) {
// clearOverlays()
markers.forEach((item) => {
map.value.removeOverlay(item) // 移除每个标记
})
homeStore.carShipData?.car?.list.map((item) => {
if (item.lng && item.lat) {
addMarker(carIcon, [item.lng, item.lat], [36, 50])
markers.push(marker.value)
}
})
homeStore.carShipData?.ship?.list.map((item) => {
if (item.lng && item.lat) {
addMarker(shipIcon, [item.lng, item.lat], [36, 50])
markers.push(marker.value)
}
})
}
},
{
immediate: true
}
)
const handleMap = (e) => {
emit('switch-spot', e)
// map.value.centerAndZoom(new BMapGL.Point('108.704166', '30.94776'), 16)
@@ -314,9 +268,6 @@
onMounted(() => {
getSpotList()
})
// onUnmounted(() => {
// if (timer) clearInterval(timer)
// })
</script>
<style lang="scss" scoped>