享飞-小程序
 
 
 

214 lines
6.0 KiB

<script setup>
import { computed, ref } from 'vue';
import { Left, Right } from '@nutui/icons-vue-taro';
import deviceCruise from '../core/deviceCruise';
const isVisible = ref(true);
const info = computed(() => deviceCruise.timelyData);
// 学员信息
const studentInfo = ref({
name: '张三', // 示例数据
droneId: 'UAV-001', // 示例数据
});
// 阶段性倒计时
const countdown = ref({
phase: '起飞阶段', // 示例数据
remainingTime: '05:00', // 示例数据
});
// 实时语音播报内容
const voiceContent = ref('请注意保持安全高度');
</script>
<template>
<div :class="[s.root, { [s.hidden]: !isVisible }]">
<div class="nav">
<div :class="{ 'toggle-btn': true, 'is-active': !isVisible }" @click="() => isVisible = !isVisible">
<Right v-if="isVisible" style="font-size: 14px;" />
<Left style="font-size: 14px;" v-else />
</div>
</div>
<div class="container">
<div class="container-2">
<!-- 学员信息 -->
<div class="section">
<div class="section-title">学员信息</div>
<div class="text-row">
<span class="label">姓名:</span>
<span class="value">
<div class="value-unit">
<small class="value">{{ studentInfo.name }}</small>
</div>
</span>
</div>
<div class="text-row">
<span class="label">飞机编号:</span>
<span class="value">
<div class="value-unit">
<small class="value">{{ studentInfo.droneId }}</small>
</div>
</span>
</div>
</div>
<!-- 阶段信息 -->
<div class="section">
<div class="section-title">阶段信息</div>
<div class="text-row">
<span class="label">当前阶段:</span>
<span class="value">
<div class="value-unit">
<small class="value">{{ countdown.phase }}</small>
</div>
</span>
</div>
<div class="text-row">
<span class="label">剩余时间:</span>
<span class="value">
<div class="value-unit">
<small class="value">{{ countdown.remainingTime }}</small>
</div>
</span>
</div>
</div>
<!-- 语音播报 -->
<div class="section">
<div class="section-title">语音播报</div>
<div class="voice-content">
{{ voiceContent }}
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="less" module="s">
.root {
pointer-events: visible;
position: absolute;
right: 0px;
top: 0px;
bottom: 0px;
background-color: rgba(0, 0, 0, 0.6);
padding: 8px;
border-radius: 8px;
color: white;
font-size: 11px;
width: fit-content;
min-width: 140px;
z-index: 2;
transition: transform 0.3s ease;
&.hidden {
transform: translateX(calc(100% + 5px));
}
:global {
.container {
// box-sizing: border-box;
overflow: auto;
height: 100%;
.container-2 {
// display: flex;
// flex-direction: column;
// gap: 8px;
// padding: 4px;
height: 102%;
overflow: auto;
}
}
.nav {
position: absolute;
left: -20px;
top: 6px;
.toggle-btn {
width: 20px;
height: 20px;
cursor: pointer;
background-color: rgba(0, 0, 0, 0.6);
border-radius: 4px 0 0 4px;
display: flex;
justify-content: center;
align-items: center;
transition: all 0.3s ease;
&:hover {
background-color: rgba(0, 0, 0, 0.8);
}
&.is-active {
background-color: rgba(0, 0, 0, 0.9);
}
}
}
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
.section-title {
font-size: 12px;
font-weight: 500;
color: #fff;
margin-bottom: 6px;
padding-bottom: 4px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
}
.text-row {
margin-bottom: 4px;
display: flex;
align-items: center;
gap: 2px;
&:last-child {
margin-bottom: 0;
}
.label {
min-width: 50px;
color: rgba(255, 255, 255, 0.8);
font-size: 10px;
}
.value {
color: white;
}
.value-unit {
display: inline-flex;
align-items: baseline;
gap: 1px;
.value {
font-weight: 500;
}
small {
font-size: 0.85em;
}
}
}
.voice-content {
padding: 6px;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 4px;
font-size: 0.85em;
line-height: 1.4;
}
}
}
</style>