论坛帖子列表

Change-Id: I69535db13798ec52939f047604357c5fe363e8cd

论坛帖子列表

Change-Id: Ie02a0bfee862cb46667f2c6cd069dab21e84eb6b

论坛帖子列表

Change-Id: I69535db13798ec52939f047604357c5fe363e8cd
diff --git a/src/pages/Forum/PostDetail.jsx b/src/pages/Forum/PostDetail.jsx
new file mode 100644
index 0000000..f7067bf
--- /dev/null
+++ b/src/pages/Forum/PostDetail.jsx
@@ -0,0 +1,29 @@
+import React, { useState, useEffect } from'react';
+import axios from 'axios';
+
+const PostDetail = ({ post_id }) => {
+  const [post, setPost] = useState({});
+
+  useEffect(() => {
+    const fetchPost = async () => {
+      try {
+        const response = await axios.get(`/echo/forum/posts/${post_id}`);
+        setPost(response.data);
+      } catch (error) {
+        console.error('Error fetching post detail:', error);
+      }
+    };
+    fetchPost();
+  }, [post_id]);
+
+  return (
+    <div>
+      <h1>{post.title}</h1>
+      <p>作者: {post.author}</p>
+      <p>内容: {post.Postcontent}</p>
+      {post.imgUrl && <img src={post.imgUrl} alt={post.title} />}
+    </div>
+  );
+};
+
+export default PostDetail;
\ No newline at end of file