修复H5导览与讲解状态闭环
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-19 17:07:40 +08:00
parent 97788a3e9f
commit 3cba97b786
12 changed files with 147 additions and 44 deletions

View File

@@ -56,9 +56,20 @@ export const getLastGuideLocationPreviewUrl = () => {
return window.sessionStorage.getItem(GUIDE_LOCATION_PREVIEW_STORAGE_KEY) || ''
}
export const clearLastGuideLocationPreviewUrl = () => {
if (typeof window === 'undefined') return
window.sessionStorage.removeItem(GUIDE_LOCATION_PREVIEW_STORAGE_KEY)
}
export const consumeLastGuideLocationPreviewUrl = () => {
const url = getLastGuideLocationPreviewUrl()
clearLastGuideLocationPreviewUrl()
return url
}
export const navigateToGuideTopTab = (tab: GuideTopTab) => {
if (tab === 'guide') {
const lastLocationPreviewUrl = getLastGuideLocationPreviewUrl()
const lastLocationPreviewUrl = consumeLastGuideLocationPreviewUrl()
if (lastLocationPreviewUrl) {
uni.reLaunch({
url: lastLocationPreviewUrl

View File

@@ -0,0 +1,18 @@
export const LOCATION_PREVIEW_SELECTION_MODE = 'location-preview'
export const isLocationPreviewSelectionMode = (value: unknown) => (
value === LOCATION_PREVIEW_SELECTION_MODE
)
export const locationPreviewSearchUrl = () => (
`/pages/search/index?selection=${LOCATION_PREVIEW_SELECTION_MODE}`
)
export const locationPreviewDetailUrl = (facilityId: string, target: string) => {
const params = new URLSearchParams({
facilityId,
target,
state: 'preview'
})
return `/pages/route/detail?${params.toString()}`
}