修复讲解详情接口并展示展厅统计

This commit is contained in:
lyf
2026-07-02 17:22:11 +08:00
parent 9b1f855515
commit ccd37bcd81
8 changed files with 127 additions and 38 deletions

View File

@@ -41,6 +41,9 @@ import ExplainHallSelect, {
import {
explainUseCase
} from '@/usecases/explainUseCase'
import {
normalizeExplainDetailTargetFromGuideStop
} from '@/domain/explainDetailTarget'
import type {
ExplainBusinessUnit,
MuseumHall
@@ -63,13 +66,18 @@ let explainLoadPromise: Promise<void> | null = null
const normalizeExplainKeyword = (value?: string) => (value || '').trim().toLowerCase()
const buildExplainHallItems = (halls: MuseumHall[]): ExplainHallSelectItem[] => (
const buildExplainHallItems = (
halls: MuseumHall[],
summaries: Awaited<ReturnType<typeof explainUseCase.loadExplainHallSummaries>> = {}
): ExplainHallSelectItem[] => (
halls.map((hall) => ({
id: hall.id,
name: hall.name,
floorLabel: hall.floorLabel,
image: hall.image,
explainCount: hall.exhibitCount || 0,
businessUnitCount: summaries[hall.id]?.businessUnitCount,
guideStopCount: summaries[hall.id]?.guideStopCount,
searchText: normalizeExplainKeyword([
hall.name,
hall.floorLabel,
@@ -115,7 +123,8 @@ const loadExplainHalls = async () => {
explainLoadPromise = (async () => {
try {
const halls = await explainUseCase.loadExplainHalls()
explainHallItems.value = buildExplainHallItems(halls)
const summaries = await explainUseCase.loadExplainHallSummaries(halls.map((hall) => hall.id))
explainHallItems.value = buildExplainHallItems(halls, summaries)
} catch (error) {
console.error('加载讲解展厅失败:', error)
explainError.value = '讲解展厅加载失败,请稍后重试'
@@ -178,11 +187,12 @@ const handleExplainBusinessUnitClick = (unitId: string) => {
}
const handleExplainGuideStopClick = (stopId: string) => {
const target = normalizeExplainDetailTargetFromGuideStop({ id: stopId })
const params = new URLSearchParams({
id: stopId,
id: target.targetId,
tab: 'explain',
targetType: 'STOP',
targetId: stopId
targetType: target.targetType,
targetId: target.targetId
})
uni.navigateTo({
url: `/pages/exhibit/detail?${params.toString()}`