Files
web-Iot/src/components/devices/mowerAllView.jsx

170 lines
4.6 KiB
React
Raw Normal View History

2026-06-15 09:20:01 +08:00
import VideoPlayer from '../VideoPlayer.tsx';
2026-07-08 10:25:11 +08:00
export function MowerAllView({ serialNumber, robotVideo, error, ready, statusData }) {
2026-06-15 09:20:01 +08:00
return (
<div style={{
2026-07-08 10:25:11 +08:00
position: 'relative',
2026-06-15 09:20:01 +08:00
width: '100%',
height: '100%',
2026-07-08 10:25:11 +08:00
overflow: 'hidden'
2026-06-15 09:20:01 +08:00
}}>
2026-07-08 10:25:11 +08:00
{/* 前视 - 铺满整个区域 */}
2026-06-16 14:28:14 +08:00
<div style={{
2026-07-08 10:25:11 +08:00
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: 1
2026-06-16 14:28:14 +08:00
}}>
2026-07-08 10:25:11 +08:00
<VideoPlayer
deviceId={serialNumber}
idx={1}
className="w-full h-full object-contain"
video={robotVideo}
error={error}
ready={ready}
/>
2026-06-16 14:28:14 +08:00
</div>
2026-06-15 09:20:01 +08:00
2026-07-08 10:25:11 +08:00
{/* 左视 - 左上角 */}
2026-06-16 14:28:14 +08:00
<div style={{
2026-07-08 10:25:11 +08:00
position: 'absolute',
top: 8,
left: 8,
width: '25%',
height: '30%',
minWidth: 120,
minHeight: 80,
zIndex: 10,
border: '1px solid #fff3',
borderRadius: 8,
overflow: 'hidden'
2026-06-16 14:28:14 +08:00
}}>
2026-07-08 10:25:11 +08:00
<VideoPlayer
deviceId={serialNumber}
idx={3}
className="w-full h-full object-contain"
video={robotVideo}
error={error}
ready={ready}
/>
2026-06-15 09:20:01 +08:00
</div>
2026-07-08 10:25:11 +08:00
{/* 右视 - 右上角 */}
<div style={{
position: 'absolute',
top: 8,
right: 8,
width: '25%',
height: '30%',
minWidth: 120,
minHeight: 80,
zIndex: 10,
border: '1px solid #fff3',
borderRadius: 8,
overflow: 'hidden'
}}>
<VideoPlayer
deviceId={serialNumber}
idx={4}
className="w-full h-full object-contain"
video={robotVideo}
error={error}
ready={ready}
/>
</div>
2026-06-16 14:28:14 +08:00
2026-07-08 10:25:11 +08:00
{/* 后视 - 底部居中 */}
2026-06-16 14:28:14 +08:00
<div style={{
2026-07-08 10:25:11 +08:00
position: 'absolute',
bottom: 8,
left: '50%',
transform: 'translateX(-50%)',
width: '30%',
height: '25%',
minWidth: 150,
minHeight: 80,
zIndex: 10,
border: '1px solid #fff3',
borderRadius: 8,
overflow: 'hidden'
2026-06-16 14:28:14 +08:00
}}>
2026-07-08 10:25:11 +08:00
<VideoPlayer
deviceId={serialNumber}
idx={2}
className="w-full h-full object-contain"
video={robotVideo}
error={error}
ready={ready}
/>
</div>
{/* 状态详情叠加层 */}
{statusData && (
2026-06-15 09:20:01 +08:00
<div style={{
2026-07-08 10:25:11 +08:00
position: 'absolute',
bottom: 8,
left: 8,
background: 'rgba(0,0,0,0.7)',
color: '#fff',
padding: '10px 12px',
2026-06-15 09:20:01 +08:00
borderRadius: 8,
2026-07-08 10:25:11 +08:00
fontSize: 11,
zIndex: 20,
backdropFilter: 'blur(4px)'
2026-06-15 09:20:01 +08:00
}}>
2026-07-08 10:25:11 +08:00
<div style={{ marginBottom: 6, fontWeight: 600, color: '#1890ff' }}>机器人状态</div>
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', gap: '3px 10px' }}>
<span>电量:</span>
<span style={{ color: (statusData.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
{statusData.battery !== undefined ? `${statusData.battery}%` : '-'}
</span>
<span>电压:</span>
<span>{statusData.voltage !== undefined ? `${Number(statusData.voltage).toFixed(2)}V` : '-'}</span>
<span>左电机:</span>
<span>{statusData.leftCurrent !== undefined ? `${Number(statusData.leftCurrent).toFixed(2)}A` : '-'}</span>
<span>右电机:</span>
<span>{statusData.rightCurrent !== undefined ? `${Number(statusData.rightCurrent).toFixed(2)}A` : '-'}</span>
<span>左速度:</span>
<span>{statusData.leftMeasureSpeed !== undefined ? `${Number(statusData.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
<span>右速度:</span>
<span>{statusData.rightMeasureSpeed !== undefined ? `${Number(statusData.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
<span>左温度:</span>
<span>{statusData.leftMotorTemp !== undefined ? `${Number(statusData.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
<span>右温度:</span>
<span>{statusData.rightMotorTemp !== undefined ? `${Number(statusData.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
<span>主控温度:</span>
<span>{statusData.chipTemp !== undefined ? `${Number(statusData.chipTemp).toFixed(1)}℃` : '-'}</span>
<span>航向角:</span>
<span>{statusData.yaw !== undefined ? `${Number(statusData.yaw).toFixed(1)}°` : '-'}</span>
<span>俯仰角:</span>
<span>{statusData.pitch !== undefined ? `${Number(statusData.pitch).toFixed(1)}°` : '-'}</span>
<span>定位:</span>
<span>
{statusData.qual == 0 ? '无效' :
statusData.qual == 1 ? 'GPS单点' :
statusData.qual == 2 ? 'DGPS差分' :
statusData.qual == 4 ? 'RTK固定' :
statusData.qual == 5 ? 'RTK浮点' : '未知'}
</span>
<span>卫星:</span>
<span>{statusData.satelliteCnt || 0}颗</span>
<span>模式:</span>
<span>
{statusData.controlMode == 1 ? '本地' :
statusData.controlMode == 3 ? '远程' : '未知'}
</span>
</div>
2026-06-15 09:20:01 +08:00
</div>
2026-07-08 10:25:11 +08:00
)}
2026-06-15 09:20:01 +08:00
</div>
)
}