@@ -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
|
||||
|
||||
18
src/utils/locationPreviewSelection.ts
Normal file
18
src/utils/locationPreviewSelection.ts
Normal 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()}`
|
||||
}
|
||||
Reference in New Issue
Block a user