blob: 3a4989803fc1b9339ff6e1075d5464f2862b0d09 [file] [log] [blame]
956303669a32fc2c2025-06-02 19:45:53 +08001import React from "react";
2import { BrowserRouter as Router, Routes, Route, useNavigate, Link } from "react-router-dom";
3import 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";
11import "./App.css";
12import MoviePage from "./MoviePage";
13import TVPage from "./TVPage";
14import MusicPage from "./MusicPage";
15import AnimePage from "./AnimePage";
16import GamePage from "./GamePage";
17import SportPage from "./SportPage";
18import InfoPage from "./InfoPage";
19import UserProfile from "./UserProfile";
20
21const navItems = [
22 { label: "电影", icon: <MovieIcon />, path: "/movie" },
23 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
24 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
25 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
26 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
27 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
28 { label: "资料", icon: <PersonIcon />, path: "/info" },
29];
30
31function Home() {
32 const navigate = useNavigate();
33 return (
34 <div className="container">
35 {/* 顶部空白与电影界面一致 */}
36 <div style={{ height: 80 }} />
37 {/* 用户栏 */}
38 <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 }}>
39 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
40 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
41 </div>
42 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
43 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
44 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
45 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
46 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
47 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
48 </div>
49 </div>
50 {/* 下方内容整体下移,留出与电影界面一致的间距 */}
51 <div style={{ height: 32 }} />
52 <nav className="nav-bar card">
53 {navItems.map((item) => (
54 <div
55 key={item.label}
56 className={"nav-item"}
57 onClick={() => navigate(item.path)}
58 >
59 {item.icon}
60 <span>{item.label}</span>
61 </div>
62 ))}
63 </nav>
64 <div className="search-section card">
65 <input className="search-input" placeholder="输入搜索关键词" />
66 <button className="search-btn">
67 <span role="img" aria-label="search">🔍</span>
68 </button>
69 </div>
70 {/* 删除高频搜索栏 */}
71 <div className="table-section card">
72 <table className="movie-table">
73 <thead>
74 <tr>
75 <th>类型</th>
76 <th>标题</th>
77 <th>发布者</th>
78 </tr>
79 </thead>
80 <tbody>
81 <tr>
82 <td>电影</td>
83 <td></td>
84 <td></td>
85 </tr>
86 <tr>
87 <td>剧集</td>
88 <td></td>
89 <td></td>
90 </tr>
91 <tr>
92 <td>音乐</td>
93 <td></td>
94 <td></td>
95 </tr>
96 <tr>
97 <td>动漫</td>
98 <td></td>
99 <td></td>
100 </tr>
101 <tr>
102 <td>游戏</td>
103 <td></td>
104 <td></td>
105 </tr>
106 </tbody>
107 </table>
108 </div>
109 <div style={{ height: 32 }} />
110 <Pagination />
111 </div>
112 );
113}
114
115function Pagination() {
116 const [page, setPage] = React.useState(3);
117 const total = 5;
118 return (
119 <div className="pagination">
120 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
121 <span className="page-num">{page}/{total}</span>
122 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
123 <span className="page-info">第 <b>{page}</b> 页</span>
124 </div>
125 );
126}
127
128function Page({ label }) {
129 return (
130 <div style={{ padding: 40, fontSize: 32 }}>
131 {label} 页面(可自定义内容)
132 <br />
133 <Link to="/">返回首页</Link>
134 </div>
135 );
136}
137
138export default function App() {
139 return (
140 <Router>
141 <Routes>
142 <Route path="/" element={<Home />} />
143 <Route path="/movie" element={<MoviePage />} />
144 <Route path="/tv" element={<TVPage />} />
145 <Route path="/music" element={<MusicPage />} />
146 <Route path="/anime" element={<AnimePage />} />
147 <Route path="/game" element={<GamePage />} />
148 <Route path="/sport" element={<SportPage />} />
149 <Route path="/info" element={<InfoPage />} />
150 <Route path="/user" element={<UserProfile />} />
151 </Routes>
152 </Router>
153 );
154}