wht | 10563a8 | 2025-06-08 15:52:18 +0800 | [diff] [blame] | 1 | import React from "react"; |
| 2 | import HomeIcon from "@mui/icons-material/Home"; |
| 3 | import MovieIcon from "@mui/icons-material/Movie"; |
| 4 | import EmailIcon from "@mui/icons-material/Email"; |
| 5 | import MusicNoteIcon from "@mui/icons-material/MusicNote"; |
| 6 | import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople"; |
| 7 | import SportsEsportsIcon from "@mui/icons-material/SportsEsports"; |
| 8 | import SportsMartialArtsIcon from "@mui/icons-material/SportsMartialArts"; |
| 9 | import PersonIcon from "@mui/icons-material/Person"; |
| 10 | import AccountCircleIcon from "@mui/icons-material/AccountCircle"; |
| 11 | import ForumIcon from "@mui/icons-material/Forum"; |
| 12 | import HelpIcon from "@mui/icons-material/Help"; |
| 13 | import { useNavigate } from "react-router-dom"; |
| 14 | import "./App.css"; |
| 15 | |
| 16 | // 导航栏 |
| 17 | const navItems = [ |
| 18 | { label: "首页", icon: <HomeIcon />, path: "/home" }, |
| 19 | { label: "电影", icon: <MovieIcon />, path: "/movie" }, |
| 20 | { label: "剧集", icon: <EmailIcon />, path: "/tv" }, |
| 21 | { label: "音乐", icon: <MusicNoteIcon />, path: "/music" }, |
| 22 | { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" }, |
| 23 | { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" }, |
| 24 | { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" }, |
| 25 | { label: "资料", icon: <PersonIcon />, path: "/info" }, |
| 26 | { label: "论坛", icon: <ForumIcon />, path: "/forum" }, |
| 27 | { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, |
| 28 | { label: "求种", icon: <HelpIcon />, path: "/begseed" }, |
| 29 | ]; |
| 30 | |
| 31 | // 示例种子数据 |
| 32 | const exampleSeeds = [ |
| 33 | { |
| 34 | id: 1, |
| 35 | tags: "电影,科幻", |
| 36 | title: "三体 1080P 蓝光", |
| 37 | popularity: 123, |
| 38 | user: { username: "Alice" }, |
| 39 | }, |
| 40 | { |
| 41 | id: 2, |
| 42 | tags: "动漫,热血", |
| 43 | title: "灌篮高手 国语配音", |
| 44 | popularity: 88, |
| 45 | user: { username: "Bob" }, |
| 46 | }, |
| 47 | { |
| 48 | id: 3, |
| 49 | tags: "音乐,流行", |
| 50 | title: "周杰伦-稻香", |
| 51 | popularity: 56, |
| 52 | user: { username: "Jay" }, |
| 53 | }, |
| 54 | { |
| 55 | id: 4, |
| 56 | tags: "剧集,悬疑", |
| 57 | title: "隐秘的角落", |
| 58 | popularity: 77, |
| 59 | user: { username: "小明" }, |
| 60 | }, |
| 61 | ]; |
| 62 | |
| 63 | export default function HomePage() { |
| 64 | const navigate = useNavigate(); |
| 65 | |
| 66 | return ( |
| 67 | <div className="container"> |
| 68 | {/* 顶部空白与电影界面一致 */} |
| 69 | <div style={{ height: 80 }} /> |
| 70 | {/* 用户栏 */} |
| 71 | <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 }}> |
| 72 | <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}> |
| 73 | <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} /> |
| 74 | </div> |
| 75 | <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div> |
| 76 | <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}> |
| 77 | <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span> |
| 78 | <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span> |
| 79 | <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span> |
| 80 | <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span> |
| 81 | </div> |
| 82 | </div> |
| 83 | {/* 下方内容整体下移,留出与电影界面一致的间距 */} |
| 84 | <div style={{ height: 32 }} /> |
| 85 | <nav className="nav-bar card"> |
| 86 | {navItems.map((item) => ( |
| 87 | <div |
| 88 | key={item.label} |
| 89 | className={item.label === "首页" ? "nav-item active" : "nav-item"} |
| 90 | onClick={() => navigate(item.path)} |
| 91 | > |
| 92 | {item.icon} |
| 93 | <span>{item.label}</span> |
| 94 | </div> |
| 95 | ))} |
| 96 | </nav> |
| 97 | <div className="table-section card"> |
| 98 | <table className="movie-table"> |
| 99 | <thead> |
| 100 | <tr> |
| 101 | <th>标签</th> |
| 102 | <th>标题</th> |
| 103 | <th>热度</th> |
| 104 | <th>发布者</th> |
| 105 | </tr> |
| 106 | </thead> |
| 107 | <tbody> |
| 108 | {exampleSeeds.map((seed) => ( |
| 109 | <tr key={seed.id}> |
| 110 | <td>{seed.tags}</td> |
| 111 | <td> |
| 112 | <a href={`/torrent/${seed.id}`} style={{ color: '#1a237e', textDecoration: 'none' }}> |
| 113 | {seed.title} |
| 114 | </a> |
| 115 | </td> |
| 116 | <td>{seed.popularity}</td> |
| 117 | <td>{seed.user.username}</td> |
| 118 | </tr> |
| 119 | ))} |
| 120 | </tbody> |
| 121 | </table> |
| 122 | </div> |
| 123 | <div style={{ height: 32 }} /> |
| 124 | </div> |
| 125 | ); |
| 126 | } |