提交室内导览交互与讲解优化

This commit is contained in:
lyf
2026-06-14 23:48:13 +08:00
parent a7c1879f60
commit feb7310a46
33 changed files with 3257 additions and 361 deletions

View File

@@ -89,7 +89,7 @@ export class DefaultExplainRepository implements ExplainRepository {
.map<SearchIndexItem>((exhibit) => ({
id: exhibit.id,
name: exhibit.name,
desc: `${exhibit.hallName || '讲解'} · ${exhibit.floorLabel || ''}`.trim(),
desc: `${exhibit.hallName || '展品讲解'} · ${exhibit.floorLabel || ''}`.trim(),
type: 'exhibit',
exhibitId: exhibit.id,
hallId: exhibit.hallId,
@@ -106,7 +106,7 @@ export class DefaultExplainRepository implements ExplainRepository {
.map<SearchIndexItem>((hall) => ({
id: hall.id,
name: hall.name,
desc: `${hall.floorLabel || ''} · ${hall.exhibitCount || 0}个讲解`.trim(),
desc: `${hall.floorLabel || ''} · ${hall.exhibitCount || 0}个讲解内容`.trim(),
type: 'hall',
hallId: hall.id,
poiId: hall.poiId,

View File

@@ -1,26 +1,45 @@
import type {
MediaAsset
} from '@/domain/museum'
import {
SGS_SCENE_EXPLAIN_DATASET
} from '@/data/mock/sgsSceneExplainData'
export interface MediaRepository {
getMediaById(id: string): Promise<MediaAsset | null>
getMediaForExplainTrack(trackId: string): Promise<MediaAsset | null>
}
const unavailableAudio = (id: string): MediaAsset => ({
const normalizeExhibitIdFromTrack = (trackId: string) => trackId
.replace(/^track-/, '')
.replace(/^exhibit-sgs-/, '')
const unavailableAudio = (id: string, reason = 'SGS 场景设置音频资源尚未同步到当前 H5 项目'): MediaAsset => ({
id,
type: 'audio',
available: false,
unavailableReason: '正式讲解音频尚未接入媒体仓储'
unavailableReason: reason
})
const findSourceAudioById = (id: string) => {
const normalizedId = id.replace(/^media-/, '')
const exhibitSourceId = normalizeExhibitIdFromTrack(normalizedId)
return SGS_SCENE_EXPLAIN_DATASET.exhibits.find((exhibit) => String(exhibit.id) === exhibitSourceId)
}
export class DefaultMediaRepository implements MediaRepository {
async getMediaById(id: string) {
return unavailableAudio(id)
const source = findSourceAudioById(id)
if (source?.audioUrl) {
return unavailableAudio(id, `SGS 场景设置源数据包含音频地址 ${source.audioUrl},但该静态音频尚未同步到当前 H5 项目。`)
}
return unavailableAudio(id, '该讲解在 SGS 场景设置源数据中暂无音频地址')
}
async getMediaForExplainTrack(trackId: string) {
return unavailableAudio(`media-${trackId}`)
return this.getMediaById(`media-${trackId}`)
}
}

View File

@@ -81,7 +81,7 @@ export class DefaultMuseumContentRepository implements MuseumContentRepository {
.map<SearchIndexItem>((exhibit) => ({
id: exhibit.id,
name: exhibit.name,
desc: `${exhibit.hallName || '讲解'} · ${exhibit.floorLabel || ''}`.trim(),
desc: `${exhibit.hallName || '展品讲解'} · ${exhibit.floorLabel || ''}`.trim(),
type: 'exhibit',
exhibitId: exhibit.id,
poiId: exhibit.poiId,
@@ -97,7 +97,7 @@ export class DefaultMuseumContentRepository implements MuseumContentRepository {
.map<SearchIndexItem>((hall) => ({
id: hall.id,
name: hall.name,
desc: `${hall.floorLabel || ''} · ${hall.exhibitCount || 0}个讲解`.trim(),
desc: `${hall.floorLabel || ''} · ${hall.exhibitCount || 0}个讲解内容`.trim(),
type: 'hall',
hallId: hall.id,
poiId: hall.poiId,