【类 型】:fix

【原  因】:1  地图组件经纬度反了  2.概况状态 总时长now不能实时更新 更为用setInterval
【过  程】:
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
air 2025-06-25 20:21:10 +08:00
parent a7b37c27c8
commit 93d7dc044d
2 changed files with 13 additions and 15 deletions

View File

@ -1043,8 +1043,8 @@ export default {
<p><strong>电压:</strong> ${stateObj.voltagBattery ?? '--'} V</p>
<p><strong>电流:</strong> ${stateObj.currentBattery ?? '--'} A</p>
<p><strong>高度:</strong> ${lastPos[2] ?? '--'} </p>
<p><strong>:</strong> ${lastPos[0] ?? '--'}°</p>
<p><strong>:</strong> ${lastPos[1] ?? '--'}°</p>
<p><strong>:</strong> ${lastPos[0] ?? '--'}°</p>
<p><strong>:</strong> ${lastPos[1] ?? '--'}°</p>
<p><strong>对地速度:</strong> ${stateObj.groundSpeed ?? '--'} /</p>
`

View File

@ -44,6 +44,8 @@ export default {
name: 'Statistics',
data () {
return {
now: Math.floor(Date.now() / 1000), //
timer: null
}
},
props: {
@ -52,8 +54,6 @@ export default {
deep: true
}
},
components: {
},
computed: {
totalCount () {
return Object.keys(this.planes || {}).length
@ -62,13 +62,12 @@ export default {
return Object.values(this.planes || {}).filter(p => p.planeState?.online).length
},
totalWorkingDuration () {
// - startTime
const now = Math.floor(Date.now() / 1000)
// 使 this.now
return Object.values(this.planes || {}).reduce((total, p) => {
const s = p.planeState?.flyDataSave?.startTime
const isUnlock = p.planeState?.isUnlock
if (isUnlock && s) {
return total + (now - s)
return total + (this.now - s)
}
return total
}, 0)
@ -101,19 +100,18 @@ export default {
const s = (sec % 60).toString().padStart(2, '0')
return `${h}:${m}:${s}`
}
},
watch: {
},
methods: {
},
created () {
// now computed
this.timer = setInterval(() => {
this.now = Math.floor(Date.now() / 1000)
}, 1000)
},
destroyed () {
beforeDestroy () {
clearInterval(this.timer)
}
}
}
</script>
<style lang="scss" scoped>