优化状态界面视频停止和状态信息的解耦

This commit is contained in:
mmc
2026-08-06 14:01:33 +08:00
parent 60e910f12a
commit 3ea48dac0f

View File

@@ -1147,21 +1147,18 @@ export default function DeviceStatusPage() {
</> : null}
</Space>
<div style={{
borderRadius: 8,
overflow: 'hidden',
display: 'flex',
height: 'calc(100% - 48px)',
position: 'relative'
}}>
{robotVideo ? (
{/* 视频层:停止时不渲染 / 未播放时为空,不影响状态面板 */}
{robotVideo && isVideoPlaying && (
mowerView === 'all' ? (
<div style={{ width: '100%', height: '100%' }}>
<MowerAllView
serialNumber={device?.serialNumber}
robotVideo={robotVideo}
error={error}
ready={ready}
/>
</div>
) : (
<div style={{ position: 'relative', width: '100%', height: '100%' }}>
<VideoPlayer
@@ -1177,18 +1174,43 @@ export default function DeviceStatusPage() {
error={error}
ready={ready}
/>
{/* 单视频模式状态叠加层 */}
</div>
)
)}
{/* 视频未加载 / 停止播放的占位 */}
{(!robotVideo || !isVideoPlaying) && (
<div style={{
width: '100%', height: '100%',
display: 'flex', alignItems: 'center', justifyContent: 'center',
flexDirection: 'column', gap: 12,
color: 'rgba(14, 78, 198, 0.35)',
}}>
<VideoCameraOutlined style={{ fontSize: 56, opacity: 0.6 }} />
<div style={{ fontSize: 15 }}>
{!isVideoPlaying ? '已停止视频' : '视频加载中...'}
</div>
<div style={{ fontSize: 12, opacity: 0.7 }}>
{!isVideoPlaying ? '点击右上角「播放」按钮开启视频' : ''}
</div>
</div>
)}
{/* 单视频(非全景)模式状态叠加层:始终渲染,和视频层解耦 */}
{mowerView !== 'all' && (
<div style={{
position: 'absolute',
top: 8,
left: 8,
top: 106,
left: 20,
background: 'rgba(0,0,0,0.7)',
color: '#fff',
padding: '10px 12px',
borderRadius: 8,
fontSize: 11,
zIndex: 10,
backdropFilter: 'blur(4px)'
backdropFilter: 'blur(4px)',
boxShadow: '0 4px 16px rgba(0,0,0,0.4)',
border: '1px solid rgba(24,144,255,0.2)',
}}>
<div style={{ marginBottom: 6, fontWeight: 600, color: '#1890ff' }}>机器人状态</div>
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', gap: '3px 10px' }}>
@@ -1236,12 +1258,8 @@ export default function DeviceStatusPage() {
</div>
</div>
</div>
)
) : (
<div style={{ color: '#ccc', margin: 'auto', fontSize: 40 }}>视频加载中...</div>
)}
</div>
}
</Card>
</Col>