feat(achievement): 成就图标改用 iconify 渲染
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

机房的老浏览器缺 emoji 字体,成就图标会渲染成方块。后端的 icon 字段
改存 iconify 图标名(noto 集),前端统一走新的 AchievementIcon 组件
渲染成 SVG。

组件按三种形态判断:图片 URL 走 img,含冒号走 Icon,其余当纯文本兜底,
所以存量的 emoji 数据不会瞎掉。

顺带修好解锁弹窗:题单奖章的 icon 是图片 URL,之前当文本渲染,会把
一串路径直接显示出来。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 19:20:10 -06:00
parent 0ba25dc4e3
commit 0932a05850
6 changed files with 100 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import AchievementIcon from "shared/components/AchievementIcon.vue"
import type { Achievement } from "utils/types"
const props = defineProps<{ achievement: Achievement }>()
@@ -67,7 +68,9 @@ const unlockDate = computed(() => {
:style="{ borderColor: RARITY_COLOR[achievement.rarity] }"
>
<div class="row">
<div class="icon">{{ achievement.icon }}</div>
<div class="icon">
<AchievementIcon :icon="achievement.icon" :size="32" />
</div>
<div class="body">
<div class="title">
<span class="name">{{ achievement.name }}</span>