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

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
@@ -56,6 +56,22 @@ const currentMessage = ref<SystemMessageVO | null>(null)
/** unreadCount is a reactive state variable used by the template and event handlers. */
const unreadCount = computed(() => messages.value.filter(item => item.readStatus !== 1).length)
const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
const actionPath = String(item.actionPath || '').trim()
if (!actionPath || !actionPath.startsWith('/') || actionPath.startsWith('//')) {
return ''
}
return actionPath
}
const markMessageReadIfNeeded = async (item: SystemMessageVO) => {
if (item.readStatus === 1) {
return
}
await userApi.markMessageRead(item.id)
item.readStatus = 1
}
/** loadMessages is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const loadMessages = async () => {
loading.value = true
@@ -70,12 +86,21 @@ const loadMessages = async () => {
/** openMessage is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const openMessage = async (item: SystemMessageVO) => {
try {
await markMessageReadIfNeeded(item)
} catch (error: any) {
message.error(error?.message || '标记已读失败')
return
}
const actionPath = resolveSystemMessageActionPath(item)
if (actionPath) {
await router.push(actionPath)
return
}
currentMessage.value = item
detailVisible.value = true
if (item.readStatus !== 1) {
await userApi.markMessageRead(item.id)
item.readStatus = 1
}
}
onMounted(loadMessages)