修改前端页面
Change-Id: I344849fc3dfca5725e0ef2a107e2c89a14fce8da
diff --git a/front/src/MoviePage.js b/front/src/MoviePage.js
index cdc8112..79f2c8b 100644
--- a/front/src/MoviePage.js
+++ b/front/src/MoviePage.js
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from "react";
+import HomeIcon from "@mui/icons-material/Home";
import MovieIcon from "@mui/icons-material/Movie";
import EmailIcon from "@mui/icons-material/Email";
import MusicNoteIcon from "@mui/icons-material/MusicNote";
@@ -9,11 +10,12 @@
import AccountCircleIcon from "@mui/icons-material/AccountCircle";
import ForumIcon from "@mui/icons-material/Forum";
import HelpIcon from "@mui/icons-material/Help";
-import { useNavigate } from "react-router-dom";
import "./App.css";
+import { useNavigate } from "react-router-dom";
import { API_BASE_URL } from "./config";
const navItems = [
+ { label: "首页", icon: <HomeIcon />, path: "/home" },
{ label: "电影", icon: <MovieIcon />, path: "/movie" },
{ label: "剧集", icon: <EmailIcon />, path: "/tv" },
{ label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
@@ -31,13 +33,6 @@
{ label: "港台", icon: <EmailIcon fontSize="small" /> },
{ label: "欧美", icon: <PersonIcon fontSize="small" /> },
{ label: "日韩", icon: <EmojiPeopleIcon fontSize="small" /> },
- // { label: "其他", icon: <PersonIcon fontSize="small" /> },
-];
-
-const exampleTorrents = [
- { type: "Action", title: "实例1", id: 1 },
- { type: "Drama", title: "实例2", id: 2 },
- { type: "Comedy", title: "实例3", id: 3 },
];
export default function MoviePage() {
@@ -47,17 +42,14 @@
const [userPT, setUserPT] = useState({ magic: 0, ratio: 0, upload: 0, download: 0 });
const [activeTab, setActiveTab] = React.useState(0);
const [movieList, setMovieList] = React.useState([]);
-
useEffect(() => {
const match = document.cookie.match('(^|;)\\s*userId=([^;]+)');
const userId = match ? match[2] : null;
- console.log("User ID from cookie:", userId);
if (!userId) return;
fetch(`${API_BASE_URL}/api/get-userpt?userid=${encodeURIComponent(userId)}`)
.then(res => res.json())
.then(data => {
- console.log('用户PT信息:', data);
setUserInfo({ avatar_url: data.user.avatar_url, username: data.user.username });
setUserPT({
magic: data.magic_value || data.magic || 0,
@@ -80,12 +72,10 @@
const movieTypes = movieTypesList[activeTab] || [];
React.useEffect(() => {
- // 这里假设后端接口为 /api/get-seed-list-by-tag?tag=大陆
const area = areaTabs[activeTab].label;
fetch(`${API_BASE_URL}/api/get-seed-list-by-tag?tag=${encodeURIComponent(area)}`)
.then(res => res.json())
.then(data => {
- console.log('电影区返回数据:', data);
setMovieList(data);
})
.catch(() => setMovieList([]));
@@ -97,7 +87,6 @@
fetch(`${API_BASE_URL}/api/search-seeds?tag=${encodeURIComponent(area)}&keyword=${encodeURIComponent(searchText)}`)
.then(res => res.json())
.then(data => {
- console.log('搜索返回数据:', data);
setMovieList(data);
})
.catch(() => setMovieList([]));
@@ -166,6 +155,9 @@
<th>电影类型</th>
<th>标题</th>
<th>发布者</th>
+ <th>大小</th>
+ <th>热度</th>
+ <th>折扣倍率</th>
</tr>
</thead>
<tbody>
@@ -182,7 +174,10 @@
{item.title}
</a>
</td>
- <td>{item.user.username}</td>
+ <td>{item.username}</td>
+ <td>{item.seedsize}</td>
+ <td>{item.downloadtimes}</td>
+ <td>{item.discount == null ? 1 : item.discount}</td>
</tr>
))
) : (
@@ -199,6 +194,9 @@
</a>
</td>
<td>发布者{index + 1}</td>
+ <td>--</td>
+ <td>--</td>
+ <td>1</td>
</tr>
))
)}