更新登录
Change-Id: I0b2663f4291f573625222995b09a99ac53c2a081
diff --git a/src/pages/Torrent/torrentAudit.tsx b/src/pages/Torrent/torrentAudit.tsx
index e90af3c..3e6a45b 100644
--- a/src/pages/Torrent/torrentAudit.tsx
+++ b/src/pages/Torrent/torrentAudit.tsx
@@ -2,7 +2,7 @@
import { useParams,useSearchParams, useNavigate } from 'react-router-dom';
import { Card, Button, Spin, Tag, message, Input } from 'antd';
import { ArrowLeftOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
-import { getTorrentInfo,auditTorrent,downloadTorrent } from '../../services/bt/index';
+import { getTorrentInfo,auditTorrent,downloadTorrent,getCategories } from '../../services/bt/index';
// 状态映射
@@ -17,7 +17,7 @@
const TorrentAudit: React.FC = () => {
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
-
+ const [categories, setCategories] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
const [torrent, setTorrent] = useState<any>(null);
const [auditLoading, setAuditLoading] = useState(false);
@@ -33,6 +33,7 @@
getTorrentInfo({ id })
.then(res => setTorrent(res.data))
.finally(() => setLoading(false));
+ getCategories().then((res) => setCategories(res.data || []));
}, [id, navigate]);
const handleDownload = async () => {
try {
@@ -68,7 +69,10 @@
setAuditLoading(false);
}
};
-
+const getCategoryName = (catId: number) => {
+ console.log('categories', catId, categories);
+ return categories.find((c) => c.id === catId)?.name || '未知分类';
+};
return (
<div style={{ minHeight: '100vh', background: '#f4f8ff', padding: 32 }}>
<div style={{ maxWidth: 800, margin: '0 auto' }}>
@@ -101,7 +105,7 @@
<>
<h2>{torrent.title}</h2>
<div style={{ marginBottom: 8 }}>
- <Tag color="blue">{torrent.categoryName || '未知分类'}</Tag>
+ <Tag color="blue">{getCategoryName(torrent.category) || '未知分类'}</Tag>
{torrent.tags?.map((tag: string) => (
<Tag key={tag}>{tag}</Tag>
))}
@@ -132,6 +136,7 @@
borderRadius: 8,
marginBottom: 24,
minHeight: 80,
+ color: '#333',
}}
dangerouslySetInnerHTML={{ __html: torrent.description || '' }}
/>