refactor: split explain hall entry from home tab
This commit is contained in:
@@ -11,40 +11,28 @@
|
|||||||
<view class="explain-all-page">
|
<view class="explain-all-page">
|
||||||
<ExplainHallSelect
|
<ExplainHallSelect
|
||||||
:halls="explainHallItems"
|
:halls="explainHallItems"
|
||||||
:business-units="explainBusinessUnitItems"
|
stage="hall"
|
||||||
:guide-stops="explainGuideStopItems"
|
|
||||||
:stage="explainStage"
|
|
||||||
:selected-hall-name="selectedExplainHallName"
|
|
||||||
:selected-business-unit-name="selectedExplainBusinessUnitName"
|
|
||||||
:loading="explainLoading"
|
:loading="explainLoading"
|
||||||
:error="explainError"
|
:error="explainError"
|
||||||
@hall-click="handleExplainHallClick"
|
@hall-click="handleExplainHallClick"
|
||||||
@business-unit-click="handleExplainBusinessUnitClick"
|
@back="handleBack"
|
||||||
@guide-stop-click="handleExplainGuideStopClick"
|
|
||||||
@back="handlePanelBack"
|
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</GuidePageFrame>
|
</GuidePageFrame>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||||
import GuidePageFrame from '@/components/navigation/GuidePageFrame.vue'
|
import GuidePageFrame from '@/components/navigation/GuidePageFrame.vue'
|
||||||
import ExplainHallSelect, {
|
import ExplainHallSelect, {
|
||||||
type ExplainBusinessUnitSelectItem,
|
type ExplainBusinessUnitSelectItem,
|
||||||
type ExplainGuideStopSelectItem,
|
type ExplainHallSelectItem
|
||||||
type ExplainHallSelectItem,
|
|
||||||
type ExplainSelectStage
|
|
||||||
} from '@/components/explain/ExplainHallSelect.vue'
|
} from '@/components/explain/ExplainHallSelect.vue'
|
||||||
import {
|
import {
|
||||||
explainUseCase
|
explainUseCase
|
||||||
} from '@/usecases/explainUseCase'
|
} from '@/usecases/explainUseCase'
|
||||||
import {
|
|
||||||
normalizeExplainDetailTargetFromGuideStop
|
|
||||||
} from '@/domain/explainDetailTarget'
|
|
||||||
import type {
|
import type {
|
||||||
ExplainBusinessUnit,
|
|
||||||
MuseumHall
|
MuseumHall
|
||||||
} from '@/domain/museum'
|
} from '@/domain/museum'
|
||||||
import {
|
import {
|
||||||
@@ -54,12 +42,6 @@ import {
|
|||||||
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
|
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
|
||||||
|
|
||||||
const explainHallItems = ref<ExplainHallSelectItem[]>([])
|
const explainHallItems = ref<ExplainHallSelectItem[]>([])
|
||||||
const explainBusinessUnits = ref<ExplainBusinessUnit[]>([])
|
|
||||||
const explainStage = ref<ExplainSelectStage>('hall')
|
|
||||||
const selectedExplainHallId = ref('')
|
|
||||||
const selectedExplainHallName = ref('')
|
|
||||||
const selectedExplainBusinessUnitId = ref('')
|
|
||||||
const selectedExplainBusinessUnitName = ref('')
|
|
||||||
const explainLoading = ref(false)
|
const explainLoading = ref(false)
|
||||||
const explainError = ref('')
|
const explainError = ref('')
|
||||||
let explainLoadPromise: Promise<void> | null = null
|
let explainLoadPromise: Promise<void> | null = null
|
||||||
@@ -87,83 +69,21 @@ const buildExplainHallItems = (
|
|||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
const selectedExplainBusinessUnit = computed(() => (
|
|
||||||
explainBusinessUnits.value.find((unit) => unit.id === selectedExplainBusinessUnitId.value) || null
|
|
||||||
))
|
|
||||||
const explainPageTitle = computed(() => {
|
|
||||||
if (explainStage.value === 'unit') return selectedExplainHallName.value || '选择业务单元'
|
|
||||||
if (explainStage.value === 'stop') return selectedExplainBusinessUnitName.value || '选择讲解点'
|
|
||||||
return '讲解'
|
|
||||||
})
|
|
||||||
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
|
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
|
||||||
|
|
||||||
const syncHostNavigationTitle = () => {
|
|
||||||
const title = explainPageTitle.value
|
|
||||||
|
|
||||||
if (typeof uni !== 'undefined') {
|
|
||||||
uni.setNavigationBarTitle({ title })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
document.title = title
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const explainBusinessUnitItems = computed<ExplainBusinessUnitSelectItem[]>(() => (
|
const explainBusinessUnitItems = computed<ExplainBusinessUnitSelectItem[]>(() => (
|
||||||
explainBusinessUnits.value.map((unit) => ({
|
[]))
|
||||||
id: unit.id,
|
|
||||||
name: unit.name,
|
|
||||||
hallId: unit.hallId,
|
|
||||||
previewImageUrl: unit.previewImageUrl,
|
|
||||||
guideStopCount: unit.guideStopCount
|
|
||||||
}))
|
|
||||||
))
|
|
||||||
|
|
||||||
const explainGuideStopItems = computed<ExplainGuideStopSelectItem[]>(() => (
|
|
||||||
selectedExplainBusinessUnit.value?.stops.map((stop) => ({
|
|
||||||
id: stop.id,
|
|
||||||
name: stop.name,
|
|
||||||
hallId: stop.hallId,
|
|
||||||
hallName: stop.hallName,
|
|
||||||
floorId: stop.floorId,
|
|
||||||
poiId: stop.poiId,
|
|
||||||
mapX: stop.mapX,
|
|
||||||
mapY: stop.mapY,
|
|
||||||
coverImageUrl: stop.coverImageUrl,
|
|
||||||
description: stop.description,
|
|
||||||
hasAudio: stop.hasAudio,
|
|
||||||
audioStatus: stop.audioStatus,
|
|
||||||
guideLevel: stop.guideLevel,
|
|
||||||
playTargetType: stop.playTargetType,
|
|
||||||
playTargetId: stop.playTargetId
|
|
||||||
})) || []
|
|
||||||
))
|
|
||||||
|
|
||||||
type ExplainHistoryState = {
|
type ExplainHistoryState = {
|
||||||
museumExplainList?: boolean
|
museumExplainList?: boolean
|
||||||
stage?: ExplainSelectStage
|
|
||||||
hallId?: string
|
|
||||||
hallName?: string
|
|
||||||
unitId?: string
|
|
||||||
unitName?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let syncingExplainHistory = false
|
let syncingExplainHistory = false
|
||||||
let applyingExplainHistory = false
|
let applyingExplainHistory = false
|
||||||
|
|
||||||
const stageRank: Record<ExplainSelectStage, number> = {
|
|
||||||
hall: 0,
|
|
||||||
unit: 1,
|
|
||||||
stop: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentExplainHistoryState = (): ExplainHistoryState => ({
|
const currentExplainHistoryState = (): ExplainHistoryState => ({
|
||||||
museumExplainList: true,
|
museumExplainList: true
|
||||||
stage: explainStage.value,
|
|
||||||
hallId: selectedExplainHallId.value,
|
|
||||||
hallName: selectedExplainHallName.value,
|
|
||||||
unitId: selectedExplainBusinessUnitId.value,
|
|
||||||
unitName: selectedExplainBusinessUnitName.value
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const writeExplainHistoryState = (replace = false) => {
|
const writeExplainHistoryState = (replace = false) => {
|
||||||
@@ -188,48 +108,6 @@ const applyExplainHistoryState = async (state: ExplainHistoryState | null) => {
|
|||||||
if (!state?.museumExplainList || applyingExplainHistory) return
|
if (!state?.museumExplainList || applyingExplainHistory) return
|
||||||
|
|
||||||
applyingExplainHistory = true
|
applyingExplainHistory = true
|
||||||
const targetStage = state.stage || 'hall'
|
|
||||||
|
|
||||||
if (targetStage === 'hall') {
|
|
||||||
explainStage.value = 'hall'
|
|
||||||
selectedExplainHallId.value = ''
|
|
||||||
selectedExplainHallName.value = ''
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainBusinessUnits.value = []
|
|
||||||
explainError.value = ''
|
|
||||||
applyingExplainHistory = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.hallId) {
|
|
||||||
selectedExplainHallId.value = state.hallId
|
|
||||||
selectedExplainHallName.value = state.hallName || '业务单元'
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
|
|
||||||
if (!explainBusinessUnits.value.length || explainBusinessUnits.value[0]?.hallId !== state.hallId) {
|
|
||||||
explainLoading.value = true
|
|
||||||
explainError.value = ''
|
|
||||||
try {
|
|
||||||
explainBusinessUnits.value = await explainUseCase.loadTemporaryBusinessUnitsByHall(state.hallId)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('恢复展厅讲解点失败:', error)
|
|
||||||
explainError.value = '展厅讲解点加载失败,请稍后重试'
|
|
||||||
explainBusinessUnits.value = []
|
|
||||||
} finally {
|
|
||||||
explainLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetStage === 'stop' && state.unitId) {
|
|
||||||
selectedExplainBusinessUnitId.value = state.unitId
|
|
||||||
selectedExplainBusinessUnitName.value = state.unitName || '讲解点'
|
|
||||||
explainStage.value = 'stop'
|
|
||||||
}
|
|
||||||
|
|
||||||
applyingExplainHistory = false
|
applyingExplainHistory = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,26 +116,10 @@ const handleExplainHistoryPopState = (event: PopStateEvent) => {
|
|||||||
void applyExplainHistoryState((event.state || null) as ExplainHistoryState | null)
|
void applyExplainHistoryState((event.state || null) as ExplainHistoryState | null)
|
||||||
}
|
}
|
||||||
|
|
||||||
const pushExplainStageHistory = (previousStage: ExplainSelectStage) => {
|
|
||||||
if (!shouldUseHostNavigation.value || applyingExplainHistory) return
|
|
||||||
if (stageRank[explainStage.value] <= stageRank[previousStage]) return
|
|
||||||
|
|
||||||
writeExplainHistoryState()
|
|
||||||
}
|
|
||||||
|
|
||||||
const replaceExplainStageHistory = () => {
|
const replaceExplainStageHistory = () => {
|
||||||
writeExplainHistoryState(true)
|
writeExplainHistoryState(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(explainPageTitle, syncHostNavigationTitle)
|
|
||||||
|
|
||||||
watch(shouldUseHostNavigation, (value) => {
|
|
||||||
if (value) {
|
|
||||||
syncHostNavigationTitle()
|
|
||||||
replaceExplainStageHistory()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const loadExplainHalls = async () => {
|
const loadExplainHalls = async () => {
|
||||||
if (explainHallItems.value.length) return
|
if (explainHallItems.value.length) return
|
||||||
if (explainLoadPromise) return explainLoadPromise
|
if (explainLoadPromise) return explainLoadPromise
|
||||||
@@ -284,7 +146,6 @@ const loadExplainHalls = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
syncHostNavigationTitle()
|
|
||||||
replaceExplainStageHistory()
|
replaceExplainStageHistory()
|
||||||
void loadExplainHalls()
|
void loadExplainHalls()
|
||||||
|
|
||||||
@@ -319,82 +180,18 @@ const handleTopTabChange = (tab: GuideTopTab) => {
|
|||||||
navigateToGuideTopTab(tab)
|
navigateToGuideTopTab(tab)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleExplainHallClick = async (hallId: string) => {
|
const handleExplainHallClick = (hallId: string) => {
|
||||||
const previousStage = explainStage.value
|
|
||||||
const hall = explainHallItems.value.find((item) => item.id === hallId)
|
const hall = explainHallItems.value.find((item) => item.id === hallId)
|
||||||
selectedExplainHallId.value = hallId
|
|
||||||
selectedExplainHallName.value = hall?.name || '业务单元'
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainBusinessUnits.value = []
|
|
||||||
explainLoading.value = true
|
|
||||||
explainError.value = ''
|
|
||||||
|
|
||||||
try {
|
|
||||||
explainBusinessUnits.value = await explainUseCase.loadTemporaryBusinessUnitsByHall(hallId)
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
pushExplainStageHistory(previousStage)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载展厅讲解点失败:', error)
|
|
||||||
explainError.value = '展厅讲解点加载失败,请稍后重试'
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
pushExplainStageHistory(previousStage)
|
|
||||||
} finally {
|
|
||||||
explainLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleExplainBusinessUnitClick = (unitId: string) => {
|
|
||||||
const previousStage = explainStage.value
|
|
||||||
const unit = explainBusinessUnits.value.find((item) => item.id === unitId)
|
|
||||||
selectedExplainBusinessUnitId.value = unitId
|
|
||||||
selectedExplainBusinessUnitName.value = unit?.name || '讲解点'
|
|
||||||
explainStage.value = 'stop'
|
|
||||||
pushExplainStageHistory(previousStage)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleExplainGuideStopClick = (stop: ExplainGuideStopSelectItem) => {
|
|
||||||
const target = stop.playTargetType && stop.playTargetId
|
|
||||||
? {
|
|
||||||
targetType: stop.playTargetType,
|
|
||||||
targetId: stop.playTargetId
|
|
||||||
}
|
|
||||||
: normalizeExplainDetailTargetFromGuideStop({ id: stop.id })
|
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
id: stop.id,
|
hallId,
|
||||||
tab: 'explain',
|
hallName: hall?.name || '讲解'
|
||||||
targetType: target.targetType,
|
|
||||||
targetId: target.targetId
|
|
||||||
})
|
})
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/exhibit/detail?${params.toString()}`
|
url: `/pages/explain/business-unit-list?${params.toString()}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePanelBack = () => {
|
|
||||||
if (explainStage.value === 'stop') {
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainError.value = ''
|
|
||||||
replaceExplainStageHistory()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (explainStage.value === 'unit') {
|
|
||||||
explainStage.value = 'hall'
|
|
||||||
selectedExplainHallId.value = ''
|
|
||||||
selectedExplainHallName.value = ''
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainBusinessUnits.value = []
|
|
||||||
explainError.value = ''
|
|
||||||
replaceExplainStageHistory()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
handleBack()
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -247,16 +247,10 @@
|
|||||||
<view v-else-if="currentTab === 'explain'" class="explain-page">
|
<view v-else-if="currentTab === 'explain'" class="explain-page">
|
||||||
<ExplainHallSelect
|
<ExplainHallSelect
|
||||||
:halls="explainHallItems"
|
:halls="explainHallItems"
|
||||||
:business-units="explainBusinessUnitItems"
|
stage="hall"
|
||||||
:guide-stops="explainGuideStopItems"
|
|
||||||
:stage="explainStage"
|
|
||||||
:selected-hall-name="selectedExplainHallName"
|
|
||||||
:selected-business-unit-name="selectedExplainBusinessUnitName"
|
|
||||||
:loading="explainLoading"
|
:loading="explainLoading"
|
||||||
:error="explainError"
|
:error="explainError"
|
||||||
@hall-click="handleExplainHallClick"
|
@hall-click="handleExplainHallClick"
|
||||||
@business-unit-click="handleExplainBusinessUnitClick"
|
|
||||||
@guide-stop-click="handleExplainGuideStopClick"
|
|
||||||
@back="handleExplainBack"
|
@back="handleExplainBack"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -317,9 +311,6 @@ import type {
|
|||||||
RoutePointOption
|
RoutePointOption
|
||||||
} from '@/components/navigation/RoutePointPicker.vue'
|
} from '@/components/navigation/RoutePointPicker.vue'
|
||||||
import ExplainHallSelect, {
|
import ExplainHallSelect, {
|
||||||
type ExplainBusinessUnitSelectItem,
|
|
||||||
type ExplainGuideStopSelectItem,
|
|
||||||
type ExplainSelectStage,
|
|
||||||
type ExplainHallSelectItem
|
type ExplainHallSelectItem
|
||||||
} from '@/components/explain/ExplainHallSelect.vue'
|
} from '@/components/explain/ExplainHallSelect.vue'
|
||||||
import {
|
import {
|
||||||
@@ -350,7 +341,6 @@ import {
|
|||||||
import type {
|
import type {
|
||||||
GuideRouteResult,
|
GuideRouteResult,
|
||||||
GuideRouteTarget,
|
GuideRouteTarget,
|
||||||
ExplainBusinessUnit,
|
|
||||||
MuseumFloor,
|
MuseumFloor,
|
||||||
MuseumHall
|
MuseumHall
|
||||||
} from '@/domain/museum'
|
} from '@/domain/museum'
|
||||||
@@ -749,48 +739,10 @@ const routeSimulationStepText = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const explainHallItems = ref<ExplainHallSelectItem[]>([])
|
const explainHallItems = ref<ExplainHallSelectItem[]>([])
|
||||||
const explainBusinessUnits = ref<ExplainBusinessUnit[]>([])
|
|
||||||
const explainStage = ref<ExplainSelectStage>('hall')
|
|
||||||
const selectedExplainHallId = ref('')
|
|
||||||
const selectedExplainHallName = ref('')
|
|
||||||
const selectedExplainBusinessUnitId = ref('')
|
|
||||||
const selectedExplainBusinessUnitName = ref('')
|
|
||||||
const explainLoading = ref(false)
|
const explainLoading = ref(false)
|
||||||
const explainError = ref('')
|
const explainError = ref('')
|
||||||
let explainLoadPromise: Promise<void> | null = null
|
let explainLoadPromise: Promise<void> | null = null
|
||||||
|
|
||||||
const selectedExplainBusinessUnit = computed(() => (
|
|
||||||
explainBusinessUnits.value.find((unit) => unit.id === selectedExplainBusinessUnitId.value) || null
|
|
||||||
))
|
|
||||||
const explainBusinessUnitItems = computed<ExplainBusinessUnitSelectItem[]>(() => (
|
|
||||||
explainBusinessUnits.value.map((unit) => ({
|
|
||||||
id: unit.id,
|
|
||||||
name: unit.name,
|
|
||||||
hallId: unit.hallId,
|
|
||||||
previewImageUrl: unit.previewImageUrl,
|
|
||||||
guideStopCount: unit.guideStopCount
|
|
||||||
}))
|
|
||||||
))
|
|
||||||
const explainGuideStopItems = computed<ExplainGuideStopSelectItem[]>(() => (
|
|
||||||
selectedExplainBusinessUnit.value?.stops.map((stop) => ({
|
|
||||||
id: stop.id,
|
|
||||||
name: stop.name,
|
|
||||||
hallId: stop.hallId,
|
|
||||||
hallName: stop.hallName,
|
|
||||||
floorId: stop.floorId,
|
|
||||||
poiId: stop.poiId,
|
|
||||||
mapX: stop.mapX,
|
|
||||||
mapY: stop.mapY,
|
|
||||||
coverImageUrl: stop.coverImageUrl,
|
|
||||||
description: stop.description,
|
|
||||||
hasAudio: stop.hasAudio,
|
|
||||||
audioStatus: stop.audioStatus,
|
|
||||||
guideLevel: stop.guideLevel,
|
|
||||||
playTargetType: stop.playTargetType,
|
|
||||||
playTargetId: stop.playTargetId
|
|
||||||
})) || []
|
|
||||||
))
|
|
||||||
|
|
||||||
// Tab 切换处理
|
// Tab 切换处理
|
||||||
const syncTopTabToUrl = (tabId: GuideTopTab) => {
|
const syncTopTabToUrl = (tabId: GuideTopTab) => {
|
||||||
if (typeof window === 'undefined') return
|
if (typeof window === 'undefined') return
|
||||||
@@ -1456,71 +1408,17 @@ const guideSearchText = computed(() => {
|
|||||||
// 讲解页面处理
|
// 讲解页面处理
|
||||||
const handleExplainHallClick = async (hallId: string) => {
|
const handleExplainHallClick = async (hallId: string) => {
|
||||||
const hall = explainHallItems.value.find((item) => item.id === hallId)
|
const hall = explainHallItems.value.find((item) => item.id === hallId)
|
||||||
selectedExplainHallId.value = hallId
|
|
||||||
selectedExplainHallName.value = hall?.name || '业务单元'
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainBusinessUnits.value = []
|
|
||||||
explainError.value = ''
|
|
||||||
explainLoading.value = true
|
|
||||||
|
|
||||||
try {
|
|
||||||
explainBusinessUnits.value = await explainUseCase.loadTemporaryBusinessUnitsByHall(hallId)
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载展厅讲解点失败:', error)
|
|
||||||
explainError.value = '展厅讲解点加载失败,请稍后重试'
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
} finally {
|
|
||||||
explainLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleExplainBusinessUnitClick = (unitId: string) => {
|
|
||||||
const unit = explainBusinessUnits.value.find((item) => item.id === unitId)
|
|
||||||
selectedExplainBusinessUnitId.value = unitId
|
|
||||||
selectedExplainBusinessUnitName.value = unit?.name || '讲解点'
|
|
||||||
explainStage.value = 'stop'
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleExplainGuideStopClick = (stop: ExplainGuideStopSelectItem) => {
|
|
||||||
const target = stop.playTargetType && stop.playTargetId
|
|
||||||
? {
|
|
||||||
targetType: stop.playTargetType,
|
|
||||||
targetId: stop.playTargetId
|
|
||||||
}
|
|
||||||
: normalizeExplainDetailTargetFromGuideStop({ id: stop.id })
|
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
id: stop.id,
|
hallId,
|
||||||
tab: 'explain',
|
hallName: hall?.name || '讲解'
|
||||||
targetType: target.targetType,
|
|
||||||
targetId: target.targetId
|
|
||||||
})
|
})
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/exhibit/detail?${params.toString()}`
|
url: `/pages/explain/business-unit-list?${params.toString()}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleExplainBack = () => {
|
const handleExplainBack = () => {
|
||||||
if (explainStage.value === 'stop') {
|
|
||||||
explainStage.value = 'unit'
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainError.value = ''
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (explainStage.value === 'unit') {
|
|
||||||
explainStage.value = 'hall'
|
|
||||||
selectedExplainHallId.value = ''
|
|
||||||
selectedExplainHallName.value = ''
|
|
||||||
selectedExplainBusinessUnitId.value = ''
|
|
||||||
selectedExplainBusinessUnitName.value = ''
|
|
||||||
explainBusinessUnits.value = []
|
|
||||||
explainError.value = ''
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
currentTab.value = 'guide'
|
currentTab.value = 'guide'
|
||||||
syncTopTabToUrl('guide')
|
syncTopTabToUrl('guide')
|
||||||
loadTopTabData('guide')
|
loadTopTabData('guide')
|
||||||
|
|||||||
Reference in New Issue
Block a user