功能:完善订单流程和加固

This commit is contained in:
xiaowang
2026-05-23 15:16:40 +08:00
parent 9227ec6175
commit 3e6e1cc4e8
90 changed files with 6859 additions and 368 deletions
+41
View File
@@ -47,6 +47,45 @@ function switchTab(path) {
})
}
function normalizeActionPath(value) {
const rawPath = String(value || '').trim()
if (!rawPath || !rawPath.startsWith('/') || rawPath.startsWith('//')) {
return ''
}
if (rawPath.startsWith('/orders')) {
const queryIndex = rawPath.indexOf('?')
const query = queryIndex >= 0 ? rawPath.slice(queryIndex) : ''
return `/pages/orders/index${query}`
}
if (rawPath.startsWith('/pages/')) {
return rawPath
}
return ''
}
function openActionPath(value) {
const target = normalizeActionPath(value)
if (!target) {
return Promise.resolve(false)
}
const purePath = target.split('?')[0]
const openPromise = isTabPage(purePath) ? switchTab(purePath) : navigate(target)
return openPromise
.then(() => true)
.catch(error => {
console.error('Open message action path failed', error)
wx.showToast({
title: '无法打开消息链接',
icon: 'none'
})
return false
})
}
function goBack(fallbackPath) {
const pages = getCurrentPages()
if (pages.length > 1) {
@@ -186,6 +225,8 @@ module.exports = {
isTabPage,
navigate,
switchTab,
normalizeActionPath,
openActionPath,
goBack,
redirectAfterLogin,
openAuth,