refactor: 大量前端页面/组件样式从硬编码颜色迁移到 antd token 主题变量

This commit is contained in:
xiamuceer-j
2026-03-06 14:14:57 +08:00
parent 7c9716b485
commit f1d7975ea4
40 changed files with 1755 additions and 1375 deletions
+12 -11
View File
@@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
import {
Card, Table, Button, Tag, Space, Modal, Form, Input, Select,
InputNumber, Switch, message, Tooltip, Popconfirm, Statistic,
Row, Col, Empty, Divider, Badge, Alert, Pagination, Dropdown
Row, Col, Empty, Divider, Badge, Alert, Pagination, Dropdown, theme
} from 'antd';
import type { MenuProps } from 'antd';
import {
@@ -73,6 +73,7 @@ export default function Foreshadows() {
// 表格容器引用,用于计算滚动高度
const tableContainerRef = useRef<HTMLDivElement>(null);
const [tableScrollY, setTableScrollY] = useState<number>(400);
const { token } = theme.useToken();
// 加载伏笔列表
const loadForeshadows = useCallback(async () => {
@@ -508,22 +509,22 @@ export default function Foreshadows() {
</Col>
<Col span={3}>
<Card size="small">
<Statistic title="待埋入" value={stats.pending} valueStyle={{ color: '#8c8c8c' }} />
<Statistic title="待埋入" value={stats.pending} valueStyle={{ color: token.colorTextSecondary }} />
</Card>
</Col>
<Col span={3}>
<Card size="small">
<Statistic title="已埋入" value={stats.planted} valueStyle={{ color: '#52c41a' }} />
<Statistic title="已埋入" value={stats.planted} valueStyle={{ color: token.colorSuccess }} />
</Card>
</Col>
<Col span={3}>
<Card size="small">
<Statistic title="已回收" value={stats.resolved} valueStyle={{ color: '#1890ff' }} />
<Statistic title="已回收" value={stats.resolved} valueStyle={{ color: token.colorPrimary }} />
</Card>
</Col>
<Col span={3}>
<Card size="small">
<Statistic title="长线伏笔" value={stats.long_term_count} valueStyle={{ color: '#722ed1' }} />
<Statistic title="长线伏笔" value={stats.long_term_count} valueStyle={{ color: token.colorInfo }} />
</Card>
</Col>
<Col span={3}>
@@ -531,7 +532,7 @@ export default function Foreshadows() {
<Statistic
title="超期未回收"
value={stats.overdue_count}
valueStyle={{ color: stats.overdue_count > 0 ? '#ff4d4f' : '#8c8c8c' }}
valueStyle={{ color: stats.overdue_count > 0 ? token.colorError : token.colorTextSecondary }}
prefix={stats.overdue_count > 0 ? <WarningOutlined /> : null}
/>
</Card>
@@ -659,12 +660,12 @@ export default function Foreshadows() {
{/* 分页器 - 固定在底部居中 */}
<div style={{
padding: '12px 0',
borderTop: '1px solid #f0f0f0',
borderTop: `1px solid ${token.colorBorderSecondary}`,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexShrink: 0,
background: '#fff',
background: token.colorBgContainer,
}}>
<Pagination
current={currentPage}
@@ -868,7 +869,7 @@ export default function Foreshadows() {
{currentForeshadow.hint_text && (
<Col span={24}>
<strong></strong>
<p style={{ marginTop: 8, whiteSpace: 'pre-wrap', color: '#666' }}>
<p style={{ marginTop: 8, whiteSpace: 'pre-wrap', color: token.colorTextSecondary }}>
{currentForeshadow.hint_text}
</p>
</Col>
@@ -877,7 +878,7 @@ export default function Foreshadows() {
{currentForeshadow.resolution_text && (
<Col span={24}>
<strong></strong>
<p style={{ marginTop: 8, whiteSpace: 'pre-wrap', color: '#666' }}>
<p style={{ marginTop: 8, whiteSpace: 'pre-wrap', color: token.colorTextSecondary }}>
{currentForeshadow.resolution_text}
</p>
</Col>
@@ -920,7 +921,7 @@ export default function Foreshadows() {
{currentForeshadow.notes && (
<Col span={24}>
<strong></strong>
<p style={{ marginTop: 8, color: '#666' }}>{currentForeshadow.notes}</p>
<p style={{ marginTop: 8, color: token.colorTextSecondary }}>{currentForeshadow.notes}</p>
</Col>
)}