feat(display): 分项成绩与个人榜也显示单位 logo(个人榜在姓名前)

- 服务端补下发:dto.EventResultRow 与 athleteStandingDTO 各加 logoPath,
  分别取「该行单位」与「该运动员所属单位」的 teams.logo_path;空串统一收敛为 null
- 大屏抽出 TeamLogo.vue(1em / object-fit:contain / 加载失败保留占位、@load 复原),
  原先在积分榜与团体奖牌榜各写一遍的逻辑收敛成一份,四处复用
- 分项成绩页:单位列名字前显示 logo;个人积分榜:运动员姓名前显示其单位 logo
- guards/mock 同步解析与补字段;补 11 条测试(类型解析 + SFC 模板断言)

顺带修:管理端示例数据 athleteStandings 缺新必填字段导致的 vue-tsc 报错。

自检:服务端 11 包全绿;前端 vue-tsc + build、node --test 80/80。
This commit is contained in:
AskaEth committed 2026-09-10 10:32:19 +08:00
1 parent 6f47849e1e
commit 8c74a82da4
17 files changed
+391 -51

No files matched your search

+4 -2
View File
@@ -366,7 +366,7 @@ func loadLatestResults(ctx context.Context, tx *sql.Tx, snap *Snapshot) error {
e.category_id, COALESCE(cat.name, ''),
COALESCE(r.verified_at, r.recorded_at, r.updated_at, r.created_at, ''),
r.entry_id, r.rank, e.team_id,
COALESCE(t.code, ''), COALESCE(t.name, ''), COALESCE(t.short_name, ''),
COALESCE(t.code, ''), COALESCE(t.name, ''), COALESCE(t.short_name, ''), t.logo_path,
e.athlete_id, COALESCE(a.name, ''), COALESCE(e.member_names, ''),
COALESCE(r.result_text, ''), r.result_value, COALESCE(r.unit, ''), r.is_tie, r.status
FROM results r
@@ -401,11 +401,12 @@ func loadLatestResults(ctx context.Context, tx *sql.Tx, snap *Snapshot) error {
athleteID sql.NullInt64
athleteName string
shortName string
logoPath sql.NullString
memberNames string
isTie int
)
if err := rows.Scan(&eventID, &eventCode, &eventName, &categoryID, &categoryName, &publishedAt,
&row.EntryID, &rank, &row.TeamID, &row.TeamCode, &row.TeamName, &shortName,
&row.EntryID, &rank, &row.TeamID, &row.TeamCode, &row.TeamName, &shortName, &logoPath,
&athleteID, &athleteName, &memberNames,
&row.ResultText, &value, &row.Unit, &isTie, &row.Status); err != nil {
return fmt.Errorf("解析最新成绩: %w", err)
@@ -424,6 +425,7 @@ func loadLatestResults(ctx context.Context, tx *sql.Tx, snap *Snapshot) error {
}
row.AthleteName = nilIfEmpty(athleteName)
row.ShortName = nilIfEmpty(shortName)
row.LogoPath = nilIfEmpty(logoPath.String)
row.MemberNames = parseMemberNames(memberNames)
row.IsTie = isTie != 0