【类 型】:feat 飞机状态组件

【原  因】:调整到左侧数列 防止横线排列显示补全问题
【过  程】:
【影  响】:
This commit is contained in:
tk 2024-07-24 20:50:34 +08:00
parent e316d1a153
commit c4f06be21d
2 changed files with 70 additions and 4 deletions

View File

@ -1,6 +1,15 @@
<template> <template>
<div> <div class="mainBox flex column ofh">
<!-- 心跳 -->
<div class="tag flex mac mc">
<div :class="online ? heartAnimation ? 'icon-heart online' : 'icon-heart1 online' : 'icon-xinsui offline'"
class="iconfont f-s-24"></div>
</div>
<!-- 卫星 -->
<div class="tag flex mac">
<div class="iconfont icon-weixing f-s-24"></div>
<div>{{ satCount }}</div>
</div>
</div> </div>
</template> </template>
@ -11,6 +20,10 @@ export default {
name: 'PlaneStatus', name: 'PlaneStatus',
data () { data () {
return { return {
/* 心跳 */
heartAnimation: false, //
online: false,
isOnlineSetTimeout: null
} }
}, },
props: { props: {
@ -20,11 +33,41 @@ export default {
} }
}, },
components: { components: {
}, },
computed: { computed: {
//
heartRandom () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.heartRandom
}
return 0
},
//
satCount () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.satCount
}
return 0
}
}, },
watch: { watch: {
heartRandom: {
handler (val) {
//
this.heartAnimation = true
setTimeout(() => {
this.heartAnimation = false
}, 500)
// 线
if (this.isOnlineSetTimeout) { // 线
clearInterval(this.isOnlineSetTimeout)
}
this.online = true
this.isOnlineSetTimeout = setTimeout(() => { // 10 线
this.online = false
}, 10000)
}
}
}, },
methods: {}, methods: {},
created () { created () {
@ -35,4 +78,24 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/styles/theme.scss"; @import "@/styles/theme.scss";
.mainBox {
position: absolute;
top: 12px;
left: 12px;
z-index: 90;
background-color: white;
border-radius: 4px;
}
.tag {
height: 29px;
min-width: 29px;
background-color: white;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
cursor: pointer;
border: 0;
overflow: hidden;
}
</style> </style>

View File

@ -3,6 +3,7 @@
<map-box ref="mapbox" :key="mapBoxKey" class="ofh"> <map-box ref="mapbox" :key="mapBoxKey" class="ofh">
<template #content> <template #content>
<BatteryStatus :plane="plane" /> <BatteryStatus :plane="plane" />
<PlaneStatus :plane="plane" />
<ControllerTabs :plane="plane" @mapXOffset="mapXOffset" @makeRoute="makeRoute" @clearRoute="clearRoute" /> <ControllerTabs :plane="plane" @mapXOffset="mapXOffset" @makeRoute="makeRoute" @clearRoute="clearRoute" />
</template> </template>
</map-box> </map-box>
@ -14,6 +15,7 @@ import mqtt from '@/utils/mqtt'
import MapBox from '@/components/MapBox' import MapBox from '@/components/MapBox'
import ControllerTabs from '@/components/ControllerTabs' import ControllerTabs from '@/components/ControllerTabs'
import BatteryStatus from '@/components/BatteryStatus' import BatteryStatus from '@/components/BatteryStatus'
import PlaneStatus from '@/components/PlaneStatus'
export default { export default {
name: 'Planes', name: 'Planes',
@ -27,7 +29,8 @@ export default {
components: { components: {
MapBox, MapBox,
ControllerTabs, ControllerTabs,
BatteryStatus BatteryStatus,
PlaneStatus
}, },
computed: { computed: {
plane () { plane () {