修复公告模块的TypeScript错误和API调用

- 使用 apiClient 替换不存在的 apiRequest
- 修复可能为 undefined 的对象访问
- 添加可选链操作符和默认值

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
yml
2026-06-05 20:43:42 +08:00
co-authored by Claude Opus 4.6
parent 61acaba492
commit 38a8cc3d6c
3 changed files with 12 additions and 14 deletions
@@ -68,11 +68,11 @@ function getCategoryLabel(category: string) {
size="small"
class="category-tag"
:style="{
borderColor: getCategoryInfo(announcement.category).color,
color: getCategoryInfo(announcement.category).color
borderColor: getCategoryInfo(announcement.category)?.color || '#94a3b8',
color: getCategoryInfo(announcement.category)?.color || '#94a3b8'
}"
>
<el-icon><component :is="getCategoryInfo(announcement.category).icon" /></el-icon>
<el-icon><component :is="getCategoryInfo(announcement.category)?.icon || Bell" /></el-icon>
{{ getCategoryLabel(announcement.category) }}
</el-tag>
<el-tag v-if="announcement.is_pinned" type="warning" effect="plain" size="small">置顶</el-tag>