优化编号讲解布局与返回流程
- 将讲解编号置于标题上方并增强辨识度 - 编号详情返回后保留输入界面并清空原编号 - 增加页面栈丢失时恢复编号输入页的兜底逻辑 - 补充编号布局和返回流程回归测试 Made-with: Proma
This commit is contained in:
@@ -247,6 +247,7 @@ const detailTextLoadedByLanguage = ref<Record<AudioLanguage, boolean>>({
|
||||
})
|
||||
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
|
||||
const shouldAutoplayOnEntry = ref(false)
|
||||
const enteredByGuideCode = ref(false)
|
||||
|
||||
const isAudioLanguage = (value: unknown): value is AudioLanguage => (
|
||||
value === 'zh-CN' || value === 'yue-HK' || value === 'en-US'
|
||||
@@ -533,7 +534,9 @@ onLoad(async (options: any = {}) => {
|
||||
}
|
||||
const rawLang = Array.isArray(options.lang) ? options.lang[0] : options.lang
|
||||
const rawAutoplay = Array.isArray(options.autoplay) ? options.autoplay[0] : options.autoplay
|
||||
const rawEntry = Array.isArray(options.entry) ? options.entry[0] : options.entry
|
||||
shouldAutoplayOnEntry.value = rawAutoplay === '1' || rawAutoplay === 'true'
|
||||
enteredByGuideCode.value = rawEntry === 'code'
|
||||
const lang = typeof rawLang === 'string'
|
||||
? normalizeGuideAudioLanguage(rawLang)
|
||||
: 'zh-CN'
|
||||
@@ -935,6 +938,16 @@ const decodeRouteParam = (value: string) => {
|
||||
return decoded
|
||||
}
|
||||
|
||||
const fallbackToCodeEntry = () => {
|
||||
const url = '/pages/explain/list?codeEntry=1'
|
||||
uni.redirectTo({
|
||||
url,
|
||||
fail: () => {
|
||||
uni.reLaunch({ url })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const fallbackToExplainObjectList = () => {
|
||||
const hallId = detailEntryRequest.value?.hallId || exhibit.value.hallId
|
||||
const hallName = decodeRouteParam(detailEntryRequest.value?.hallName || exhibit.value.hallName || '讲解')
|
||||
@@ -957,15 +970,27 @@ type ExplainDetailPageStackEntry = {
|
||||
const returnToExplainObjectList = () => {
|
||||
closeDetailAudioOnExit()
|
||||
|
||||
const pages = getCurrentPages()
|
||||
const previousPage = pages[pages.length - 2] as ExplainDetailPageStackEntry | undefined
|
||||
|
||||
if (enteredByGuideCode.value) {
|
||||
if (previousPage?.route === 'pages/explain/list' || previousPage?.route === 'pages/index/index') {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
fail: fallbackToCodeEntry
|
||||
})
|
||||
return
|
||||
}
|
||||
fallbackToCodeEntry()
|
||||
return
|
||||
}
|
||||
|
||||
// H5 history can omit intermediate uni-app pages after a refresh or deep link.
|
||||
if (typeof window !== 'undefined' && window.location.hash.startsWith('#/')) {
|
||||
fallbackToExplainObjectList()
|
||||
return
|
||||
}
|
||||
|
||||
const pages = getCurrentPages()
|
||||
const previousPage = pages[pages.length - 2] as ExplainDetailPageStackEntry | undefined
|
||||
|
||||
if (previousPage?.route === 'pages/explain/guide-stop-list') {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
|
||||
Reference in New Issue
Block a user