修改论坛
Change-Id: I93e5d0cb584d8f423d1056ee9a5b84a4ac5f4d07
diff --git a/src/pages/Forum/posts-detail/PostDetailPage.jsx b/src/pages/Forum/posts-detail/PostDetailPage.jsx
index 5186339..a272fb8 100644
--- a/src/pages/Forum/posts-detail/PostDetailPage.jsx
+++ b/src/pages/Forum/posts-detail/PostDetailPage.jsx
@@ -157,20 +157,25 @@
<div className="post-detail">
<h1>{postDetail.title}</h1>
<div className="post-meta">
+ <span className="post-user">用户ID: {postDetail.user_id}</span>
<span className="post-time">
- {new Date(postDetail.postTime).toLocaleString()}
+ 发布时间:{new Date(postDetail.postTime).toLocaleString()}
</span>
- <span className="post-user">用户 ID: {postDetail.user_id}</span>
</div>
<div className="post-content">
<p>{postDetail.postContent}</p>
- {postDetail.imgUrl && (
- <img
- className="post-image"
- src={postDetail.imgUrl}
- alt="帖子图片"
- />
+ {Array.isArray(postDetail.imgUrl) ? (
+ <div className="post-images">
+ {postDetail.imgUrl.map((url, idx) => (
+ <img key={idx} src={url} alt={`图片${idx}`} />
+ ))}
+ </div>
+ ) : (
+ postDetail.imgUrl && (
+ <img className="post-image" src={postDetail.imgUrl} alt="帖子图片" />
+ )
)}
+
</div>
{/* 点赞和收藏 */}
@@ -181,7 +186,7 @@
>
<GoodTwo
theme="outline"
- size="24"
+ size="20"
fill={isLiked ? '#f00' : '#ccc'} // 如果已点赞,显示红色
/>
<span>{postDetail.postLikeNum}</span>
@@ -192,28 +197,28 @@
>
<Star
theme="outline"
- size="24"
+ size="20"
fill={isCollected ? '#ffd700' : '#ccc'} // 如果已收藏,显示金色
/>
<span>{postDetail.postCollectNum}</span>
</button>
</div>
-
+
+ <hr className="divider" />
{/* 评论部分 */}
+ <h3>评论区</h3>
<div className="comments-section">
- <h3>评论区</h3>
{comments.length ? (
comments.map((comment) => (
<div key={comment.commentId} className="comment">
- <p>{comment.content}</p>
- <div className="comment-meta">
- <span className="comment-time">
- {new Date(comment.commentTime).toLocaleString()}
- </span>
+ <div className="comment-header">
<span className="comment-user">用户 ID: {comment.userId}</span>
+ <button className="reply-btn" onClick={() => handleReply(comment.commentId)}>回复</button>
</div>
- {/* 回复按钮 */}
- <button onClick={() => handleReply(comment.commentId)}>回复</button>
+ <p className="comment-content">{comment.content}</p>
+ <div className="comment-time">
+ {new Date(comment.commentTime).toLocaleString()}
+ </div>
{/* 回复框,只有在当前评论是正在回复的评论时显示 */}
{replyToCommentId === comment.commentId && (