blob: f7331bbdf4af35a34ef7a21247406b551477ab25 [file] [log] [blame]
956303669a32fc2c2025-06-02 19:45:53 +08001import React, { useState } 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" },
21];
22
23const gameTypes = ["PC", "主机", "移动", "掌机", "视频"];
24
25const areaTabs = [
26 { label: "PC", icon: <MovieIcon fontSize="small" /> },
27 { label: "主机", icon: <EmailIcon fontSize="small" /> },
28 { label: "移动", icon: <PersonIcon fontSize="small" /> },
29 { label: "掌机", icon: <EmojiPeopleIcon fontSize="small" /> },
30 { label: "视频", icon: <PersonIcon fontSize="small" /> },
31];
32
33export default function GamePage() {
34 const navigate = useNavigate();
35 const [activeTab, setActiveTab] = useState(0);
36
37 return (
38 <div className="container">
39 {/* 预留顶部空间用于放图片 */}
40 <div style={{ height: 80 }} />
41 <div
42 className="user-bar"
43 style={{
44 position: "fixed",
45 top: 18,
46 right: 42,
47 zIndex: 100,
48 display: "flex",
49 alignItems: "center",
50 background: "#e0f3ff",
51 borderRadius: 12,
52 padding: "6px 18px",
53 boxShadow: "0 2px 8px #b2d8ea",
54 minWidth: 320,
55 minHeight: 48,
56 width: 420,
57 }}
58 >
59 <div
60 style={{ cursor: "pointer", marginRight: 16 }}
61 onClick={() => navigate("/user")}
62 >
63 <AccountCircleIcon
64 style={{
65 fontSize: 38,
66 color: "#1a237e",
67 background: "#e0f3ff",
68 borderRadius: "50%",
69 }}
70 />
71 </div>
72 <div style={{ color: "#222", fontWeight: 500, marginRight: 24 }}>
73 用户栏
74 </div>
75 <div
76 style={{
77 display: "flex",
78 gap: 28,
79 flex: 1,
80 justifyContent: "flex-end",
81 alignItems: "center",
82 }}
83 >
84 <span style={{ color: "#1976d2", fontWeight: 500 }}>
85 魔力值: <b>12345</b>
86 </span>
87 <span style={{ color: "#1976d2", fontWeight: 500 }}>
88 分享率: <b>2.56</b>
89 </span>
90 <span style={{ color: "#1976d2", fontWeight: 500 }}>
91 上传量: <b>100GB</b>
92 </span>
93 <span style={{ color: "#1976d2", fontWeight: 500 }}>
94 下载量: <b>50GB</b>
95 </span>
96 </div>
97 </div>
98 {/* 下方内容整体下移,留出与音乐界面一致的间距 */}
99 <div style={{ height: 32 }} />
100 <nav className="nav-bar card">
101 {navItems.map((item) => (
102 <div
103 key={item.label}
104 className={item.label === "游戏" ? "nav-item active" : "nav-item"}
105 onClick={() => navigate(item.path)}
106 >
107 {item.icon}
108 <span>{item.label}</span>
109 </div>
110 ))}
111 </nav>
112 <div className="search-section card">
113 <input className="search-input" placeholder="输入搜索关键词" />
114 <button className="search-btn">
115 <span role="img" aria-label="search">
116 🔍
117 </span>
118 </button>
119 </div>
120 <div
121 className="area-tabs"
122 style={{
123 display: "flex",
124 justifyContent: "center",
125 gap: 24,
126 margin: "18px 0",
127 }}
128 >
129 {areaTabs.map((tab, idx) => (
130 <div
131 key={tab.label}
132 className={activeTab === idx ? "area-tab active" : "area-tab"}
133 onClick={() => setActiveTab(idx)}
134 >
135 {tab.icon} <span>{tab.label}</span>
136 </div>
137 ))}
138 </div>
139 <div className="table-section">
140 <table className="movie-table">
141 <thead>
142 <tr>
143 <th>游戏类型</th>
144 <th>标题</th>
145 <th>发布者</th>
146 </tr>
147 </thead>
148 <tbody>
149 {gameTypes.map((type, idx) => (
150 <tr key={type}>
151 <td>{type}</td>
152 <td></td>
153 <td></td>
154 </tr>
155 ))}
156 </tbody>
157 </table>
158 </div>
159 <div style={{ height: 32 }} />
160 <Pagination />
161 </div>
162 );
163}
164
165function Pagination() {
166 const [page, setPage] = React.useState(3);
167 const total = 5;
168 return (
169 <div className="pagination">
170 <button
171 onClick={() => setPage((p) => Math.max(1, p - 1))}
172 disabled={page === 1}
173 >
174 上一页
175 </button>
176 <span className="page-num">
177 {page}/{total}
178 </span>
179 <button
180 onClick={() => setPage((p) => Math.min(total, p + 1))}
181 disabled={page === total}
182 >
183 下一页
184 </button>
185 <span className="page-info">
186 <b>{page}</b>
187 </span>
188 </div>
189 );
190}