修复公告模块的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
@@ -110,13 +110,13 @@ function getCategoryLabel(category: string) {
<div class="announcement-header">
<div class="announcement-meta">
<el-tag
:type="getCategoryInfo(item.category).value === 'notice' ? 'primary' : 'info'"
:type="getCategoryInfo(item.category)?.value === 'notice' ? 'primary' : 'info'"
effect="plain"
size="small"
class="category-tag"
:style="{ borderColor: getCategoryInfo(item.category).color, color: getCategoryInfo(item.category).color }"
:style="{ borderColor: getCategoryInfo(item.category)?.color || '#94a3b8', color: getCategoryInfo(item.category)?.color || '#94a3b8' }"
>
<el-icon><component :is="getCategoryInfo(item.category).icon" /></el-icon>
<el-icon><component :is="getCategoryInfo(item.category)?.icon || Bell" /></el-icon>
{{ getCategoryLabel(item.category) }}
</el-tag>
<el-tag v-if="item.is_pinned" type="warning" effect="plain" size="small">置顶</el-tag>