chore: freeze guide and explain update

This commit is contained in:
lyf
2026-06-24 18:00:25 +08:00
parent feb7310a46
commit 67c6609ae6
104 changed files with 3203572 additions and 40713 deletions

View File

@@ -1,4 +1,5 @@
import type {
GuideLocationResolution,
MuseumExhibit,
MuseumHall,
SearchIndexItem
@@ -14,15 +15,19 @@ export interface ExplainCardViewModel {
summary?: string
coverImage?: string
contentType: ExplainContentType
hallId?: string
hallName?: string
floorLabel?: string
durationLabel?: string
audioUrl?: string
audioDuration?: number
languageLabel?: string
audioStatus: ExplainAudioStatus
audioStatusText: string
badges: string[]
progress?: number
poiId?: string
location?: GuideLocationResolution
locationActionText?: string
}
@@ -49,11 +54,7 @@ export interface ExplainDetailPageViewModel {
startTime?: number
}>
transcript?: string
location?: {
poiId: string
actionText: string
previewOnly: boolean
}
location?: GuideLocationResolution
relatedItems: ExplainCardViewModel[]
}
@@ -69,6 +70,7 @@ export interface HallDetailViewModel {
exhibitCount: number
area?: string
poiId?: string
location?: GuideLocationResolution
}
const contentTypeFor = (exhibit: MuseumExhibit): ExplainContentType => {
@@ -85,7 +87,7 @@ const buildSubtitle = (exhibit: MuseumExhibit) => [
const buildBadges = (exhibit: MuseumExhibit) => {
const badges = [
exhibit.hallName ? '空间讲解' : '展品讲解',
exhibit.hallName ? '展厅内容' : '展品讲解',
exhibit.floorLabel || '',
...(exhibit.tags || [])
].filter(Boolean)
@@ -94,39 +96,45 @@ const buildBadges = (exhibit: MuseumExhibit) => {
}
export const toExplainCardViewModel = (exhibit: MuseumExhibit): ExplainCardViewModel => {
const sourceHasAudio = exhibit.tags?.includes('源数据含音频地址') === true
const hasPlayableAudio = exhibit.audioAvailable === true || Boolean(exhibit.audioUrl)
const audioStatus: ExplainAudioStatus = hasPlayableAudio ? 'playable' : 'unavailable'
const location = exhibit.location
return {
id: exhibit.id,
title: exhibit.name,
subtitle: buildSubtitle(exhibit),
summary: exhibit.description || '讲解内容来自 SGS 场景设置数据,正式 CMS 文案接入后可继续替换。',
summary: exhibit.guideText || exhibit.description || '该展项暂无讲解文稿。',
coverImage: exhibit.image,
contentType: contentTypeFor(exhibit),
hallId: exhibit.hallId,
hallName: exhibit.hallName,
floorLabel: exhibit.floorLabel,
durationLabel: undefined,
durationLabel: exhibit.audioDuration ? `${Math.round(exhibit.audioDuration)}` : undefined,
audioUrl: exhibit.audioUrl,
audioDuration: exhibit.audioDuration,
languageLabel: '中文',
audioStatus: 'unavailable',
audioStatusText: sourceHasAudio ? '音频待同步' : '图文讲解',
audioStatus,
audioStatusText: hasPlayableAudio ? '可播放' : '图文讲解',
badges: buildBadges(exhibit),
progress: undefined,
poiId: exhibit.poiId,
locationActionText: exhibit.poiId ? '查看位置' : undefined
poiId: location?.poiId || exhibit.poiId,
location,
locationActionText: location?.actionText
}
}
export const toExplainExhibitViewModel = (exhibit: MuseumExhibit): ExplainExhibitViewModel => toExplainCardViewModel(exhibit)
export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDetailPageViewModel => {
const sourceHasAudio = exhibit.tags?.includes('源数据含音频地址') === true
const hasPlayableAudio = exhibit.audioAvailable === true || Boolean(exhibit.audioUrl)
const metadataLines = [
exhibit.size ? `展品编号:${exhibit.size}` : '',
exhibit.year ? `年代:${exhibit.year}` : '',
exhibit.material ? `来源:${exhibit.material}` : ''
].filter(Boolean)
const body = [
exhibit.description || '该讲解内容来自 SGS 场景设置数据,正式 CMS 文案接入后可继续替换。',
exhibit.guideText || exhibit.description || '该展项暂无讲解文稿。',
metadataLines.join('\n')
].filter(Boolean).join('\n\n')
@@ -138,14 +146,14 @@ export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDet
coverImages: [exhibit.image || '/static/exhibit-placeholder.jpg'].filter(Boolean),
hallName: exhibit.hallName,
floorLabel: exhibit.floorLabel,
summary: exhibit.description || '该讲解内容来自 SGS 场景设置数据。',
summary: exhibit.guideText || exhibit.description || '该展项暂无讲解文稿。',
body,
audio: {
status: 'unavailable',
status: hasPlayableAudio ? 'playable' : 'unavailable',
url: exhibit.audioUrl,
durationLabel: exhibit.audioDuration ? `${Math.round(exhibit.audioDuration)}` : undefined,
language: 'zh-CN',
unavailableReason: sourceHasAudio
? 'SGS 场景设置源数据包含音频地址,但静态音频文件尚未同步到当前 H5 项目。'
: '该讲解在 SGS 场景设置源数据中暂无音频地址。'
unavailableReason: hasPlayableAudio ? undefined : '该展项暂无已发布音频,当前提供图文讲解。'
},
chapters: metadataLines.length
? metadataLines.map((line, index) => ({
@@ -153,14 +161,8 @@ export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDet
title: line
}))
: [],
transcript: exhibit.description,
location: exhibit.poiId
? {
poiId: exhibit.poiId,
actionText: '查看三维位置',
previewOnly: true
}
: undefined,
transcript: exhibit.guideText || exhibit.description,
location: exhibit.location,
relatedItems: []
}
}
@@ -171,11 +173,12 @@ export const toHallDetailViewModel = (hall: MuseumHall): HallDetailViewModel =>
id: hall.id,
name: hall.name,
floorLabel: hall.floorLabel || '楼层待补充',
description: hall.description || '该空间介绍待 SGS 场景设置或 CMS 内容补充。',
description: hall.description || '该展厅暂无介绍文案。',
image: hall.image || '/static/hall-placeholder.jpg',
exhibitCount: hall.exhibitCount || 0,
area: hall.area,
poiId: hall.poiId
poiId: hall.location?.poiId || hall.poiId,
location: hall.location
})
export const toExplainSearchResultViewModel = (item: SearchIndexItem) => ({

View File

@@ -26,11 +26,17 @@ export interface TargetPoiFocusRequestViewModel extends GuideLocationPreview {
requestId: number | string
}
const locationCapabilityText = (poi: MuseumPoi) => (
poi.navigationReadiness && poi.navigationReadiness !== 'route_graph_ready'
? poi.navigationReadiness
: '三维位置'
)
export const toFacilityResultViewModel = (poi: MuseumPoi): FacilityResultViewModel => ({
id: poi.id,
name: poi.name,
floor: poi.floorLabel,
meta: `${poi.floorLabel}${poi.primaryCategory.label}${poi.navigationReadiness || '展示点位'}`,
meta: `${poi.floorLabel}${poi.primaryCategory.label}${locationCapabilityText(poi)}`,
accessible: poi.accessible,
action: '查看'
})
@@ -63,7 +69,7 @@ export const initialLocationPreviewPlan = (): GuideLocationPreviewPlan => ({
id: 'route-custom',
facilityId: '',
target: '目标地点',
summary: '位置预览 · 尚未接入正式路线图',
summary: '位置预览 · 请选择目标点位',
steps: [],
targetLocation: null,
startLocation: null