机器人设备状态布局修改
This commit is contained in:
@@ -1,123 +1,169 @@
|
||||
|
||||
import VideoPlayer from '../VideoPlayer.tsx';
|
||||
|
||||
export function MowerAllView({ serialNumber, robotVideo, error, ready }) {
|
||||
export function MowerAllView({ serialNumber, robotVideo, error, ready, statusData }) {
|
||||
return (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
gap: 8, // 三列之间间距
|
||||
padding: 8,
|
||||
boxSizing: 'border-box',
|
||||
overflow: 'auto'
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
{/* ========== 左列:左视 ========== */}
|
||||
{/* 前视 - 铺满整个区域 */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 8,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 1
|
||||
}}>
|
||||
<div style={{
|
||||
flex: 1,
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
maxHeight: 240,
|
||||
transform: 'translateY(50%)'
|
||||
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={3}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>左视</div>
|
||||
</div>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={1}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ========== 中列:上-前视 下-后视 ========== */}
|
||||
{/* 左视 - 左上角 */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 8,
|
||||
position: 'absolute',
|
||||
top: 8,
|
||||
left: 8,
|
||||
width: '25%',
|
||||
height: '30%',
|
||||
minWidth: 120,
|
||||
minHeight: 80,
|
||||
zIndex: 10,
|
||||
border: '1px solid #fff3',
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
{/* 前视 */}
|
||||
<div style={{
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
height: 240
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={1}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>前视</div>
|
||||
</div>
|
||||
{/* 后视 */}
|
||||
<div style={{
|
||||
height: 240,
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden"
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={2}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>后视</div>
|
||||
</div>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={3}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
{/* 右视 - 右上角 */}
|
||||
<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>
|
||||
|
||||
{/* 后视 - 底部居中 */}
|
||||
<div style={{
|
||||
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'
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={2}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 8,
|
||||
}}>
|
||||
<div style={{
|
||||
flex: 1,
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
maxHeight: 240,
|
||||
transform: 'translateY(50%)'
|
||||
|
||||
{/* 状态详情叠加层 */}
|
||||
{statusData && (
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
bottom: 8,
|
||||
left: 8,
|
||||
background: 'rgba(0,0,0,0.7)',
|
||||
color: '#fff',
|
||||
padding: '10px 12px',
|
||||
borderRadius: 8,
|
||||
fontSize: 11,
|
||||
zIndex: 20,
|
||||
backdropFilter: 'blur(4px)'
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={4}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>右视</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user