chore: freeze guide and explain update

This commit is contained in:
lyf
2026-06-24 18:00:25 +08:00
parent feb7310a46
commit 67c6609ae6
104 changed files with 3203572 additions and 40713 deletions

View File

@@ -1,4 +1,5 @@
export type GuideTopTab = 'guide' | 'explain'
export const GUIDE_LOCATION_PREVIEW_STORAGE_KEY = 'museum-guide:last-location-preview-url'
export const GUIDE_TOP_TABS: Array<{ id: GuideTopTab; label: string }> = [
{ id: 'guide', label: '导览' },
@@ -11,7 +12,29 @@ export const isGuideTopTab = (value: unknown): value is GuideTopTab => {
export const guideTopTabUrl = (tab: GuideTopTab) => `/pages/index/index?tab=${tab}`
export const saveLastGuideLocationPreviewUrl = (url: string) => {
if (typeof window === 'undefined' || !url) return
window.sessionStorage.setItem(GUIDE_LOCATION_PREVIEW_STORAGE_KEY, url)
}
export const getLastGuideLocationPreviewUrl = () => {
if (typeof window === 'undefined') return ''
return window.sessionStorage.getItem(GUIDE_LOCATION_PREVIEW_STORAGE_KEY) || ''
}
export const navigateToGuideTopTab = (tab: GuideTopTab) => {
if (tab === 'guide') {
const lastLocationPreviewUrl = getLastGuideLocationPreviewUrl()
if (lastLocationPreviewUrl) {
uni.reLaunch({
url: lastLocationPreviewUrl
})
return
}
}
uni.reLaunch({
url: guideTopTabUrl(tab)
})