卡片的自适应修改

This commit is contained in:
mmc
2026-05-14 09:37:15 +08:00
parent c0e8a1cd3e
commit 2ae097eed0
10 changed files with 874 additions and 790 deletions

View File

@@ -1,4 +1,4 @@
import { useState } from 'react';
import React, { useState } from 'react';
import {
Card, Row, Col, Button, Space, Input, Select, Table, Tag, Typography, Dropdown, Menu,
Timeline
@@ -54,71 +54,100 @@ export default function VideoMonitorPage() {
<p style={{ color: '#666', margin: '4px 0 0' }}>实时视频监控、云台控制、录像回放与智能告警一体化管理</p>
</div>
{/* ========== 顶部统计卡片:统一高度 ========== */}
<Row gutter={[16, 16]} style={{ marginBottom: 16, display: 'flex', alignItems: 'stretch' }}>
<Col style={{ flex: 1 }}>
<Card bordered={false} style={{ borderRadius: 8, height: '100%' }} bodyStyle={{ padding: '16px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 24, fontWeight: 700 }}>32 台</div>
<div style={{ color: '#0837A8', fontSize: 14, marginTop: 4 }}>在线摄像头</div>
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>在线率 <span style={{ color: '#52c41a' }}>↑ 4.1%</span></div>
</div>
<VideoCameraOutlined style={{ fontSize: 28, color: '#1890ff' }} />
</div>
</Card>
</Col>
{/* 视频监控统计卡片 —— 宽高统一 + 最小宽度168px + 自动换行 */}
<Row
gutter={[16, 16]}
style={{
marginBottom: 16,
flexWrap: 'wrap',
}}
>
{[
{
title: '在线摄像头',
value: '32',
unit: '台',
sub: '在线率 ↑ 4.1%',
subColor: '#52c41a',
icon: <VideoCameraOutlined />,
color: '#1890ff',
bg: '#E8F3FF'
},
{
title: '离线摄像头',
value: '2',
unit: '台',
sub: '离线率 ↑ 5.9%',
subColor: '#ff4d4f',
icon: <VideoCameraOutlined />,
color: '#999',
bg: '#F5F7FA'
},
{
title: '今日告警事件',
value: '6',
unit: '起',
sub: '较昨日 ↑ 50%',
subColor: '#ff4d4f',
icon: <BellOutlined />,
color: '#faad14',
bg: '#FFF7E8'
},
{
title: '周界告警',
value: '2',
unit: '起',
sub: '较昨日 ↑ 100%',
subColor: '#ff4d4f',
icon: <BorderOutlined />,
color: '#ff4d4f',
bg: '#FFF1F0'
},
{
title: '存储使用率',
value: '78.6',
unit: 'TB',
sub: '使用率 65.5%',
subColor: '#52c41a',
icon: <DatabaseOutlined />,
color: '#1890ff',
bg: '#E8F3FF'
},
].map((item, index) => (
<Col key={index} style={{ minWidth: '168px', flex: '1 0 auto' }}>
<Card
bordered={false}
bodyStyle={{ padding: '16px' }}
style={{ borderRadius: 8, height: 120 }}
>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', height: '100%' }}>
<div>
<div style={{ fontSize: 14, color: '#0837A8', marginBottom: 4 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', marginBottom: 4 }}>
<span style={{ fontSize: 24, fontWeight: 700, color: '#333' }}>{item.value}</span>
<span style={{ fontSize: 14, marginLeft: 4, color: '#333' }}>{item.unit}</span>
</div>
<div style={{ fontSize: 12, color: '#999' }}>
在线率 <span style={{ color: item.subColor }}>{item.sub.replace('在线率 ', '')}</span>
</div>
</div>
<Col style={{ flex: 1 }}>
<Card bordered={false} style={{ borderRadius: 8, height: '100%' }} bodyStyle={{ padding: '16px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 24, fontWeight: 700 }}>2 台</div>
<div style={{ color: '#0837A8', fontSize: 14, marginTop: 4 }}>离线摄像头</div>
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>离线率 <span style={{ color: '#ff4d4f' }}>↑ 5.9%</span></div>
<div style={{
width: 48,
height: 48,
borderRadius: '50%',
background: item.bg,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0
}}>
{React.cloneElement(item.icon, { style: { fontSize: 24, color: item.color } })}
</div>
</div>
<VideoCameraOutlined style={{ fontSize: 28, color: '#999' }} />
</div>
</Card>
</Col>
<Col style={{ flex: 1 }}>
<Card bordered={false} style={{ borderRadius: 8, height: '100%' }} bodyStyle={{ padding: '16px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 24, fontWeight: 700 }}>6 起</div>
<div style={{ color: '#0837A8', fontSize: 14, marginTop: 4 }}>今日告警事件</div>
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>较昨日 <span style={{ color: '#ff4d4f' }}>↑ 50%</span></div>
</div>
<BellOutlined style={{ fontSize: 28, color: '#faad14' }} />
</div>
</Card>
</Col>
<Col style={{ flex: 1 }}>
<Card bordered={false} style={{ borderRadius: 8, height: '100%' }} bodyStyle={{ padding: '16px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 24, fontWeight: 700 }}>2 起</div>
<div style={{ color: '#0837A8', fontSize: 14, marginTop: 4 }}>周界告警</div>
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>较昨日 <span style={{ color: '#ff4d4f' }}>↑ 100%</span></div>
</div>
<BorderOutlined style={{ fontSize: 28, color: '#ff4d4f' }} />
</div>
</Card>
</Col>
<Col style={{ flex: 1 }}>
<Card bordered={false} style={{ borderRadius: 8, height: '100%' }} bodyStyle={{ padding: '16px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontSize: 24, fontWeight: 700 }}>78.6TB</div>
<div style={{ color: '#0837A8', fontSize: 14, marginTop: 4 }}>存储使用率</div>
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>使用率 <span style={{ color: '#52c41a' }}>65.5%</span></div>
</div>
<DatabaseOutlined style={{ fontSize: 28, color: '#1890ff' }} />
</div>
</Card>
</Col>
</Card>
</Col>
))}
</Row>
{/* ========== 视频区域 + AI:高度对齐 ========== */}