【类 型】: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> <template>
<div class="mainBox flex ofh column no-select"> <div class="mainBox flex column no-select">
<!-- 心跳 --> <!-- 心跳 -->
<div class="flex"> <div class="flex">
<div class="tag flex mac mc iconfont" <div class="tag flex mac mc iconfont"
@ -13,21 +13,33 @@
</div> </div>
<!-- 飞机模式 --> <!-- 飞机模式 -->
<div class="flex"> <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 class="tag flex mac mc iconfont icon-moshixuanze">
</div> </div>
</div> </div>
<!-- 卫星 --> <!-- 卫星 -->
<div class="flex"> <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 class="tag flex mac mc iconfont icon-weixing">
</div> </div>
</div> </div>
<!-- 电池电压 --> <!-- 电池电压 -->
<div class="flex"> <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 class="tag flex mac mc iconfont icon-dianya1">
</div> </div>
</div> </div>
<!-- 电池电流 --> <!-- 电池电流 -->
<div class="flex"> <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 class="tag flex mac mc iconfont icon-dianliu">
</div> </div>
</div> </div>
@ -87,12 +99,44 @@ export default {
} }
return true return true
}, },
//
planeMode () {
if (this.plane && this.plane.planeState) {
return this.plane.planeState.getPlaneMode
}
return null
},
// //
satCount () { satCount () {
if (this.plane && this.plane.planeState) { if (this.plane && this.plane.planeState) {
return this.plane.planeState.satCount return this.plane.planeState.satCount
} }
return 0 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: { watch: {
@ -118,9 +162,6 @@ export default {
}, },
created () { created () {
setInterval(() => {
console.log(this.plane.planeState)
}, 2000)
} }
} }
</script> </script>
@ -130,10 +171,12 @@ export default {
.mainBox { .mainBox {
position: absolute; position: absolute;
width: 29px;
top: 40px; top: 40px;
left: 10px; left: 10px;
z-index: 90; z-index: 90;
box-shadow: 0 1px 3px rgba(0, 0, 0, .3); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
background-color: white;
border-radius: 4px; border-radius: 4px;
} }
@ -144,10 +187,23 @@ export default {
.tag { .tag {
height: 29px; height: 29px;
min-width: 29px; min-width: 29px;
background-color: white;
cursor: pointer; cursor: pointer;
border: 0; border: 0;
overflow: hidden;
font-size: 22px; 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> </style>

View File

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