算法分析样式修改

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, PlayCircleOutlined, FileTextOutlined, HistoryOutlined,
SearchOutlined, SettingOutlined, FullscreenOutlined, SearchOutlined, SettingOutlined, FullscreenOutlined,
UploadOutlined, LoadingOutlined, CheckOutlined, UploadOutlined, LoadingOutlined, CheckOutlined,
SyncOutlined SyncOutlined, DatabaseOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
getDetectModels, getDetectModels,
@@ -211,49 +211,113 @@ export default function Agri() {
setHistory(prev => [newItem, ...prev]); setHistory(prev => [newItem, ...prev]);
}; };
// 渲染统计卡片
// 替换成这个 renderStats
const renderStats = () => ( const renderStats = () => (
<Row gutter={[8, 8]} style={{ marginBottom: 12 }}> <Row gutter={[8, 8]} style={{ marginBottom: 8 }}>
<Col span={6}> {[
<Card bordered={false} bodyStyle={{ padding: '12px' }}> {
<Statistic title: '算法数量',
title={<Text type="secondary" style={{ fontSize: 12 }}>算法数量</Text>} value: '2',
value={2} unit: '检测 + 分割',
suffix={<Text type="secondary" style={{ fontSize: 11 }}>检测 + 分割</Text>} icon: <AppstoreOutlined />,
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }} color: '#165DFF',
/> bg: '#E8F3FF',
</Card> },
</Col> {
<Col span={6}> title: '在线服务',
<Card bordered={false} bodyStyle={{ padding: '12px' }}> value: '2',
<Statistic unit: 'health 实时检查',
title={<Text type="secondary" style={{ fontSize: 12 }}>在线服务</Text>} icon: <CloudOutlined />,
value={2} color: '#00B42A',
suffix={<Text type="secondary" style={{ fontSize: 11 }}>health 实时检查</Text>} bg: '#E8FFEA',
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }} },
/> {
</Card> title: '模型数量',
</Col> value: models.length || 3,
<Col span={6}> unit: '检测模型 registry',
<Card bordered={false} bodyStyle={{ padding: '12px' }}> icon: <DatabaseOutlined />,
<Statistic color: '#165DFF',
title={<Text type="secondary" style={{ fontSize: 12 }}>模型数量</Text>} bg: '#E8F3FF',
value={models.length || 3} },
suffix={<Text type="secondary" style={{ fontSize: 11 }}>检测模型 registry</Text>} {
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }} title: '历史记录',
/> value: history.length,
</Card> unit: '本页联调记录',
</Col> icon: <HistoryOutlined />,
<Col span={6}> color: '#722ED1',
<Card bordered={false} bodyStyle={{ padding: '12px' }}> bg: '#F3E8FF',
<Statistic },
title={<Text type="secondary" style={{ fontSize: 12 }}>历史记录</Text>} ].map((item, index) => (
value={history.length} <Col key={index} xs={24} sm={12} md={12} xl={6}>
suffix={<Text type="secondary" style={{ fontSize: 11 }}>本页联调记录</Text>} <Card
valueStyle={{ color: '#1677ff', fontWeight: 800, fontSize: 20 }} 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> </Card>
</Col> </Col>
))}
</Row> </Row>
); );
@@ -613,11 +677,18 @@ export default function Agri() {
return ( return (
<div style={{ padding: '8px', background: '#f4f7f9', minHeight: '100vh' }}> <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()} {renderStats()}
<Row gutter={12}>
<Row gutter={12} style={{ flexWrap: 'wrap' }}>
{/* 左侧:算法列表 */} {/* 左侧:算法列表 */}
<Col span={5}> <Col xs={24} sm={12} md={12} lg={4}>
<Card <Card
title={<Text strong style={{ fontSize: 14 }}>算法列表</Text>} title={<Text strong style={{ fontSize: 14 }}>算法列表</Text>}
bordered={false} bordered={false}
@@ -654,7 +725,7 @@ export default function Agri() {
</Col> </Col>
{/* 中间:工作区 */} {/* 中间:工作区 */}
<Col span={14}> <Col xs={24} sm={24} md={12} lg={14}>
<Card <Card
title={ title={
<Space> <Space>
@@ -683,7 +754,7 @@ export default function Agri() {
</Col> </Col>
{/* 右侧:历史记录 */} {/* 右侧:历史记录 */}
<Col span={5}> <Col xs={24} sm={12} md={12} lg={6}>
<Card <Card
title={<Text strong style={{ fontSize: 14 }}>历史分析记录</Text>} title={<Text strong style={{ fontSize: 14 }}>历史分析记录</Text>}
bordered={false} bordered={false}