新增论坛页面
Change-Id: I317789b03458b6e8109dd7aa3ac8c1eadcb38e62
diff --git a/front/src/App.js b/front/src/App.js
index 225689e..52f3a83 100644
--- a/front/src/App.js
+++ b/front/src/App.js
@@ -8,6 +8,7 @@
import SportsMartialArtsIcon from "@mui/icons-material/SportsMartialArts";
import PersonIcon from "@mui/icons-material/Person";
import AccountCircleIcon from "@mui/icons-material/AccountCircle";
+import ForumIcon from "@mui/icons-material/Forum";
import "./App.css";
import MoviePage from "./MoviePage";
import TVPage from "./TVPage";
@@ -19,9 +20,12 @@
import UserProfile from "./UserProfile";
import PublishPage from "./PublishPage";
import TorrentDetailPage from './TorrentDetailPage';
+import ForumPage from "./ForumPage";
+import PostDetailPage from "./PostDetailPage";
import LoginPage from './LoginPage';
import RegisterPage from './RegisterPage';
+
const navItems = [
{ label: "电影", icon: <MovieIcon />, path: "/movie" },
{ label: "剧集", icon: <EmailIcon />, path: "/tv" },
@@ -30,7 +34,8 @@
{ label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
{ label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
{ label: "资料", icon: <PersonIcon />, path: "/info" },
- { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, // Added Publish option
+ { label: "论坛", icon: <ForumIcon />, path: "/forum" },
+ { label: "发布", icon: <AccountCircleIcon />, path: "/publish" },
];
function Home() {
@@ -52,7 +57,6 @@
<span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
</div>
</div>
- {/* 下方内容整体下移,留出与电影界面一致的间距 */}
<div style={{ height: 32 }} />
<nav className="nav-bar card">
{navItems.map((item) => (
@@ -72,7 +76,6 @@
<span role="img" aria-label="search">🔍</span>
</button>
</div>
- {/* 删除高频搜索栏 */}
<div className="table-section card">
<table className="movie-table">
<thead>
@@ -153,6 +156,8 @@
<Route path="/anime" element={<AnimePage />} />
<Route path="/game" element={<GamePage />} />
<Route path="/sport" element={<SportPage />} />
+ <Route path="/forum" element={<ForumPage />} />
+ <Route path="/forum/:postId" element={<PostDetailPage />} />
<Route path="/info" element={<InfoPage />} />
<Route path="/user" element={<UserProfile />} />
<Route path="/publish" element={<PublishPage />} />
diff --git a/front/src/ForumPage.js b/front/src/ForumPage.js
new file mode 100644
index 0000000..ed94e0f
--- /dev/null
+++ b/front/src/ForumPage.js
@@ -0,0 +1,92 @@
+import React from "react";
+import { useNavigate } from "react-router-dom";
+
+// 示例数据
+const posts = [
+ {
+ post_id: "1",
+ title: "欢迎来到G10论坛",
+ content: "这里是G10 PT站的官方论坛,欢迎大家发帖交流!",
+ author_id: "u1",
+ author_name: "Alice",
+ created_at: "2024-06-01 12:00",
+ reply_count: 3,
+ view_count: 120,
+ },
+ {
+ post_id: "2",
+ title: "经典电影合集",
+ content: "90年代经典电影大家有什么推荐吗?",
+ author_id: "u2",
+ author_name: "Bob",
+ created_at: "2024-06-02 09:30",
+ reply_count: 1,
+ view_count: 45,
+ },
+];
+
+export default function ForumPage() {
+ const navigate = useNavigate();
+ return (
+ <div style={{ maxWidth: 700, margin: "40px auto" }}>
+ <div style={{ display: "flex", alignItems: "center", marginBottom: 24 }}>
+ <h2 style={{ color: "#1a237e", margin: 0, marginRight: 24 }}>G10 论坛</h2>
+ <input
+ type="text"
+ placeholder="搜索帖子内容"
+ style={{
+ flex: 1,
+ fontSize: 16,
+ padding: "8px 14px",
+ border: "1px solid #bfcfff",
+ borderRadius: 8,
+ outline: "none",
+ minWidth: 0,
+ }}
+ />
+ <button
+ style={{
+ marginLeft: 8,
+ fontSize: 16,
+ padding: "8px 18px",
+ border: "1px solid #bfcfff",
+ background: "#e0e7ff",
+ borderRadius: 8,
+ cursor: "pointer",
+ }}
+ >
+ 🔍
+ </button>
+ </div>
+ {posts.map(post => (
+ <div
+ key={post.post_id}
+ style={{
+ background: "#fff",
+ borderRadius: 12,
+ boxShadow: "0 2px 8px #e0e7ff",
+ padding: 24,
+ marginBottom: 24,
+ cursor: "pointer",
+ transition: "box-shadow 0.2s",
+ }}
+ onClick={() => navigate(`/forum/${post.post_id}`)}
+ >
+ <div style={{ fontSize: 15, color: "#1976d2", marginBottom: 6 }}>
+ {post.author_name} · {post.created_at}
+ </div>
+ <div style={{ fontWeight: 600, fontSize: 20, marginBottom: 8, color: "#222" }}>
+ {post.title}
+ </div>
+ <div style={{ fontSize: 16, color: "#444", marginBottom: 18 }}>
+ {post.content}
+ </div>
+ <div style={{ display: "flex", justifyContent: "flex-start", gap: 32, fontSize: 14, color: "#888" }}>
+ <span>回复数: {post.reply_count}</span>
+ <span>观看数: {post.view_count}</span>
+ </div>
+ </div>
+ ))}
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/front/src/PostDetailPage.js b/front/src/PostDetailPage.js
new file mode 100644
index 0000000..85b7707
--- /dev/null
+++ b/front/src/PostDetailPage.js
@@ -0,0 +1,114 @@
+import React from "react";
+import { useParams } from "react-router-dom";
+
+// 示例数据
+const post = {
+ post_id: "1",
+ title: "欢迎来到G10论坛",
+ content: "这里是G10 PT站的官方论坛,欢迎大家发帖交流!",
+ author_id: "u1",
+ author_name: "Alice",
+ created_at: "2024-06-01 12:00",
+ reply_count: 3,
+ view_count: 120,
+};
+
+const replies = [
+ {
+ reply_id: "r1",
+ post_id: "1",
+ content: "支持一下!",
+ author_id: "u2",
+ author_name: "Bob",
+ created_at: "2024-06-01 13:00",
+ },
+ {
+ reply_id: "r2",
+ post_id: "1",
+ content: "论坛终于上线了!",
+ author_id: "u3",
+ author_name: "Carol",
+ created_at: "2024-06-01 14:20",
+ },
+];
+
+export default function PostDetailPage() {
+ const { postId } = useParams();
+ // 这里只展示post和replies的静态内容
+ return (
+ <div style={{ maxWidth: 700, margin: "40px auto" }}>
+ {/* 原帖 */}
+ <div style={{
+ background: "#fff",
+ borderRadius: 12,
+ boxShadow: "0 2px 8px #e0e7ff",
+ padding: 24,
+ marginBottom: 32,
+ }}>
+ <div style={{ fontSize: 15, color: "#1976d2", marginBottom: 6 }}>
+ {post.author_name} · {post.created_at}
+ </div>
+ <div style={{ fontWeight: 600, fontSize: 20, marginBottom: 8, color: "#222" }}>
+ {post.title}
+ </div>
+ <div style={{ fontSize: 16, color: "#444", marginBottom: 18 }}>
+ {post.content}
+ </div>
+ <div style={{ display: "flex", justifyContent: "flex-start", gap: 32, fontSize: 14, color: "#888" }}>
+ <span>回复数: {post.reply_count}</span>
+ <span>观看数: {post.view_count}</span>
+ </div>
+ </div>
+ {/* 评论区 */}
+ <div>
+ {replies.map(reply => (
+ <div key={reply.reply_id} style={{
+ display: "flex",
+ alignItems: "center",
+ background: "#f8faff",
+ borderRadius: 8,
+ padding: "12px 18px",
+ marginBottom: 16,
+ fontSize: 15,
+ }}>
+ <span style={{ color: "#1976d2", fontWeight: 500, minWidth: 80 }}>{reply.author_name}</span>
+ <span style={{ flex: 1, marginLeft: 18 }}>{reply.content}</span>
+ <span style={{ color: "#888", fontSize: 13, marginLeft: 18 }}>{reply.created_at}</span>
+ </div>
+ ))}
+ </div>
+ {/* 回复框 */}
+ <div style={{
+ marginTop: 32,
+ background: "#fff",
+ borderRadius: 8,
+ boxShadow: "0 2px 8px #e0e7ff",
+ padding: 18,
+ display: "flex",
+ gap: 12,
+ alignItems: "center"
+ }}>
+ <input
+ type="text"
+ placeholder="写下你的回复..."
+ style={{
+ flex: 1,
+ border: "1px solid #bfcfff",
+ borderRadius: 6,
+ padding: "8px 12px",
+ fontSize: 15,
+ }}
+ />
+ <button style={{
+ background: "#1976d2",
+ color: "#fff",
+ border: "none",
+ borderRadius: 6,
+ padding: "8px 24px",
+ fontSize: 15,
+ cursor: "pointer"
+ }}>回复</button>
+ </div>
+ </div>
+ );
+}
\ No newline at end of file