增加自动亮色/暗色主题切换 + 清理 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:
co-authored by
Claude Fable 5
parent
2f9b1a8eb2
commit
4522421293
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState, useRef, useMemo, useCallback } from 'react';
|
||||
import {
|
||||
Table, Button, Select, message, Tag, Space, Spin, InputNumber, Tooltip, Popconfirm,
|
||||
Table, Button, Select, message, Tag, Space, Spin, InputNumber, Tooltip, Popconfirm, theme,
|
||||
} from 'antd';
|
||||
import { PlayCircleOutlined, StopOutlined, FilterOutlined, ThunderboltOutlined, ReloadOutlined, DownOutlined, UpOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { accountApi, loginApi } from '../api/modules';
|
||||
@@ -39,6 +39,8 @@ export default function LoginTasksPage() {
|
||||
const logEndRef = useRef<HTMLDivElement | null>(null);
|
||||
const user = getUser();
|
||||
|
||||
const { token } = theme.useToken();
|
||||
|
||||
const canBatch = hasPerm(user, 'login:batch');
|
||||
|
||||
// 从账号中提取所有标签
|
||||
@@ -259,7 +261,7 @@ export default function LoginTasksPage() {
|
||||
return (
|
||||
<div style={{ height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
|
||||
{/* 标题 + 筛选栏 */}
|
||||
<div style={{ flexShrink: 0, paddingBottom: 8, borderBottom: '1px solid #f0f0f0' }}>
|
||||
<div style={{ flexShrink: 0, paddingBottom: 8, borderBottom: `1px solid ${token.colorBorderSecondary}` }}>
|
||||
<h2 style={{ marginTop: 0, marginBottom: 6 }}>登录任务</h2>
|
||||
{canBatch && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
|
||||
@@ -314,7 +316,7 @@ export default function LoginTasksPage() {
|
||||
}}
|
||||
dropdownRender={(menu) => (
|
||||
<>
|
||||
<div style={{ padding: '4px 8px', borderBottom: '1px solid #f0f0f0', display: 'flex', gap: 8 }}>
|
||||
<div style={{ padding: '4px 8px', borderBottom: `1px solid ${token.colorBorderSecondary}`, display: 'flex', gap: 8 }}>
|
||||
<Button size="small" type="link" onClick={() => { setSelectedIds(accounts.map((a) => a.id)); setSelectedTags([]); }}>
|
||||
全选 ({accounts.length})
|
||||
</Button>
|
||||
@@ -327,13 +329,13 @@ export default function LoginTasksPage() {
|
||||
)}
|
||||
/>
|
||||
{selectedTags.length > 0 && (
|
||||
<span style={{ color: '#888', fontSize: 12, whiteSpace: 'nowrap' }}>
|
||||
<span style={{ color: token.colorTextSecondary, fontSize: 12, whiteSpace: 'nowrap' }}>
|
||||
标签选中 {accounts.filter((a) => selectedTags.includes((a.tag || '').trim())).length} 个
|
||||
</span>
|
||||
)}
|
||||
<Tooltip title="同时登录的账号数,1为顺序执行">
|
||||
<Space size={4}>
|
||||
<ThunderboltOutlined style={{ color: '#888' }} />
|
||||
<ThunderboltOutlined style={{ color: token.colorTextSecondary }} />
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={10}
|
||||
@@ -366,10 +368,10 @@ export default function LoginTasksPage() {
|
||||
{/* 概览 + 任务列表区域 */}
|
||||
<div style={{ flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column', paddingTop: 6 }}>
|
||||
{/* 概览 */}
|
||||
<div style={{ flexShrink: 0, display: 'flex', alignItems: 'center', gap: 16, fontSize: 13, color: '#666', padding: '4px 0' }}>
|
||||
<div style={{ flexShrink: 0, display: 'flex', alignItems: 'center', gap: 16, fontSize: 13, color: token.colorTextSecondary, padding: '4px 0' }}>
|
||||
<span>共 <b>{tasks.length}</b> 个任务</span>
|
||||
<span>成功 <b style={{ color: '#3f8600' }}>{successCount}</b></span>
|
||||
<span>失败 <b style={{ color: '#cf1322' }}>{failedCount}</b></span>
|
||||
<span>成功 <b style={{ color: token.colorSuccess }}>{successCount}</b></span>
|
||||
<span>失败 <b style={{ color: token.colorError }}>{failedCount}</b></span>
|
||||
{batchId && <span>批次: <b>{batchId}</b></span>}
|
||||
<div style={{ flex: 1 }} />
|
||||
{selectedRowKeys.length > 0 && (
|
||||
@@ -410,14 +412,14 @@ export default function LoginTasksPage() {
|
||||
</div>
|
||||
|
||||
{/* 实时日志 - 底部可折叠 */}
|
||||
<div style={{ flexShrink: 0, borderTop: '1px solid #f0f0f0', marginTop: 4 }}>
|
||||
<div style={{ flexShrink: 0, borderTop: `1px solid ${token.colorBorderSecondary}`, marginTop: 4 }}>
|
||||
<div
|
||||
style={{ display: 'flex', alignItems: 'center', cursor: 'pointer', padding: '4px 0', userSelect: 'none' }}
|
||||
onClick={() => setLogVisible((v) => !v)}
|
||||
>
|
||||
<span style={{ fontWeight: 500, fontSize: 13 }}>实时日志</span>
|
||||
{logVisible ? <UpOutlined style={{ marginLeft: 6, fontSize: 10 }} /> : <DownOutlined style={{ marginLeft: 6, fontSize: 10 }} />}
|
||||
{logs.length > 0 && <span style={{ marginLeft: 8, fontSize: 12, color: '#999' }}>{logs.length} 条</span>}
|
||||
{logs.length > 0 && <span style={{ marginLeft: 8, fontSize: 12, color: token.colorTextTertiary }}>{logs.length} 条</span>}
|
||||
{wsConnected && <Tag color="processing" style={{ marginLeft: 8 }}>连接中</Tag>}
|
||||
</div>
|
||||
{logVisible && (
|
||||
@@ -428,7 +430,7 @@ export default function LoginTasksPage() {
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 12,
|
||||
padding: 4,
|
||||
backgroundColor: '#fafafa',
|
||||
backgroundColor: token.colorBgLayout,
|
||||
borderRadius: 4,
|
||||
}}
|
||||
>
|
||||
@@ -440,10 +442,10 @@ export default function LoginTasksPage() {
|
||||
key={i}
|
||||
style={{
|
||||
color:
|
||||
log.level === 'error' ? '#ff4d4f' :
|
||||
log.level === 'success' ? '#52c41a' :
|
||||
log.level === 'warning' ? '#fa8c16' :
|
||||
'rgba(0,0,0,0.65)',
|
||||
log.level === 'error' ? token.colorError :
|
||||
log.level === 'success' ? token.colorSuccess :
|
||||
log.level === 'warning' ? token.colorWarning :
|
||||
token.colorText,
|
||||
}}
|
||||
>
|
||||
{log.message}
|
||||
|
||||
Reference in New Issue
Block a user