blob: 1a63a89eff37b111deb7fc91416eb9faf119b26b [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 areaTabs = [
24 { label: "大陆", icon: <MovieIcon fontSize="small" /> },
25 { label: "港台", icon: <EmailIcon fontSize="small" /> },
26 { label: "欧美", icon: <PersonIcon fontSize="small" /> },
27 { label: "日韩", icon: <EmojiPeopleIcon fontSize="small" /> },
28 { label: "其他", icon: <PersonIcon fontSize="small" /> },
29];
30
31export default function MusicPage() {
32 const navigate = useNavigate();
33 const [activeTab, setActiveTab] = React.useState(0);
34
35 // 每个tab对应的音乐类型
36 const musicTypesList = [
37 ["华语音乐(大陆)", "欧美音乐", "日韩音乐", "港台音乐", "其他"], // 大陆
38 ["港台流行", "港台摇滚", "港台其他"], // 港台
39 ["欧美流行", "欧美摇滚", "欧美其他"], // 欧美
40 ["日韩流行", "日韩其他"], // 日韩
41 ["其他类型1", "其他类型2"] // 其他
42 ];
43 const musicTypes = musicTypesList[activeTab] || [];
44
45 return (
46 <div className="container music-bg">
47 {/* 顶部空白与音乐界面一致,用户栏绝对定位在页面右上角 */}
48 <div style={{ height: 80 }} />
49 <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 }}>
50 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
51 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
52 </div>
53 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
54 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
55 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
56 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
57 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
58 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
59 </div>
60 </div>
61 {/* 下方内容整体下移,留出与其他页面一致的间距 */}
62 <div style={{ height: 32 }} />
63 <nav className="nav-bar card">
64 {navItems.map((item) => (
65 <div
66 key={item.label}
67 className={item.label === "音乐" ? "nav-item active" : "nav-item"}
68 onClick={() => navigate(item.path)}
69 >
70 {item.icon}
71 <span>{item.label}</span>
72 </div>
73 ))}
74 </nav>
75 <div className="search-section card">
76 <input className="search-input" placeholder="输入搜索关键词" />
77 <button className="search-btn">
78 <span role="img" aria-label="search">🔍</span>
79 </button>
80 </div>
81 <div className="area-tabs card" style={{ display: 'flex', justifyContent: 'center', gap: 24, margin: '18px 0' }}>
82 {areaTabs.map((tab, idx) => (
83 <div
84 key={tab.label}
85 className={activeTab === idx ? "area-tab active" : "area-tab"}
86 onClick={() => setActiveTab(idx)}
87 >
88 {tab.icon} <span>{tab.label}</span>
89 </div>
90 ))}
91 </div>
92 <div className="table-section card">
93 <table className="movie-table">
94 <thead>
95 <tr>
96 <th>音乐类型</th>
97 <th>标题</th>
98 <th>发布者</th>
99 </tr>
100 </thead>
101 <tbody>
102 {musicTypes.map(type => (
103 <tr key={type}>
104 <td>{type}</td>
105 <td></td>
106 <td></td>
107 </tr>
108 ))}
109 </tbody>
110 </table>
111 </div>
112 <div style={{ height: 32 }} />
113 <Pagination />
114 </div>
115 );
116}
117
118function Pagination() {
119 const [page, setPage] = React.useState(3);
120 const total = 5;
121 return (
122 <div className="pagination">
123 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
124 <span className="page-num">{page}/{total}</span>
125 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
126 <span className="page-info">第 <b>{page}</b> 页</span>
127 </div>
128 );
129}