feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码
This commit is contained in:
1 parent
935bf26fa6
commit
7cfd5d167e
230 files changed
+9337
-10989
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/chat/page/useChatPageDialogs.ts
|
||||
* 用途:对话页删除确认、发货「重试所有失败」确认、反馈弹窗与轻量 toast 状态。
|
||||
* 用途:对话页删除确认、反馈弹窗与轻量 toast 状态。
|
||||
* 依赖:vue computed/ref、chat.types。
|
||||
* 逻辑:由 useChatPage 组装;ChatViewOverlays 绑定 DeleteConfirmDialog 与 toast 条。
|
||||
*/
|
||||
@@ -43,37 +43,6 @@ export function useChatPageDialogs(messages: Ref<ChatMessage[]>) {
|
||||
closeDeleteConfirmDialog();
|
||||
};
|
||||
|
||||
const showRetryFailedConfirmDialog = ref(false);
|
||||
let pendingRetryFailedAction: (() => Promise<void> | void) | null = null;
|
||||
|
||||
/**
|
||||
* 打开「重试所有失败」确认弹窗。
|
||||
* 核心逻辑:仅登记确认后要执行的动作,实际请求由调用方注入。
|
||||
* @param onConfirm - 用户点「确认重试」后执行的回调
|
||||
*/
|
||||
const openRetryFailedConfirm = (onConfirm: () => Promise<void> | void) => {
|
||||
pendingRetryFailedAction = onConfirm;
|
||||
showRetryFailedConfirmDialog.value = true;
|
||||
};
|
||||
|
||||
/** 关闭重试确认弹窗并清空待执行动作。 */
|
||||
const closeRetryFailedConfirm = () => {
|
||||
showRetryFailedConfirmDialog.value = false;
|
||||
pendingRetryFailedAction = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 用户确认后执行重试动作;弹窗由 DeleteConfirmDialog 自行关闭。
|
||||
* 核心逻辑:取出并清空 pending,再 await 执行,避免重复确认。
|
||||
*/
|
||||
const handleRetryFailedConfirm = async () => {
|
||||
const action = pendingRetryFailedAction;
|
||||
pendingRetryFailedAction = null;
|
||||
showRetryFailedConfirmDialog.value = false;
|
||||
if (!action) return;
|
||||
await action();
|
||||
};
|
||||
|
||||
const shippingToastMessage = ref('');
|
||||
let shippingToastTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
@@ -85,7 +54,7 @@ export function useChatPageDialogs(messages: Ref<ChatMessage[]>) {
|
||||
};
|
||||
|
||||
/**
|
||||
* 展示非阻塞顶部 toast(用于发货批量重试等轻量成功反馈)。
|
||||
* 展示非阻塞顶部 toast。
|
||||
* @param message - toast 正文;空字符串视为关闭
|
||||
*/
|
||||
const showShippingToast = (message: string) => {
|
||||
@@ -143,10 +112,6 @@ export function useChatPageDialogs(messages: Ref<ChatMessage[]>) {
|
||||
openDeleteConfirmDialog,
|
||||
closeDeleteConfirmDialog,
|
||||
handleDeleteConfirm,
|
||||
showRetryFailedConfirmDialog,
|
||||
openRetryFailedConfirm,
|
||||
closeRetryFailedConfirm,
|
||||
handleRetryFailedConfirm,
|
||||
shippingToastMessage,
|
||||
showShippingToast,
|
||||
clearShippingToast,
|
||||
|
||||
Reference in new issue
Block a user