lint
This commit is contained in:
1 parent
fc250c54ed
commit
5eec516459
62 files changed
+3912
-3376
No files matched your search
@@ -1,25 +1,22 @@
|
||||
// 定义对话框选项接口
|
||||
interface BaseDialogOptions {
|
||||
title: string
|
||||
message: string
|
||||
confirmText?: string
|
||||
cancelText?: string
|
||||
confirmColor?: string
|
||||
title: string;
|
||||
message: string;
|
||||
confirmText?: string;
|
||||
cancelText?: string;
|
||||
confirmColor?: string;
|
||||
}
|
||||
|
||||
interface ConfirmDialogOptions extends BaseDialogOptions { }
|
||||
|
||||
interface MessageDialogOptions extends BaseDialogOptions {
|
||||
dialogColor?: string
|
||||
dialogColor?: string;
|
||||
}
|
||||
|
||||
// 对话框类型
|
||||
type DialogType = 'confirm' | 'info' | 'success' | 'warning' | 'error'
|
||||
|
||||
// 全局对话框管理器接口
|
||||
interface GlobalDialogManager {
|
||||
showConfirm: (options: ConfirmDialogOptions) => Promise<boolean>
|
||||
showMessage: (options: MessageDialogOptions) => Promise<void>
|
||||
showConfirm: (options: ConfirmDialogOptions) => Promise<boolean>;
|
||||
showMessage: (options: MessageDialogOptions) => Promise<void>;
|
||||
}
|
||||
|
||||
// 确认对话框服务
|
||||
@@ -27,11 +24,11 @@ export const ConfirmDialogService = {
|
||||
// 显示确认对话框
|
||||
async confirm(options: ConfirmDialogOptions): Promise<boolean> {
|
||||
if (window.ConfirmDialogManager) {
|
||||
return (window.ConfirmDialogManager as GlobalDialogManager).showConfirm(options)
|
||||
return (window.ConfirmDialogManager as GlobalDialogManager).showConfirm(options);
|
||||
} else {
|
||||
console.error('GlobalDialog component not properly initialized')
|
||||
console.error('GlobalDialog component not properly initialized');
|
||||
// 降级到原生 confirm
|
||||
return confirm(`${options.title}: ${options.message}`)
|
||||
return confirm(`${options.title}: ${options.message}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -41,12 +38,12 @@ export const ConfirmDialogService = {
|
||||
return (window.ConfirmDialogManager as GlobalDialogManager).showMessage({
|
||||
...options,
|
||||
dialogColor: options.dialogColor || 'info',
|
||||
confirmColor: options.confirmColor || 'white'
|
||||
})
|
||||
confirmColor: options.confirmColor || 'white',
|
||||
});
|
||||
} else {
|
||||
console.error('GlobalDialog component not properly initialized')
|
||||
console.error('GlobalDialog component not properly initialized');
|
||||
// 降级到原生 alert
|
||||
alert(`${options.title}: ${options.message}`)
|
||||
alert(`${options.title}: ${options.message}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -56,12 +53,12 @@ export const ConfirmDialogService = {
|
||||
return (window.ConfirmDialogManager as GlobalDialogManager).showMessage({
|
||||
...options,
|
||||
dialogColor: options.dialogColor || 'success',
|
||||
confirmColor: options.confirmColor || 'white'
|
||||
})
|
||||
confirmColor: options.confirmColor || 'white',
|
||||
});
|
||||
} else {
|
||||
console.error('GlobalDialog component not properly initialized')
|
||||
console.error('GlobalDialog component not properly initialized');
|
||||
// 降级到原生 alert
|
||||
alert(`${options.title}: ${options.message}`)
|
||||
alert(`${options.title}: ${options.message}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -71,12 +68,12 @@ export const ConfirmDialogService = {
|
||||
return (window.ConfirmDialogManager as GlobalDialogManager).showMessage({
|
||||
...options,
|
||||
dialogColor: options.dialogColor || 'warning',
|
||||
confirmColor: options.confirmColor || 'white'
|
||||
})
|
||||
confirmColor: options.confirmColor || 'white',
|
||||
});
|
||||
} else {
|
||||
console.error('GlobalDialog component not properly initialized')
|
||||
console.error('GlobalDialog component not properly initialized');
|
||||
// 降级到原生 alert
|
||||
alert(`${options.title}: ${options.message}`)
|
||||
alert(`${options.title}: ${options.message}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -86,12 +83,12 @@ export const ConfirmDialogService = {
|
||||
return (window.ConfirmDialogManager as GlobalDialogManager).showMessage({
|
||||
...options,
|
||||
dialogColor: options.dialogColor || 'error',
|
||||
confirmColor: options.confirmColor || 'white'
|
||||
})
|
||||
confirmColor: options.confirmColor || 'white',
|
||||
});
|
||||
} else {
|
||||
console.error('GlobalDialog component not properly initialized')
|
||||
console.error('GlobalDialog component not properly initialized');
|
||||
// 降级到原生 alert
|
||||
alert(`${options.title}: ${options.message}`)
|
||||
alert(`${options.title}: ${options.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user