提交H5业务闭环修复代码

This commit is contained in:
lyf
2026-07-01 16:02:21 +08:00
parent c43aa00038
commit e0aeafe062
26 changed files with 396 additions and 95 deletions

View File

@@ -4,6 +4,10 @@ import type {
MuseumHall,
SearchIndexItem
} from '@/domain/museum'
import {
EXHIBIT_PLACEHOLDER_IMAGE,
HALL_PLACEHOLDER_IMAGE
} from '@/utils/placeholders'
export type ExplainContentType = 'hall' | 'zone' | 'exhibit' | 'theme'
export type ExplainAudioStatus = 'playable' | 'unavailable' | 'none'
@@ -108,8 +112,10 @@ const languageLabelFor = (language?: string) => {
return language || undefined
}
const hasPlayableAudioUrl = (exhibit: MuseumExhibit) => Boolean(exhibit.audioUrl?.trim())
export const toExplainCardViewModel = (exhibit: MuseumExhibit): ExplainCardViewModel => {
const hasPlayableAudio = exhibit.audioAvailable === true || Boolean(exhibit.audioUrl)
const hasPlayableAudio = hasPlayableAudioUrl(exhibit)
const audioStatus: ExplainAudioStatus = hasPlayableAudio ? 'playable' : 'unavailable'
const location = exhibit.location
@@ -140,7 +146,7 @@ export const toExplainCardViewModel = (exhibit: MuseumExhibit): ExplainCardViewM
export const toExplainExhibitViewModel = (exhibit: MuseumExhibit): ExplainExhibitViewModel => toExplainCardViewModel(exhibit)
export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDetailPageViewModel => {
const hasPlayableAudio = exhibit.audioAvailable === true || Boolean(exhibit.audioUrl)
const hasPlayableAudio = hasPlayableAudioUrl(exhibit)
const metadataLines = [
exhibit.size ? `展品编号:${exhibit.size}` : '',
exhibit.year ? `年代:${exhibit.year}` : '',
@@ -157,7 +163,7 @@ export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDet
title: exhibit.name,
subtitle: buildSubtitle(exhibit),
contentType: contentTypeFor(exhibit),
coverImages: [exhibit.image || '/static/exhibit-placeholder.jpg'].filter(Boolean),
coverImages: [exhibit.image || EXHIBIT_PLACEHOLDER_IMAGE].filter(Boolean),
hallId: exhibit.hallId,
hallName: exhibit.hallName,
floorLabel: exhibit.floorLabel,
@@ -191,7 +197,7 @@ export const toHallDetailViewModel = (hall: MuseumHall): HallDetailViewModel =>
name: hall.name,
floorLabel: hall.floorLabel || '楼层待补充',
description: hall.description || '该展厅暂无介绍文案。',
image: hall.image || '/static/hall-placeholder.jpg',
image: hall.image || HALL_PLACEHOLDER_IMAGE,
exhibitCount: hall.exhibitCount || 0,
area: hall.area,
poiId: hall.location?.poiId || hall.poiId,