blob: d17f3cc56334ef7ce8a907cba79b533f4cf767fc [file] [log] [blame]
956303669a32fc2c2025-06-02 19:45:53 +08001import React from "react";
2import MovieIcon from "@mui/icons-material/Movie";
3import EmailIcon from "@mui/icons-material/Email";
4import MusicNoteIcon from "@mui/icons-material/MusicNote";
5import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople";
6import SportsEsportsIcon from "@mui/icons-material/SportsEsports";
7import SportsMartialArtsIcon from "@mui/icons-material/SportsMartialArts";
8import PersonIcon from "@mui/icons-material/Person";
9import AccountCircleIcon from "@mui/icons-material/AccountCircle";
10import "./App.css";
11import { useNavigate } from "react-router-dom";
12
13const navItems = [
14 { label: "电影", icon: <MovieIcon />, path: "/movie" },
15 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
16 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
17 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
18 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
19 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
20 { label: "资料", icon: <PersonIcon />, path: "/info" },
9563036699e95ae32025-06-02 21:42:11 +080021 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, // Added Publish option
956303669a32fc2c2025-06-02 19:45:53 +080022];
23
24const animeTypes = [
25 "华语动漫(大陆)",
26 "欧美动漫",
27 "日韩动漫",
28 "港台动漫",
29 "其他"
30];
31
32const areaTabs = [
kjWei53b79ae2025-06-05 09:18:35 +000033 { label: "国创", icon: <EmojiPeopleIcon fontSize="small" /> },
34 { label: "日漫", icon: <EmailIcon fontSize="small" /> },
35 { label: "欧美动漫", icon: <PersonIcon fontSize="small" /> },
36 { label: "韩漫", icon: <EmojiPeopleIcon fontSize="small" /> },
37 // { label: "其他", icon: <PersonIcon fontSize="small" /> },
956303669a32fc2c2025-06-02 19:45:53 +080038];
39
40export default function AnimePage() {
41 const navigate = useNavigate();
42 const [activeTab, setActiveTab] = React.useState(0);
kjWei53b79ae2025-06-05 09:18:35 +000043 const [animeList, setAnimeList] = React.useState([]);
956303669a32fc2c2025-06-02 19:45:53 +080044
45 // 每个tab对应的动漫类型
46 const animeTypesList = [
47 ["华语动漫(大陆)", "欧美动漫", "日韩动漫", "港台动漫", "其他"], // 大陆
48 ["港台热血", "港台搞笑", "港台其他"], // 港台
49 ["欧美冒险", "欧美科幻", "欧美其他"], // 欧美
50 ["日韩热血", "日韩恋爱", "日韩其他"], // 日韩
51 ["其他类型1", "其他类型2"] // 其他
52 ];
53 const animeTypes = animeTypesList[activeTab] || [];
54
kjWei53b79ae2025-06-05 09:18:35 +000055 React.useEffect(() => {
56 // 假设后端接口为 /api/animes?area=大陆
57 const area = areaTabs[activeTab].label;
58 fetch(`http://192.168.5.9:8080/api/get-seed-list-by-tag?tag=${encodeURIComponent(area)}`)
59 .then(res => res.json())
60 .then(data => setAnimeList(data))
61 .catch(() => setAnimeList([]));
62 }, [activeTab]);
63
956303669a32fc2c2025-06-02 19:45:53 +080064 return (
65 <div className="container">
66 {/* 顶部空白与音乐界面一致,用户栏绝对定位在页面右上角 */}
67 <div style={{ height: 80 }} />
68 <div className="user-bar" style={{ position: 'fixed', top: 18, right: 42, zIndex: 100, display: 'flex', alignItems: 'center', background: '#e0f3ff', borderRadius: 12, padding: '6px 18px', boxShadow: '0 2px 8px #b2d8ea', minWidth: 320, minHeight: 48, width: 420 }}>
69 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
70 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
71 </div>
72 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
73 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
74 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
75 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
76 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
77 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
78 </div>
79 </div>
80 {/* 下方内容整体下移,留出与音乐界面一致的间距 */}
81 <div style={{ height: 32 }} />
82 <nav className="nav-bar">
83 {navItems.map((item) => (
84 <div
85 key={item.label}
86 className={item.label === "动漫" ? "nav-item active" : "nav-item"}
87 onClick={() => navigate(item.path)}
88 >
89 {item.icon}
90 <span>{item.label}</span>
91 </div>
92 ))}
93 </nav>
94 <div className="search-section card">
95 <input className="search-input" placeholder="输入搜索关键词" />
96 <button className="search-btn">
97 <span role="img" aria-label="search">🔍</span>
98 </button>
99 </div>
100 <div className="area-tabs" style={{ display: 'flex', justifyContent: 'center', gap: 24, margin: '18px 0' }}>
101 {areaTabs.map((tab, idx) => (
102 <div
103 key={tab.label}
104 className={activeTab === idx ? "area-tab active" : "area-tab"}
105 onClick={() => setActiveTab(idx)}
106 >
107 {tab.icon} <span>{tab.label}</span>
108 </div>
109 ))}
110 </div>
111 <div className="table-section">
9563036699e95ae32025-06-02 21:42:11 +0800112 <table className="anime-table">
956303669a32fc2c2025-06-02 19:45:53 +0800113 <thead>
114 <tr>
115 <th>动漫类型</th>
116 <th>标题</th>
117 <th>发布者</th>
118 </tr>
119 </thead>
120 <tbody>
kjWei53b79ae2025-06-05 09:18:35 +0000121 {animeList.length > 0 ? (
122 animeList.map((item, index) => (
123 <tr key={item.id || index}>
124 <td>
125 <a href={`/torrent/${item.seedid}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
126 {item.seedtag}
127 </a>
128 </td>
129 <td>
130 <a href={`/torrent/${item.seedid}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
131 {item.title}
132 </a>
133 </td>
134 <td>{item.user.username}</td>
135 </tr>
136 ))
137 ) : (
138 animeTypes.map((type, index) => (
139 <tr key={type}>
140 <td>
141 <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
142 {type}
143 </a>
144 </td>
145 <td>
146 <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
147 种子{index + 1}
148 </a>
149 </td>
150 <td>发布者{index + 1}</td>
151 </tr>
152 ))
153 )}
956303669a32fc2c2025-06-02 19:45:53 +0800154 </tbody>
155 </table>
156 </div>
157 <div style={{ height: 32 }} />
158 <Pagination />
159 </div>
160 );
161}
162
163function Pagination() {
164 const [page, setPage] = React.useState(3);
165 const total = 5;
166 return (
167 <div className="pagination">
168 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
169 <span className="page-num">{page}/{total}</span>
170 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
171 <span className="page-info">第 <b>{page}</b> 页</span>
172 </div>
173 );
174}