功能:完善订单流程和加固
This commit is contained in:
@@ -29,11 +29,13 @@ import SystemMessageCard from './components/SystemMessageCard.vue'
|
||||
import { cartApi } from './api/cart'
|
||||
import { userApi, type SystemMessageVO } from './api/user'
|
||||
import antdLocale from './config/antdv-locale'
|
||||
import { useGlobalConfirmEnter } from './composables/useConfirmEnter'
|
||||
import { useShopTheme } from './composables/useShopTheme'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { currentTheme, refreshShopTheme, resetShopTheme, setupShopThemeSync } = useShopTheme()
|
||||
useGlobalConfirmEnter()
|
||||
type ButtonPropsWithClass = ButtonProps & { class?: string }
|
||||
const popupMessageOkButtonProps: ButtonPropsWithClass = { class: 'popup-message-ok-button' }
|
||||
/** routerReady is a reactive state variable used by the template and event handlers. */
|
||||
@@ -108,6 +110,22 @@ const updateCartCount = async () => {
|
||||
await loadCartCount()
|
||||
}
|
||||
|
||||
const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
|
||||
const actionPath = String(item.actionPath || '').trim()
|
||||
if (!actionPath || !actionPath.startsWith('/') || actionPath.startsWith('//')) {
|
||||
return ''
|
||||
}
|
||||
return actionPath
|
||||
}
|
||||
|
||||
const openSystemMessageAction = async (item: SystemMessageVO) => {
|
||||
const actionPath = resolveSystemMessageActionPath(item)
|
||||
if (!actionPath) {
|
||||
return
|
||||
}
|
||||
await router.push(actionPath)
|
||||
}
|
||||
|
||||
/** showPopupMessage is a local helper used by this page script. */
|
||||
const showPopupMessage = (item: SystemMessageVO) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
@@ -142,6 +160,7 @@ const showPopupMessage = (item: SystemMessageVO) => {
|
||||
okButtonProps: popupMessageOkButtonProps,
|
||||
async onOk() {
|
||||
await markShownAndResolve()
|
||||
await openSystemMessageAction(item)
|
||||
},
|
||||
async afterClose() {
|
||||
await markShownAndResolve()
|
||||
|
||||
Reference in New Issue
Block a user