This commit is contained in:
@@ -61,6 +61,9 @@ export interface ExplainDetailPageViewModel {
|
||||
statusText?: string
|
||||
}
|
||||
imageStatus?: string
|
||||
linkedExhibitCount?: number
|
||||
isSharedStop?: boolean
|
||||
linkedExhibitStatusText?: string
|
||||
linkedExhibits?: Array<{
|
||||
id: string
|
||||
name: string
|
||||
@@ -128,9 +131,9 @@ const languageLabelFor = (language?: string) => {
|
||||
}
|
||||
|
||||
const isAudioReady = (exhibit: MuseumExhibit) => (
|
||||
exhibit.audioStatus === 'READY'
|
||||
|| exhibit.audioAvailable === true
|
||||
|| Boolean(exhibit.audioUrl?.trim())
|
||||
exhibit.audioStatus
|
||||
? exhibit.audioStatus === 'READY'
|
||||
: exhibit.audioAvailable === true || Boolean(exhibit.audioUrl?.trim())
|
||||
)
|
||||
|
||||
export const toExplainCardViewModel = (exhibit: MuseumExhibit): ExplainCardViewModel => {
|
||||
@@ -153,7 +156,7 @@ export const toExplainCardViewModel = (exhibit: MuseumExhibit): ExplainCardViewM
|
||||
audioDuration: exhibit.audioDuration,
|
||||
languageLabel: languageLabelFor(exhibit.audioLanguage),
|
||||
audioStatus,
|
||||
audioStatusText: hasPlayableAudio ? '可播放' : '图文讲解',
|
||||
audioStatusText: hasPlayableAudio ? '可播放' : exhibit.audioUnavailableReason || '当前语言暂无语音讲解',
|
||||
playTargetType: exhibit.playTargetType,
|
||||
playTargetId: exhibit.playTargetId,
|
||||
badges: buildBadges(exhibit),
|
||||
@@ -168,6 +171,14 @@ export const toExplainExhibitViewModel = (exhibit: MuseumExhibit): ExplainExhibi
|
||||
|
||||
export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDetailPageViewModel => {
|
||||
const hasPlayableAudio = isAudioReady(exhibit)
|
||||
const linkedExhibitCount = typeof exhibit.linkedExhibitCount === 'number'
|
||||
? exhibit.linkedExhibitCount
|
||||
: exhibit.linkedExhibits?.length
|
||||
const linkedExhibitStatusText = linkedExhibitCount
|
||||
? exhibit.isSharedStop
|
||||
? `${linkedExhibitCount} 件展品共用此讲解点`
|
||||
: `关联 ${linkedExhibitCount} 件展品`
|
||||
: undefined
|
||||
const metadataLines = [
|
||||
exhibit.size ? `展品编号:${exhibit.size}` : '',
|
||||
exhibit.year ? `年代:${exhibit.year}` : '',
|
||||
@@ -204,9 +215,12 @@ export const toExplainDetailPageViewModel = (exhibit: MuseumExhibit): ExplainDet
|
||||
playTargetType: exhibit.playTargetType,
|
||||
playTargetId: exhibit.playTargetId,
|
||||
hasText: exhibit.audioHasText,
|
||||
statusText: hasPlayableAudio ? '可播放' : '图文讲解'
|
||||
statusText: hasPlayableAudio ? '可播放' : '当前语言暂无语音讲解'
|
||||
},
|
||||
imageStatus: exhibit.imageStatus,
|
||||
linkedExhibitCount,
|
||||
isSharedStop: exhibit.isSharedStop,
|
||||
linkedExhibitStatusText,
|
||||
linkedExhibits: exhibit.linkedExhibits,
|
||||
chapters: metadataLines.length
|
||||
? metadataLines.map((line, index) => ({
|
||||
|
||||
Reference in New Issue
Block a user