22301133 | 9e29215 | 2025-06-08 00:34:37 +0800 | [diff] [blame] | 1 | import React, { useState, useEffect } from "react";
|
wht | 338fc03 | 2025-06-09 17:16:22 +0800 | [diff] [blame] | 2 | import HomeIcon from "@mui/icons-material/Home";
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 3 | import MovieIcon from "@mui/icons-material/Movie";
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 4 | import TvIcon from "@mui/icons-material/Tv";
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 5 | import MusicNoteIcon from "@mui/icons-material/MusicNote";
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 6 | import AnimationIcon from "@mui/icons-material/Animation";
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 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";
|
22301133 | 38fd388 | 2025-06-06 23:33:57 +0800 | [diff] [blame] | 11 | import ForumIcon from "@mui/icons-material/Forum";
|
wht | dc90a03 | 2025-06-08 03:03:52 +0800 | [diff] [blame] | 12 | import HelpIcon from "@mui/icons-material/Help";
|
wht | 338fc03 | 2025-06-09 17:16:22 +0800 | [diff] [blame] | 13 | import { useNavigate } from "react-router-dom";
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 14 | import "./SharedStyles.css";
|
22301133 | 0f9623f | 2025-06-06 00:22:05 +0800 | [diff] [blame] | 15 | import { API_BASE_URL } from "./config";
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 16 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 17 | // 导航栏
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 18 | const navItems = [
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 19 | { label: "首页", icon: <HomeIcon className="emerald-nav-icon" />, path: "/home", type: "home" },
|
| 20 | { label: "电影", icon: <MovieIcon className="emerald-nav-icon" />, path: "/movie", type: "movie" },
|
| 21 | { label: "剧集", icon: <TvIcon className="emerald-nav-icon" />, path: "/tv", type: "tv" },
|
| 22 | { label: "音乐", icon: <MusicNoteIcon className="emerald-nav-icon" />, path: "/music", type: "music" },
|
| 23 | { label: "动漫", icon: <AnimationIcon className="emerald-nav-icon" />, path: "/anime", type: "anime" },
|
| 24 | { label: "游戏", icon: <SportsEsportsIcon className="emerald-nav-icon" />, path: "/game", type: "game" },
|
| 25 | { label: "体育", icon: <SportsMartialArtsIcon className="emerald-nav-icon" />, path: "/sport", type: "sport" },
|
| 26 | { label: "资料", icon: <PersonIcon className="emerald-nav-icon" />, path: "/info", type: "info" },
|
| 27 | { label: "论坛", icon: <ForumIcon className="emerald-nav-icon" />, path: "/forum", type: "forum" },
|
| 28 | { label: "发布", icon: <AccountCircleIcon className="emerald-nav-icon" />, path: "/publish", type: "publish" },
|
| 29 | { label: "求种", icon: <HelpIcon className="emerald-nav-icon" />, path: "/begseed", type: "help" },
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 30 | ];
|
| 31 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 32 | // 电影地区标签
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 33 | const areaTabs = [
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 34 | { label: "华语电影", value: "chinese" },
|
| 35 | { label: "港台电影", value: "hk_tw" },
|
| 36 | { label: "欧美电影", value: "western" },
|
| 37 | { label: "日韩电影", value: "jp_kr" },
|
| 38 | { label: "其他电影", value: "others" }
|
956303669 | 9e95ae3 | 2025-06-02 21:42:11 +0800 | [diff] [blame] | 39 | ];
|
| 40 |
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 41 | export default function MoviePage() {
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 42 | const navigate = useNavigate();
|
| 43 | const [searchText, setSearchText] = React.useState('');
|
| 44 | const [userInfo, setUserInfo] = useState({ avatar_url: '', username: '' });
|
| 45 | const [userPT, setUserPT] = useState({ magic: 0, ratio: 0, upload: 0, download: 0 });
|
| 46 | const [activeTab, setActiveTab] = React.useState(0);
|
| 47 | const [movieList, setMovieList] = React.useState([]);
|
22301133 | 9e29215 | 2025-06-08 00:34:37 +0800 | [diff] [blame] | 48 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 49 | useEffect(() => {
|
| 50 | const match = document.cookie.match('(^|;)\\s*userId=([^;]+)');
|
| 51 | const userId = match ? match[2] : null;
|
| 52 | if (!userId) return;
|
| 53 | fetch(`${API_BASE_URL}/api/get-userpt?userid=${encodeURIComponent(userId)}`)
|
| 54 | .then(res => res.json())
|
| 55 | .then(data => {
|
| 56 | setUserInfo({ avatar_url: data.user.avatar_url, username: data.user.username });
|
| 57 | setUserPT({
|
| 58 | magic: data.magic_value || data.magic || 0,
|
| 59 | ratio: data.share_ratio || data.share || 0,
|
| 60 | upload: data.upload_amount || data.upload || 0,
|
| 61 | download: data.download_amount || data.download || 0,
|
| 62 | });
|
| 63 | })
|
| 64 | .catch(err => console.error('Fetching user profile failed', err));
|
| 65 | }, []);
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 66 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 67 | // 每个tab对应的电影类型
|
| 68 | const movieTypesList = [
|
| 69 | ["华语电影(大陆)", "欧美电影", "日韩电影", "港台电影", "其他"], // 大陆
|
| 70 | ["港台动作", "港台爱情", "港台喜剧", "港台其他"], // 港台
|
| 71 | ["欧美动作", "欧美科幻", "欧美剧情", "欧美其他"], // 欧美
|
| 72 | ["日韩动画", "日韩爱情", "日韩其他"], // 日韩
|
| 73 | ["其他类型1", "其他类型2"] // 其他
|
| 74 | ];
|
| 75 | const movieTypes = movieTypesList[activeTab] || [];
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 76 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 77 | React.useEffect(() => {
|
| 78 | const area = areaTabs[activeTab].label;
|
| 79 | fetch(`${API_BASE_URL}/api/get-seed-list-by-tag?tag=${encodeURIComponent(area)}`)
|
| 80 | .then(res => res.json())
|
| 81 | .then(data => {
|
| 82 | setMovieList(data);
|
| 83 | })
|
| 84 | .catch(() => setMovieList([]));
|
| 85 | }, [activeTab]);
|
rhj | c6a4ee0 | 2025-06-06 00:45:18 +0800 | [diff] [blame] | 86 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 87 | // 搜索按钮处理
|
| 88 | const handleSearch = () => {
|
| 89 | const area = areaTabs[activeTab].label;
|
| 90 | fetch(`${API_BASE_URL}/api/search-seeds?tag=${encodeURIComponent(area)}&keyword=${encodeURIComponent(searchText)}`)
|
| 91 | .then(res => res.json())
|
| 92 | .then(data => {
|
| 93 | setMovieList(data);
|
| 94 | })
|
| 95 | .catch(() => setMovieList([]));
|
| 96 | };
|
22301133 | 9e29215 | 2025-06-08 00:34:37 +0800 | [diff] [blame] | 97 |
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 98 | return (
|
| 99 | <div className="emerald-home-container">
|
| 100 | {/* 流星雨背景效果 */}
|
| 101 | <div className="meteor-shower">
|
| 102 | <div className="meteor">💫</div>
|
| 103 | <div className="meteor">⭐</div>
|
| 104 | <div className="meteor">✨</div>
|
| 105 | <div className="meteor">🌟</div>
|
| 106 | <div className="meteor">💫</div>
|
| 107 | <div className="meteor">⭐</div>
|
| 108 | <div className="meteor">✨</div>
|
| 109 | <div className="meteor">🌟</div>
|
| 110 | <div className="meteor">💫</div>
|
| 111 | <div className="meteor">⭐</div>
|
| 112 | </div>
|
| 113 |
|
| 114 | {/* 浮动园林装饰元素 */}
|
| 115 | <div className="floating-garden-elements">
|
| 116 | <div className="garden-element">🌿</div>
|
| 117 | <div className="garden-element">🦋</div>
|
| 118 | <div className="garden-element">🌺</div>
|
| 119 | <div className="garden-element">🌸</div>
|
| 120 | </div>
|
| 121 |
|
| 122 | <div className="emerald-content">
|
| 123 | {/* NeuraFlux用户栏 */}
|
| 124 | <div className="emerald-user-bar">
|
| 125 | <div className="emerald-user-avatar" onClick={() => navigate('/user')}>
|
| 126 | <AccountCircleIcon style={{ fontSize: 38, color: 'white' }} />
|
| 127 | </div>
|
| 128 | <div className="emerald-brand-section">
|
| 129 | <div className="emerald-brand-icon">⚡</div>
|
| 130 | <div className="emerald-user-label">NeuraFlux</div>
|
| 131 | </div>
|
| 132 | <div className="emerald-user-stats">
|
| 133 | <span className="emerald-stat-item">
|
| 134 | 魔力值: <span className="emerald-stat-value">12,345</span>
|
| 135 | </span>
|
| 136 | <span className="emerald-stat-item">
|
| 137 | 分享率: <span className="emerald-stat-value">2.56</span>
|
| 138 | </span>
|
| 139 | <span className="emerald-stat-item">
|
| 140 | 上传: <span className="emerald-stat-value">100GB</span>
|
| 141 | </span>
|
| 142 | <span className="emerald-stat-item">
|
| 143 | 下载: <span className="emerald-stat-value">50GB</span>
|
| 144 | </span>
|
| 145 | </div>
|
| 146 | </div>
|
| 147 |
|
| 148 | {/* NeuraFlux导航栏 */}
|
| 149 | <nav className="emerald-nav-bar">
|
| 150 | {navItems.map((item) => (
|
| 151 | <div
|
| 152 | key={item.label}
|
| 153 | className={`emerald-nav-item ${item.label === "电影" ? "active" : ""}`}
|
| 154 | data-type={item.type}
|
| 155 | onClick={() => navigate(item.path)}
|
| 156 | >
|
| 157 | {item.icon}
|
| 158 | <span className="emerald-nav-label">{item.label}</span>
|
| 159 | </div>
|
| 160 | ))}
|
| 161 | </nav>
|
| 162 |
|
| 163 | {/* 电影内容区域 */}
|
| 164 | <div className="emerald-content-section">
|
| 165 | <h1 className="emerald-page-title">🎬 电影资源</h1>
|
| 166 | <p style={{ textAlign: 'center', color: '#2d5016', fontSize: '18px' }}>
|
| 167 | 欢迎来到NeuraFlux电影频道,这里有最新最热门的电影资源
|
| 168 | </p>
|
| 169 | </div>
|
| 170 | </div>
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 171 | </div>
|
TRM-coding | fa3ffdf | 2025-06-09 22:47:42 +0800 | [diff] [blame] | 172 | );
|
956303669 | a32fc2c | 2025-06-02 19:45:53 +0800 | [diff] [blame] | 173 | }
|