优化讲解展厅与对象列表视觉
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-18 01:16:30 +08:00
parent b8ab414bac
commit 5a711377b0
16 changed files with 161 additions and 121 deletions

View File

@@ -1,9 +1,8 @@
<template>
<GuidePageFrame active-tab="explain" variant="static" :show-top-tabs="false" @tab-change="handleTopTabChange" @back="handleBack">
<view class="explain-guide-stop-page">
<ExplainHallSelect
<ExplainGuideStopCatalog
:guide-stops="explainGuideStopItems"
stage="stop"
:selected-hall-name="selectedExplainHallName"
:loading="explainLoading"
:loading-more="loadingMore"
@@ -23,7 +22,7 @@
import { onUnmounted, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import GuidePageFrame from '@/components/navigation/GuidePageFrame.vue'
import ExplainHallSelect, { type ExplainGuideStopSelectItem } from '@/components/explain/ExplainHallSelect.vue'
import ExplainGuideStopCatalog, { type ExplainGuideStopCatalogItem } from '@/components/explain/ExplainGuideStopCatalog.vue'
import { explainUseCase } from '@/usecases/explainUseCase'
import type { ExplainGuideStop } from '@/domain/museum'
import { normalizeExplainDetailTargetFromGuideStop } from '@/domain/explainDetailTarget'
@@ -32,7 +31,7 @@ import { navigateToGuideTopTab, type GuideTopTab } from '@/utils/guideTopTabs'
const PAGE_SIZE = 20
const selectedExplainHallId = ref('')
const selectedExplainHallName = ref('')
const explainGuideStopItems = ref<ExplainGuideStopSelectItem[]>([])
const explainGuideStopItems = ref<ExplainGuideStopCatalogItem[]>([])
const explainLoading = ref(false)
const loadingMore = ref(false)
const explainError = ref('')
@@ -42,7 +41,7 @@ const nextPageNo = ref(1)
let requestVersion = 0
let disposed = false
const toGuideStopItems = (stops: ExplainGuideStop[]): ExplainGuideStopSelectItem[] => stops.map((stop) => ({
const toGuideStopItems = (stops: ExplainGuideStop[]): ExplainGuideStopCatalogItem[] => stops.map((stop) => ({
id: stop.id,
name: stop.name,
hallId: stop.hallId,
@@ -54,6 +53,7 @@ const toGuideStopItems = (stops: ExplainGuideStop[]): ExplainGuideStopSelectItem
coverImageUrl: stop.imageStatus === 'MISSING' ? undefined : stop.coverImageUrl,
description: stop.description,
hasAudio: stop.hasAudio,
hasTextRecord: stop.hasTextRecord,
audioStatus: stop.audioStatus,
guideLevel: stop.guideLevel,
playTargetType: stop.playTargetType,
@@ -67,7 +67,7 @@ const syncPageTitle = (title: string) => {
const loadPage = async (pageNo: number, replace: boolean) => {
const hallId = selectedExplainHallId.value
if (!hallId || disposed || (!replace && (loadingMore.value || !hasMore.value))) return
if (!hallId || disposed || (!replace && (loadingMore.value || !hasMore.value))) return false
const version = ++requestVersion
if (replace) {
explainLoading.value = true
@@ -89,10 +89,12 @@ const loadPage = async (pageNo: number, replace: boolean) => {
}
nextPageNo.value = page.pageNo + 1
hasMore.value = page.hasMore && explainGuideStopItems.value.length < page.total
return true
} catch (error) {
if (disposed || version !== requestVersion) return
if (replace) explainError.value = '讲解对象加载失败,请稍后重试'
else loadMoreError.value = '加载更多讲解对象失败,请重试'
return false
} finally {
if (!disposed && version === requestVersion) {
explainLoading.value = false
@@ -127,7 +129,7 @@ onUnmounted(() => {
requestVersion += 1
})
const handleExplainGuideStopClick = (stop: ExplainGuideStopSelectItem) => {
const handleExplainGuideStopClick = (stop: ExplainGuideStopCatalogItem) => {
const target = stop.playTargetType && stop.playTargetId
? { targetType: stop.playTargetType, targetId: stop.playTargetId }
: normalizeExplainDetailTargetFromGuideStop({ id: stop.id })