feat: 实现公告板功能

- 后端:从 GitHub Issues API 获取公告数据
  - 支持筛选指定 assignees 的评论
  - 支持排除指定 issue 的评论
  - 从评论第一行提取标题(移除 Markdown 格式)
  - 支持获取 reactions 数据(+1、heart、laugh 等)
  - 实现 10 分钟缓存机制
  - 强制刷新时,如果被限流则保留缓存数据
  - 添加 GitHub API 健康检查

- 前端:公告列表和详情页面
  - 响应式设计(移动端和桌面端)
  - 移动端使用侧边抽屉显示列表
  - 支持 Markdown 渲染
  - 支持内容折叠(超过 30 行)
  - 显示 reactions(使用 emoji)
  - 添加刷新按钮(支持强制刷新)
  - 公告菜单项放在第一位
  - 默认页面改为公告页

- 其他:
  - 更新 favicon 为 SVG 格式
  - 添加 GitHub API 限流方案文档
  - 添加 GitHub Token 配置文档
This commit is contained in:
WrBug
2025-12-07 16:15:59 +08:00
parent 89e3c726b2
commit 07d1b50b9b
20 changed files with 3535 additions and 14 deletions
+59
View File
@@ -613,6 +613,65 @@ export const apiService = {
*/
getAutoRedeemStatus: () =>
apiClient.post<ApiResponse<{ enabled: boolean }>>('/system/config/auto-redeem/status', {})
},
/**
* 公告 API
*/
announcements: {
/**
* 获取公告列表(最近10条)
*/
list: (data?: { forceRefresh?: boolean }) =>
apiClient.post<ApiResponse<{
list: Array<{
id: number
title: string
body: string
author: string
authorAvatarUrl?: string
createdAt: number
updatedAt: number
reactions?: {
plusOne?: number
minusOne?: number
laugh?: number
confused?: number
heart?: number
hooray?: number
eyes?: number
rocket?: number
total?: number
}
}>
hasMore: boolean
total: number
}>>('/announcements/list', data || {}),
/**
* 获取公告详情
*/
detail: (data: { id?: number; forceRefresh?: boolean }) =>
apiClient.post<ApiResponse<{
id: number
title: string
body: string
author: string
authorAvatarUrl?: string
createdAt: number
updatedAt: number
reactions?: {
plusOne?: number
minusOne?: number
laugh?: number
confused?: number
heart?: number
hooray?: number
eyes?: number
rocket?: number
total?: number
}
}>>('/announcements/detail', data)
}
}