增加自动亮色/暗色主题切换 + 清理 pyc 文件

- 新建 store/theme.tsx: 亮色/暗色/跟随系统三种模式
- App.tsx: ThemeProvider + ConfigProvider 暗色算法
- MainLayout: 侧边栏主题切换按钮,Sider/Content 随主题变化
- 所有页面硬编码颜色替换为 antd token
- AssignmentsPage: Tag 用预设颜色名适配暗色,未选中背景用 colorBgContainer
- LoginPage: 暗色深色渐变背景
- 从 git 移除所有 __pycache__/*.pyc 文件

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
yml2213
2026-06-22 20:09:57 +08:00
co-authored by Claude Fable 5
parent 2f9b1a8eb2
commit 4522421293
26 changed files with 212 additions and 73 deletions
+12 -11
View File
@@ -1,7 +1,7 @@
import { useEffect, useState, useMemo } from 'react';
import {
Card, Table, Button, Select, Input, Tag, Row, Col, Statistic,
message, Space, Tabs, Typography, Badge,
message, Space, Tabs, Typography, Badge, theme,
} from 'antd';
import {
UserOutlined, CheckCircleOutlined, TeamOutlined,
@@ -28,6 +28,7 @@ interface AccountItem {
}
export default function AssignmentsPage() {
const { token } = theme.useToken();
const [accounts, setAccounts] = useState<AccountItem[]>([]);
const [supportUsers, setSupportUsers] = useState<SupportUser[]>([]);
const [selectedUser, setSelectedUser] = useState<SupportUser | null>(null);
@@ -219,12 +220,12 @@ export default function AssignmentsPage() {
</Col>
<Col span={6}>
<Card size="small">
<Statistic title="已分配" value={assignedCount} valueStyle={{ color: '#3f8600' }} prefix={<CheckCircleOutlined />} />
<Statistic title="已分配" value={assignedCount} valueStyle={{ color: token.colorSuccess }} prefix={<CheckCircleOutlined />} />
</Card>
</Col>
<Col span={6}>
<Card size="small">
<Statistic title="未分配" value={unassignedCount} valueStyle={{ color: '#cf1322' }} prefix={<SwapOutlined />} />
<Statistic title="未分配" value={unassignedCount} valueStyle={{ color: token.colorError }} prefix={<SwapOutlined />} />
</Card>
</Col>
<Col span={6}>
@@ -258,22 +259,22 @@ export default function AssignmentsPage() {
padding: '10px 14px',
borderRadius: 6,
cursor: 'pointer',
border: `1px solid ${isSelected ? '#1677ff' : '#f0f0f0'}`,
background: isSelected ? '#e6f4ff' : '#fff',
border: `1px solid ${isSelected ? token.colorPrimary : token.colorBorderSecondary}`,
background: isSelected ? token.colorPrimaryBg : token.colorBgContainer,
transition: 'all 0.2s',
}}
onMouseEnter={(e) => {
if (!isSelected) (e.currentTarget as HTMLElement).style.borderColor = '#1677ff';
if (!isSelected) (e.currentTarget as HTMLElement).style.borderColor = token.colorPrimary;
}}
onMouseLeave={(e) => {
if (!isSelected) (e.currentTarget as HTMLElement).style.borderColor = '#f0f0f0';
if (!isSelected) (e.currentTarget as HTMLElement).style.borderColor = token.colorBorderSecondary;
}}
>
<Space>
<UserOutlined style={{ color: '#1677ff' }} />
<UserOutlined style={{ color: token.colorPrimary }} />
<Text strong>{user.username}</Text>
</Space>
<Badge count={user.assigned_count} showZero style={{ backgroundColor: '#1677ff' }} />
<Badge count={user.assigned_count} showZero style={{ backgroundColor: token.colorPrimary }} />
</div>
);
})}
@@ -295,7 +296,7 @@ export default function AssignmentsPage() {
{selectedUser ? (
<>
<span></span>
<Tag color="#1677ff" style={{ fontSize: 14, padding: '2px 10px' }}>
<Tag color="blue" style={{ fontSize: 14, padding: '2px 10px' }}>
{selectedUser.username} {selectedUser.assigned_count}
</Tag>
</>
@@ -308,7 +309,7 @@ export default function AssignmentsPage() {
bodyStyle={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, padding: 0 }}
>
{/* 筛选栏 */}
<div style={{ padding: '8px 16px', borderBottom: '1px solid #f0f0f0', display: 'flex', gap: 8, alignItems: 'center', flexShrink: 0 }}>
<div style={{ padding: '8px 16px', borderBottom: `1px solid ${token.colorBorderSecondary}`, display: 'flex', gap: 8, alignItems: 'center', flexShrink: 0 }}>
<Input.Search
placeholder="搜索用户名"
allowClear