补齐讲解字段映射并优先展示接口展厅图
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-07 01:31:06 +08:00
parent 0ce38b390e
commit 4b03cc281c
9 changed files with 199 additions and 17 deletions

View File

@@ -83,6 +83,8 @@ export interface BackendGuideStop {
id?: string | number | null
name?: string | null
floorId?: string | number | null
mapX?: number | string | null
mapY?: number | string | null
targetType?: string | null
targetId?: string | number | null
coverImageUrl?: string | null
@@ -128,6 +130,7 @@ export interface BackendCatalogLinkedExhibitItem {
code?: string | null
exhibitCode?: string | null
coverImageUrl?: string | null
galleryUrls?: string | string[] | null
sortOrder?: number | null
}
@@ -135,6 +138,10 @@ export interface BackendCatalogStopItem {
stopId?: string | number | null
id?: string | number | null
outlineId?: string | number | null
poiId?: string | number | null
floorId?: string | number | null
mapX?: number | string | null
mapY?: number | string | null
name?: string | null
guideLevel?: string | null
description?: string | null
@@ -168,7 +175,7 @@ const firstText = (...values: Array<string | number | null | undefined>) => (
.find(Boolean) || ''
)
const parseGalleryUrls = (value: BackendExhibit['galleryUrls']) => {
const parseGalleryUrls = (value: BackendExhibit['galleryUrls'] | string[]) => {
if (!value) return []
if (Array.isArray(value)) return value.map(String).filter(Boolean)
@@ -308,8 +315,11 @@ const toCatalogLinkedExhibitSummary = (source: BackendCatalogLinkedExhibitItem)
id,
name: firstText(source.name, source.exhibitCode, source.code, `展品 ${id}`),
nameEn: firstText(source.nameEn) || undefined,
code: firstText(source.code, source.exhibitCode) || undefined,
exhibitCode: firstText(source.exhibitCode, source.code) || undefined,
coverImageUrl: normalizeSameOriginPublicUrl(firstText(source.coverImageUrl)) || undefined
coverImageUrl: normalizeSameOriginPublicUrl(firstText(source.coverImageUrl)) || undefined,
galleryUrls: parseGalleryUrls(source.galleryUrls),
sortOrder: normalizeNumber(source.sortOrder)
}
}
@@ -331,7 +341,7 @@ export const toCatalogGuideStop = (
name: firstText(source.name, `讲解点${id}`),
hallId: hall?.id,
hallName: hall?.name,
floorId: hall?.floorId,
floorId: stringifyId(source.floorId) || hall?.floorId,
targetType: playTargetType,
targetId: playTargetId,
coverImageUrl: canUseStopImage
@@ -342,6 +352,9 @@ export const toCatalogGuideStop = (
audioStatus: normalizeCatalogAudioStatus(source.audioStatus),
supportedLanguages: normalizeSupportedLanguages(source.supportedLanguages),
hasTextRecord: source.hasTextRecord === true,
poiId: stringifyId(source.poiId) || undefined,
mapX: normalizeNumber(source.mapX),
mapY: normalizeNumber(source.mapY),
outlineId: stringifyId(source.outlineId) || outline?.id,
outlineName: outline?.name,
sort: typeof source.sort === 'number' ? source.sort : undefined,
@@ -374,6 +387,10 @@ export const toCatalogMuseumExhibitFromStop = (
image: stop.coverImageUrl || undefined,
description: stop.description || linkedPrimary?.name || '该讲解点暂无简介。',
tags: [stop.outlineName, linkedPrimary?.exhibitCode].filter(Boolean) as string[],
poiId: stop.poiId,
sourcePoiId: stop.poiId,
mapX: stop.mapX,
mapY: stop.mapY,
guideTitle: stop.name,
guideText: stop.description,
audioAvailable: audioReady,
@@ -611,6 +628,8 @@ export const toBackendGuideStop = (source: BackendGuideStop): ExplainGuideStop |
description: firstText(source.description) || undefined,
hasAudio: source.hasAudio === true,
poiId: stringifyId(source.poiId) || undefined,
mapX: normalizeNumber(source.mapX),
mapY: normalizeNumber(source.mapY),
outlineId: stringifyId(source.outlineId) || undefined,
outlineName: firstText(source.outlineName) || undefined,
sort: typeof source.sort === 'number' ? source.sort : undefined