算法分析样式修改

This commit is contained in:
mmc
2026-05-21 13:05:31 +08:00
parent bdaa0c352a
commit bff4f55f56

View File

@@ -11,7 +11,7 @@ import {
PlayCircleOutlined, FileTextOutlined, HistoryOutlined,
SearchOutlined, SettingOutlined, FullscreenOutlined,
UploadOutlined, LoadingOutlined, CheckOutlined,
SyncOutlined
SyncOutlined, DatabaseOutlined
} from '@ant-design/icons';
import {
getDetectModels,
@@ -211,49 +211,113 @@ export default function Agri() {
setHistory(prev => [newItem, ...prev]);
};
// 渲染统计卡片
// 替换成这个 renderStats
const renderStats = () => (
<Row gutter={[8, 8]} style={{ marginBottom: 12 }}>
<Col span={6}>
<Card bordered={false} bodyStyle={{ padding: '12px' }}>
<Statistic
title={<Text type="secondary" style={{ fontSize: 12 }}>算法数量</Text>}
value={2}
suffix={<Text type="secondary" style={{ fontSize: 11 }}>检测 + 分割</Text>}
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }}
/>
</Card>
</Col>
<Col span={6}>
<Card bordered={false} bodyStyle={{ padding: '12px' }}>
<Statistic
title={<Text type="secondary" style={{ fontSize: 12 }}>在线服务</Text>}
value={2}
suffix={<Text type="secondary" style={{ fontSize: 11 }}>health 实时检查</Text>}
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }}
/>
</Card>
</Col>
<Col span={6}>
<Card bordered={false} bodyStyle={{ padding: '12px' }}>
<Statistic
title={<Text type="secondary" style={{ fontSize: 12 }}>模型数量</Text>}
value={models.length || 3}
suffix={<Text type="secondary" style={{ fontSize: 11 }}>检测模型 registry</Text>}
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }}
/>
</Card>
</Col>
<Col span={6}>
<Card bordered={false} bodyStyle={{ padding: '12px' }}>
<Statistic
title={<Text type="secondary" style={{ fontSize: 12 }}>历史记录</Text>}
value={history.length}
suffix={<Text type="secondary" style={{ fontSize: 11 }}>本页联调记录</Text>}
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }}
/>
</Card>
</Col>
<Row gutter={[8, 8]} style={{ marginBottom: 8 }}>
{[
{
title: '算法数量',
value: '2',
unit: '检测 + 分割',
icon: <AppstoreOutlined />,
color: '#165DFF',
bg: '#E8F3FF',
},
{
title: '在线服务',
value: '2',
unit: 'health 实时检查',
icon: <CloudOutlined />,
color: '#00B42A',
bg: '#E8FFEA',
},
{
title: '模型数量',
value: models.length || 3,
unit: '检测模型 registry',
icon: <DatabaseOutlined />,
color: '#165DFF',
bg: '#E8F3FF',
},
{
title: '历史记录',
value: history.length,
unit: '本页联调记录',
icon: <HistoryOutlined />,
color: '#722ED1',
bg: '#F3E8FF',
},
].map((item, index) => (
<Col key={index} xs={24} sm={12} md={12} xl={6}>
<Card
bordered={false}
bodyStyle={{ padding: '20px 16px' }}
style={{ height: '100%' }}
>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'flex-start',
}}
>
<div style={{ flex: 1 }}>
<div
style={{
fontSize: 'clamp(12px, 0.8vw, 13px)',
color: '#86909C',
marginBottom: 8,
whiteSpace: 'nowrap',
}}
>
{item.title}
</div>
<div
style={{
fontSize: 'clamp(20px, 1.4vw, 24px)',
fontWeight: 800,
color: item.color,
display: 'flex',
alignItems: 'baseline',
gap: 4,
}}
>
{item.value}
{item.unit && (
<span
style={{
fontSize: 13,
fontWeight: 400,
color: '#86909C',
}}
>
{item.unit}
</span>
)}
</div>
</div>
<div
style={{
width: 44,
height: 44,
background: item.bg,
borderRadius: '12px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexShrink: 0,
boxShadow: `0 4px 10px ${item.bg}80`,
}}
>
{React.cloneElement(item.icon, {
style: { fontSize: 22, color: item.color },
})}
</div>
</div>
</Card>
</Col>
))}
</Row>
);
@@ -613,11 +677,18 @@ export default function Agri() {
return (
<div style={{ padding: '8px', background: '#f4f7f9', minHeight: '100vh' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', paddingBottom: "16px" }}>
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', color: '#1D2129' }}>
算法分析中心
</Typography.Title>
</div>
{renderStats()}
<Row gutter={12}>
<Row gutter={12} style={{ flexWrap: 'wrap' }}>
{/* 左侧:算法列表 */}
<Col span={5}>
<Col xs={24} sm={12} md={12} lg={4}>
<Card
title={<Text strong style={{ fontSize: 14 }}>算法列表</Text>}
bordered={false}
@@ -654,7 +725,7 @@ export default function Agri() {
</Col>
{/* 中间:工作区 */}
<Col span={14}>
<Col xs={24} sm={24} md={12} lg={14}>
<Card
title={
<Space>
@@ -683,7 +754,7 @@ export default function Agri() {
</Col>
{/* 右侧:历史记录 */}
<Col span={5}>
<Col xs={24} sm={12} md={12} lg={6}>
<Card
title={<Text strong style={{ fontSize: 14 }}>历史分析记录</Text>}
bordered={false}