fix(badges): complete full-chain badge circuit and preset icons

Close the full circuit break in the badge/medal system and replace
empty default icons with preset SVG assets so badges render out of
the box:

- Add aksrt_get_worn_medal_icon() helper that renders the worn medal
  image inline (with settings fallback when the Badges class is
  unavailable).
- Profile header (UC) now shows the worn medal icon beside the name,
  matching zibll's name row order (display_name → VIP → Medal → Level → Verify).
- Add .medal-icon / .aksrt-identity-medal vertical-align rules in UC shell.css.
- Extract SchemaUsers::default_medal_args() and preset 6 badges (rookie,
  checkin-30, writer, popular, annual-star, vip-member) with real icon
  URLs from assets/img/medal/ (medal-1/2/5/9/12/15.svg).
- Vue badge.js: add MEDAL_BASE helper + preset icons matching PHP defaults.
This commit is contained in:
2026-08-04 10:36:50 +08:00
parent 8318e02f77
commit e991f1a0c6
5 changed files with 215 additions and 39 deletions
@@ -17,6 +17,14 @@ export const MEDAL_GET_TYPES = [
{ label: '仅手动授予', value: 'manually_add' },
]
// Resolve medal SVG asset path from theme assets when running in admin context.
const MEDAL_BASE = (() => {
const root = window.aksrtAdminData?.themeUri || ''
return root ? String(root).replace(/\/$/, '') + '/assets/img/medal' : '/assets/img/medal'
})()
const medalIcon = (n) => `${MEDAL_BASE}/medal-${n}.svg`
export const defaultMedalArgs = () => [
{
cat_name: '成长',
@@ -25,7 +33,7 @@ export const defaultMedalArgs = () => [
slug: 'rookie',
name: '初出茅庐',
desc: '注册时间超过30天',
icon: '',
icon: medalIcon(1),
get_type: 'registration_time',
get_val: 30,
},
@@ -33,10 +41,26 @@ export const defaultMedalArgs = () => [
slug: 'checkin-30',
name: '签到达人',
desc: '累计签到30天',
icon: '',
icon: medalIcon(2),
get_type: 'checkin_all_day',
get_val: 30,
},
{
slug: 'writer',
name: '创作先锋',
desc: '发布10篇文章',
icon: medalIcon(5),
get_type: 'new_post',
get_val: 10,
},
{
slug: 'popular',
name: '人气之星',
desc: '累计获得100次点赞',
icon: medalIcon(9),
get_type: 'like',
get_val: 100,
},
],
},
{
@@ -46,7 +70,15 @@ export const defaultMedalArgs = () => [
slug: 'annual-star',
name: '年度人气达人',
desc: '活动限定徽章',
icon: '',
icon: medalIcon(12),
get_type: 'manually_add',
get_val: 0,
},
{
slug: 'vip-member',
name: '尊贵会员',
desc: '给予 VIP 用户的特殊徽章',
icon: medalIcon(15),
get_type: 'manually_add',
get_val: 0,
},