blob: bf1db6c5d18561baf424969e9a5b24ce1d83e6a4 [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 { useNavigate } from "react-router-dom";
11import "./App.css";
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" },
9563036699e95ae32025-06-02 21:42:11 +080021 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, // Added Publish option
956303669a32fc2c2025-06-02 19:45:53 +080022];
23
rhjc6a4ee02025-06-06 00:45:18 +080024const tvTypesList = [
25 ["华语剧集(大陆)", "欧美剧集", "日韩剧集", "港台剧集", "其他"], // 大陆
26 ["港台都市", "港台爱情", "港台悬疑", "港台其他"], // 港台
27 ["欧美悬疑", "欧美历史", "欧美其他"], // 欧美
28 ["日韩青春", "日韩家庭", "日韩其他"], // 日韩
29 ["其他类型1", "其他类型2"] // 其他
956303669a32fc2c2025-06-02 19:45:53 +080030];
31
32const areaTabs = [
rhjc6a4ee02025-06-06 00:45:18 +080033 { label: "国产电视剧", icon: <MovieIcon fontSize="small" /> },
34 { label: "港剧", icon: <EmailIcon fontSize="small" /> },
35 { label: "欧美剧", icon: <PersonIcon fontSize="small" /> },
36 { label: "日韩剧", icon: <EmojiPeopleIcon fontSize="small" /> },
37 // { label: "其他", icon: <PersonIcon fontSize="small" /> },
9563036699e95ae32025-06-02 21:42:11 +080038];
39
956303669a32fc2c2025-06-02 19:45:53 +080040export default function TVPage() {
41 const navigate = useNavigate();
42 const [activeTab, setActiveTab] = React.useState(0);
rhjc6a4ee02025-06-06 00:45:18 +080043 const [tvList, setTvList] = React.useState([]);
44
45 React.useEffect(() => {
46 // 假设后端接口为 /api/tvs?area=大陆
47 const area = areaTabs[activeTab].label;
48 fetch(`http://192.168.5.9:8080/api/get-seed-list-by-tag?tag=${encodeURIComponent(area)}`)
49 .then(res => res.json())
50 .then(data => setTvList(data))
51 .catch(() => setTvList([]));
52 }, [activeTab]);
956303669a32fc2c2025-06-02 19:45:53 +080053
54 // 每个tab对应的剧集类型
956303669a32fc2c2025-06-02 19:45:53 +080055 const tvTypes = tvTypesList[activeTab] || [];
56
57 return (
58 <div className="container">
59 {/* 顶部空白与音乐界面一致,用户栏绝对定位在页面右上角 */}
60 <div style={{ height: 80 }} />
61 <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 }}>
62 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
63 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
64 </div>
65 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
66 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
67 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
68 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
69 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
70 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
71 </div>
72 </div>
73 {/* 下方内容整体下移,留出与音乐界面一致的间距 */}
74 <div style={{ height: 32 }} />
75 <nav className="nav-bar card">
76 {navItems.map((item) => (
77 <div
78 key={item.label}
79 className={item.label === "剧集" ? "nav-item active" : "nav-item"}
80 onClick={() => navigate(item.path)}
81 >
82 {item.icon}
83 <span>{item.label}</span>
84 </div>
85 ))}
86 </nav>
87 <div className="search-section card">
88 <input className="search-input" placeholder="输入搜索关键词" />
89 <button className="search-btn">
90 <span role="img" aria-label="search">🔍</span>
91 </button>
92 </div>
93 <div className="area-tabs" style={{ display: 'flex', justifyContent: 'center', gap: 24, margin: '18px 0' }}>
94 {areaTabs.map((tab, idx) => (
95 <div
96 key={tab.label}
97 className={activeTab === idx ? "area-tab active" : "area-tab"}
98 onClick={() => setActiveTab(idx)}
99 >
100 {tab.icon} <span>{tab.label}</span>
101 </div>
102 ))}
103 </div>
104 <div className="table-section">
105 <table className="movie-table">
106 <thead>
107 <tr>
108 <th>剧集类型</th>
109 <th>标题</th>
110 <th>发布者</th>
111 </tr>
112 </thead>
113 <tbody>
rhjc6a4ee02025-06-06 00:45:18 +0800114 {tvList.length > 0 ? (
115 tvList.map((item, index) => (
116 <tr key={item.id || index}>
117 <td>
118 <a href={`/torrent/${item.seedid}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
119 {item.seedtag}
120 </a>
121 </td>
122 <td>
123 <a href={`/torrent/${item.seedid}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
124 {item.title}
125 </a>
126 </td>
127 <td>{item.user.username}</td>
128 </tr>
129 ))
130 ) : (
131 tvTypes.map((type, index) => (
132 <tr key={type}>
133 <td>
134 <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
135 {type}
136 </a>
137 </td>
138 <td>
139 <a href={`/torrent/${type}`} style={{ color: '#1a237e', textDecoration: 'none' }}>
140 种子{index + 1}
141 </a>
142 </td>
143 <td>发布者{index + 1}</td>
144 </tr>
145 ))
146 )}
956303669a32fc2c2025-06-02 19:45:53 +0800147 </tbody>
148 </table>
149 </div>
150 <div style={{ height: 32 }} />
151 <Pagination />
152 </div>
153 );
154}
155
156function Pagination() {
157 const [page, setPage] = React.useState(3);
158 const total = 5;
159 return (
160 <div className="pagination">
161 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
162 <span className="page-num">{page}/{total}</span>
163 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
164 <span className="page-info">第 <b>{page}</b> 页</span>
165 </div>
166 );
167}