【类 型】:feat 飞机状态标签

【原  因】:调整 飞机各个状态的显示
【过  程】:
【影  响】:
This commit is contained in:
tk 2024-08-07 20:04:57 +08:00
parent dafe9cc197
commit 76ea908a1c
2 changed files with 64 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="mainBox flex ofh column no-select">
<div class="mainBox flex column no-select">
<!-- 心跳 -->
<div class="flex">
<div class="tag flex mac mc iconfont"
@ -13,21 +13,33 @@
</div>
<!-- 飞机模式 -->
<div class="flex">
<div v-if="planeMode" class="plane-mode p-l-5 p-r-5 mc mac">
<font class="plane-mode-text">{{ planeMode }}</font>
</div>
<div class="tag flex mac mc iconfont icon-moshixuanze">
</div>
</div>
<!-- 卫星 -->
<div class="flex">
<div v-if="satCount" class="plane-mode p-l-5 p-r-5 mc mac">
<font class="plane-mode-text">{{ fixType }} {{ satCount }}</font>
</div>
<div class="tag flex mac mc iconfont icon-weixing">
</div>
</div>
<!-- 电池电压 -->
<div class="flex">
<div v-if="voltagBattery" class="plane-mode p-l-5 p-r-5 mc mac">
<font class="plane-mode-text">{{ voltagBattery }}V</font>
</div>
<div class="tag flex mac mc iconfont icon-dianya1">
</div>
</div>
<!-- 电池电流 -->
<div class="flex">
<div v-if="currentBattery " class="plane-mode p-l-5 p-r-5 mc mac">
<font class="plane-mode-text">{{ currentBattery }}A</font>
</div>
<div class="tag flex mac mc iconfont icon-dianliu">
</div>
</div>
@ -87,13 +99,45 @@ export default {
}
return true
},
//
planeMode () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.getPlaneMode
}
return null
},
//
satCount () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.satCount
}
return null
},
//
fixType () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.fixType
}
return null
},
//
voltagBattery () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.voltagBattery
}
return null
},
//
currentBattery () {
if (this.plane && this.plane.planeState) {
if (Number(this.plane.planeState.currentBattery) > 0) {
return this.plane.planeState.currentBattery
} else {
return 0
}
}
return null
}
},
watch: {
heartRandom: {
@ -118,9 +162,6 @@ export default {
},
created () {
setInterval(() => {
console.log(this.plane.planeState)
}, 2000)
}
}
</script>
@ -130,10 +171,12 @@ export default {
.mainBox {
position: absolute;
width: 29px;
top: 40px;
left: 10px;
z-index: 90;
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
background-color: white;
border-radius: 4px;
}
@ -144,10 +187,23 @@ export default {
.tag {
height: 29px;
min-width: 29px;
background-color: white;
cursor: pointer;
border: 0;
overflow: hidden;
font-size: 22px;
}
.plane-mode {
position: absolute;
left: 29px;
height: 29px;
display: flex;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
background-color: rgba(255, 255, 255, 0.5);
}
.plane-mode-text {
display: inline-block;
white-space: nowrap; /* 防止内容换行 */
}
</style>

View File

@ -89,7 +89,7 @@ export default {
for (const key in jsonData) {
if (key === 'heartBeat') {
plane.planeState.heartRandom = Math.random()// heartRandom watch
plane.planeState[key] = jsonData[key] //
plane.planeState.heartBeat = jsonData.heartBeat //
} else if (key === 'position') {
// 便
const position = JSON.parse(jsonData.position)