diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts
index 6165ae2..a38e9a3 100644
--- a/frontend/src/api/client.ts
+++ b/frontend/src/api/client.ts
@@ -81,6 +81,10 @@ export const api = {
request<{ message: string; pinned: boolean }>(`/api/admin/posts/${id}/pin`, {
method: 'POST', body: JSON.stringify({ pinned }),
}),
+ adminBoardPinPost: (id: number, boardPinned: boolean) =>
+ request<{ message: string; board_pinned: boolean }>(`/api/admin/posts/${id}/board-pin`, {
+ method: 'POST', body: JSON.stringify({ board_pinned: boardPinned }),
+ }),
adminFeaturePost: (id: number, featured: boolean) =>
request<{ message: string; featured: boolean }>(`/api/admin/posts/${id}/feature`, {
method: 'POST', body: JSON.stringify({ featured }),
diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts
index 8fb7372..4045d44 100644
--- a/frontend/src/api/types.ts
+++ b/frontend/src/api/types.ts
@@ -89,6 +89,8 @@ export interface PostItem {
/** 仅问答帖有意义 */
question_resolved?: boolean;
pinned: boolean;
+ /** 板块内置顶(仅板块列表抬升,首页不抬升) */
+ board_pinned?: boolean;
featured?: boolean;
edit_locked?: boolean;
status?: 'pending' | 'published' | 'rejected' | string;
diff --git a/frontend/src/components/PostListItem.tsx b/frontend/src/components/PostListItem.tsx
index de57803..8fb60c3 100644
--- a/frontend/src/components/PostListItem.tsx
+++ b/frontend/src/components/PostListItem.tsx
@@ -78,7 +78,10 @@ function PostListItem({ post, sort = 'latest', onSelect }: Props) {
{post.pinned && (
-
置顶
+
全局置顶
+ )}
+ {post.board_pinned && (
+
板块置顶
)}
{post.featured && (
diff --git a/frontend/src/pages/PostDetailPage.tsx b/frontend/src/pages/PostDetailPage.tsx
index e93537a..36439f1 100644
--- a/frontend/src/pages/PostDetailPage.tsx
+++ b/frontend/src/pages/PostDetailPage.tsx
@@ -475,6 +475,19 @@ export default function PostDetailPage() {
}
};
+ const handleBoardPin = async () => {
+ if (!post) return;
+ try {
+ const r = await api.adminBoardPinPost(postId, !post.board_pinned);
+ setPost(p => p ? { ...p, board_pinned: r.board_pinned } : p);
+ clearAllFeedCache();
+ window.dispatchEvent(new Event('posts-refresh'));
+ notify.success(r.message);
+ } catch (e: unknown) {
+ notify.error(e instanceof Error ? e.message : '操作失败');
+ }
+ };
+
const handleFeature = async () => {
if (!post) return;
try {
@@ -601,7 +614,10 @@ export default function PostDetailPage() {
{post.pinned && (
- 置顶
+ 全局置顶
+ )}
+ {post.board_pinned && (
+ 板块置顶
)}
{post.featured && }
{post.status === 'pending' && 审核中}
@@ -792,7 +808,11 @@ export default function PostDetailPage() {
+
@@ -316,7 +328,8 @@ export default function AdminPostsPage() {
标签 |
评论 |
精华 |
-
置顶 |
+
全局置顶 |
+
板块置顶 |
锁定 |
点赞 |
浏览 |
@@ -348,6 +361,7 @@ export default function AdminPostsPage() {
{p.comment_count ?? 0} |
{p.featured ? 是 : '—'} |
{p.pinned ? 是 : '—'} |
+
{p.board_pinned ? 是 : '—'} |
{p.edit_locked ? 是 : '—'} |
{p.like_count} |
{p.view_count} |
@@ -373,7 +387,10 @@ export default function AdminPostsPage() {
{p.featured ? '取消精华' : '精华'}
+