提交H5业务闭环修复代码
This commit is contained in:
@@ -8,6 +8,10 @@ import type {
|
||||
import {
|
||||
normalizeSameOriginPublicUrl
|
||||
} from '@/utils/publicUrl'
|
||||
import {
|
||||
EXHIBIT_PLACEHOLDER_IMAGE,
|
||||
HALL_PLACEHOLDER_IMAGE
|
||||
} from '@/utils/placeholders'
|
||||
|
||||
export interface BackendGuideContent {
|
||||
id?: string | number | null
|
||||
@@ -147,8 +151,10 @@ export const toBackendMuseumExhibit = (
|
||||
const targetType = normalizeAudioTargetType(guide?.targetType || source.playTargetType)
|
||||
const targetId = stringifyId(guide?.targetId || source.playTargetId)
|
||||
const supportedLanguage = source.supportedLanguages?.find((language) => language === 'zh-CN' || language === 'en-US')
|
||||
const hasAudioSummary = source.hasAudio === true && isAudioReady(source.audioStatus)
|
||||
const audioAvailable = Boolean(audioUrl) || hasAudioSummary
|
||||
const metadataSuggestsAudio = source.hasAudio === true && isAudioReady(source.audioStatus)
|
||||
const audioAvailable = Boolean(audioUrl)
|
||||
const sourcePoiId = stringifyId(source.poiId)
|
||||
const location = hall?.location
|
||||
|
||||
return {
|
||||
id,
|
||||
@@ -157,9 +163,11 @@ export const toBackendMuseumExhibit = (
|
||||
hallName: firstText(source.hallName, hall?.name),
|
||||
floorId: stringifyId(source.floorId) || hall?.floorId,
|
||||
floorLabel: firstText(source.floorLabel, hall?.floorLabel),
|
||||
image: resolveImage(source) || '/static/exhibit-placeholder.jpg',
|
||||
image: resolveImage(source) || EXHIBIT_PLACEHOLDER_IMAGE,
|
||||
description: firstText(source.description, source.narrationText, source.scientificName, '该展项暂无讲解文稿。'),
|
||||
poiId: stringifyId(source.poiId) || undefined,
|
||||
poiId: sourcePoiId || location?.poiId || undefined,
|
||||
sourcePoiId: sourcePoiId || location?.sourcePoiId,
|
||||
location,
|
||||
year: firstText(source.era) || undefined,
|
||||
material: firstText(source.origin) || undefined,
|
||||
size: firstText(source.exhibitCode, source.dimensions) || undefined,
|
||||
@@ -173,7 +181,9 @@ export const toBackendMuseumExhibit = (
|
||||
audioText: options.includeDetail && guideText ? guideText : undefined,
|
||||
audioHasText: options.includeDetail ? Boolean(guideText) : undefined,
|
||||
audioAvailable,
|
||||
audioUnavailableReason: audioAvailable ? undefined : '该讲解暂无已发布音频,当前提供图文讲解。',
|
||||
audioUnavailableReason: audioAvailable || metadataSuggestsAudio
|
||||
? undefined
|
||||
: '该讲解暂无已发布音频,当前提供图文讲解。',
|
||||
playTargetType: targetType,
|
||||
playTargetId: targetId || undefined
|
||||
}
|
||||
@@ -189,7 +199,7 @@ export const toBackendExplainTrack = (exhibit: MuseumExhibit): ExplainTrack => (
|
||||
coverImage: exhibit.image,
|
||||
poiId: exhibit.poiId,
|
||||
floorId: exhibit.floorId,
|
||||
available: Boolean(exhibit.audioUrl) || exhibit.audioAvailable === true,
|
||||
available: Boolean(exhibit.audioUrl),
|
||||
playTargetType: exhibit.playTargetType,
|
||||
playTargetId: exhibit.playTargetId
|
||||
})
|
||||
@@ -219,7 +229,7 @@ export const toBackendHall = (
|
||||
floorId: firstText(first?.floorId, fallback?.floorId) || undefined,
|
||||
floorLabel: firstText(first?.floorLabel, fallback?.floorLabel, '楼层待补充'),
|
||||
description: fallback?.description || '该展厅讲解内容来自后端展品接口。',
|
||||
image: fallback?.image || '/static/hall-placeholder.jpg',
|
||||
image: fallback?.image || HALL_PLACEHOLDER_IMAGE,
|
||||
exhibitCount: exhibits.length,
|
||||
area: fallback?.area,
|
||||
poiId: fallback?.poiId,
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import type {
|
||||
ExplainTrack,
|
||||
MediaAsset,
|
||||
MuseumExhibit,
|
||||
MuseumHall
|
||||
MuseumExhibit
|
||||
} from '@/domain/museum'
|
||||
import {
|
||||
dataSourceConfig
|
||||
|
||||
Reference in New Issue
Block a user