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