提交 c65a412a 作者: 翁进城

fix: 时间改为时分秒显示

上级 a502eb9e
...@@ -80,10 +80,7 @@ export default { ...@@ -80,10 +80,7 @@ export default {
}; };
}, },
flyTimeFormat() { flyTimeFormat() {
const minutes = this._uavData.flyTime; return this.convertMillisecondsToTime(this._uavData.flyTime);
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return `${hours}:${mins}`;
}, },
}, },
watch: { watch: {
...@@ -105,6 +102,19 @@ export default { ...@@ -105,6 +102,19 @@ export default {
mounted() { mounted() {
// this.stationType = this.device.stationType // this.stationType = this.device.stationType
}, },
methods: {
convertMillisecondsToTime(ms) {
const seconds = Math.floor((ms / 1000) % 60);
const minutes = Math.floor((ms / (1000 * 60)) % 60);
const hours = Math.floor((ms / (1000 * 60 * 60)) % 24);
const formattedTime = `${hours.toString().padStart(2, "0")}:${minutes
.toString()
.padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
return formattedTime;
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -391,7 +391,7 @@ const actions = { ...@@ -391,7 +391,7 @@ const actions = {
}, },
flyDistance: uavInfo.flightDistance, // 当前飞行里程 flyDistance: uavInfo.flightDistance, // 当前飞行里程
distanceToHome: uavInfo.distanceToHome, // 距离home的位置 distanceToHome: uavInfo.distanceToHome, // 距离home的位置
flyTime: uavInfo.flightTime, // 获取飞行时长,只记录飞机起飞到飞机降落的时间单位(毫秒),下次飞机起飞清零 flyTime: uavInfo.flightTime * 1000, // 获取飞行时长,只记录飞机起飞到飞机降落的时间单位(毫秒),下次飞机起飞清零
groundSpeed: uavInfo.groundSpeed, // hud地速,单位m/s, 飞行速度 groundSpeed: uavInfo.groundSpeed, // hud地速,单位m/s, 飞行速度
velocityZ: uavInfo.climbRate, // 使用NED(北-东-下)坐标系,飞机在z方向上的当前速度,以米/秒为单位, 爬升率 velocityZ: uavInfo.climbRate, // 使用NED(北-东-下)坐标系,飞机在z方向上的当前速度,以米/秒为单位, 爬升率
voltage: uavInfo.voltage, // 返回当前电池电压(V) voltage: uavInfo.voltage, // 返回当前电池电压(V)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论