blob: 52f3a83820687debac5349d492d369b0a114474e [file] [log] [blame]
956303669a32fc2c2025-06-02 19:45:53 +08001import React from "react";
ssq5067cb92025-06-05 11:44:23 +00002import { BrowserRouter as Router, Routes, Route, useNavigate, Link, Navigate } from "react-router-dom";
956303669a32fc2c2025-06-02 19:45:53 +08003import MovieIcon from "@mui/icons-material/Movie";
4import EmailIcon from "@mui/icons-material/Email";
5import MusicNoteIcon from "@mui/icons-material/MusicNote";
6import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople";
7import SportsEsportsIcon from "@mui/icons-material/SportsEsports";
8import SportsMartialArtsIcon from "@mui/icons-material/SportsMartialArts";
9import PersonIcon from "@mui/icons-material/Person";
10import AccountCircleIcon from "@mui/icons-material/AccountCircle";
wht6a1b6782025-06-06 19:14:59 +080011import ForumIcon from "@mui/icons-material/Forum";
956303669a32fc2c2025-06-02 19:45:53 +080012import "./App.css";
13import MoviePage from "./MoviePage";
14import TVPage from "./TVPage";
15import MusicPage from "./MusicPage";
16import AnimePage from "./AnimePage";
17import GamePage from "./GamePage";
18import SportPage from "./SportPage";
19import InfoPage from "./InfoPage";
20import UserProfile from "./UserProfile";
9563036699e95ae32025-06-02 21:42:11 +080021import PublishPage from "./PublishPage";
22import TorrentDetailPage from './TorrentDetailPage';
wht6a1b6782025-06-06 19:14:59 +080023import ForumPage from "./ForumPage";
24import PostDetailPage from "./PostDetailPage";
ssq5067cb92025-06-05 11:44:23 +000025import LoginPage from './LoginPage';
26import RegisterPage from './RegisterPage';
956303669a32fc2c2025-06-02 19:45:53 +080027
wht6a1b6782025-06-06 19:14:59 +080028
956303669a32fc2c2025-06-02 19:45:53 +080029const navItems = [
30 { label: "电影", icon: <MovieIcon />, path: "/movie" },
31 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
32 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
33 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
34 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
35 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
36 { label: "资料", icon: <PersonIcon />, path: "/info" },
wht6a1b6782025-06-06 19:14:59 +080037 { label: "论坛", icon: <ForumIcon />, path: "/forum" },
38 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" },
956303669a32fc2c2025-06-02 19:45:53 +080039];
40
41function Home() {
42 const navigate = useNavigate();
43 return (
44 <div className="container">
45 {/* 顶部空白与电影界面一致 */}
46 <div style={{ height: 80 }} />
47 {/* 用户栏 */}
48 <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 }}>
49 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
50 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
51 </div>
52 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
53 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
54 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
55 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
56 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
57 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
58 </div>
59 </div>
956303669a32fc2c2025-06-02 19:45:53 +080060 <div style={{ height: 32 }} />
61 <nav className="nav-bar card">
62 {navItems.map((item) => (
63 <div
64 key={item.label}
65 className={"nav-item"}
66 onClick={() => navigate(item.path)}
67 >
68 {item.icon}
69 <span>{item.label}</span>
70 </div>
71 ))}
72 </nav>
73 <div className="search-section card">
74 <input className="search-input" placeholder="输入搜索关键词" />
75 <button className="search-btn">
76 <span role="img" aria-label="search">🔍</span>
77 </button>
78 </div>
956303669a32fc2c2025-06-02 19:45:53 +080079 <div className="table-section card">
80 <table className="movie-table">
81 <thead>
82 <tr>
83 <th>类型</th>
84 <th>标题</th>
85 <th>发布者</th>
86 </tr>
87 </thead>
88 <tbody>
89 <tr>
90 <td>电影</td>
91 <td></td>
92 <td></td>
93 </tr>
94 <tr>
95 <td>剧集</td>
96 <td></td>
97 <td></td>
98 </tr>
99 <tr>
100 <td>音乐</td>
101 <td></td>
102 <td></td>
103 </tr>
104 <tr>
105 <td>动漫</td>
106 <td></td>
107 <td></td>
108 </tr>
109 <tr>
110 <td>游戏</td>
111 <td></td>
112 <td></td>
113 </tr>
114 </tbody>
115 </table>
116 </div>
117 <div style={{ height: 32 }} />
118 <Pagination />
119 </div>
120 );
121}
122
123function Pagination() {
124 const [page, setPage] = React.useState(3);
125 const total = 5;
126 return (
127 <div className="pagination">
128 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
129 <span className="page-num">{page}/{total}</span>
130 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
131 <span className="page-info">第 <b>{page}</b> 页</span>
132 </div>
133 );
134}
135
136function Page({ label }) {
137 return (
138 <div style={{ padding: 40, fontSize: 32 }}>
139 {label} 页面(可自定义内容)
140 <br />
141 <Link to="/">返回首页</Link>
142 </div>
143 );
144}
145
146export default function App() {
147 return (
148 <Router>
149 <Routes>
ssq5067cb92025-06-05 11:44:23 +0000150 <Route path="/login" element={<LoginPage />} />
151 <Route path="/register" element={<RegisterPage />} />
152 <Route path="/" element={<Navigate to="/login" replace />} />
956303669a32fc2c2025-06-02 19:45:53 +0800153 <Route path="/movie" element={<MoviePage />} />
154 <Route path="/tv" element={<TVPage />} />
155 <Route path="/music" element={<MusicPage />} />
156 <Route path="/anime" element={<AnimePage />} />
157 <Route path="/game" element={<GamePage />} />
158 <Route path="/sport" element={<SportPage />} />
wht6a1b6782025-06-06 19:14:59 +0800159 <Route path="/forum" element={<ForumPage />} />
160 <Route path="/forum/:postId" element={<PostDetailPage />} />
956303669a32fc2c2025-06-02 19:45:53 +0800161 <Route path="/info" element={<InfoPage />} />
162 <Route path="/user" element={<UserProfile />} />
9563036699e95ae32025-06-02 21:42:11 +0800163 <Route path="/publish" element={<PublishPage />} />
164 <Route path="/torrent/:torrentId" element={<TorrentDetailPage />} />
956303669a32fc2c2025-06-02 19:45:53 +0800165 </Routes>
166 </Router>
167 );
168}