chore: 调整弹窗错误提示逻辑,显示后 3 秒消失 (#9868)

This commit is contained in:
liaoxuezhi 2024-03-25 20:42:07 +08:00 committed by 2betop
parent 7e03085faf
commit 95787b98ef
2 changed files with 19 additions and 15 deletions

View File

@ -398,6 +398,7 @@ export default class Dialog extends React.Component<DialogProps> {
statusStore && isAlive(statusStore) && statusStore.resetAll();
if (isAlive(store)) {
store.reset();
store.clearMessage();
store.setEntered(false);
if (typeof lazySchema === 'function') {
store.setSchema('');
@ -938,7 +939,8 @@ export class DialogRenderer extends Dialog {
store.updateMessage(reason.message, true);
store.markBusying(false);
if (reason.constructor?.name === ValidateError.name) {
// 通常都是数据错误,过 3 秒自动清理错误信息
// if (reason.constructor?.name === ValidateError.name) {
clearTimeout(this.clearErrorTimer);
this.clearErrorTimer = setTimeout(() => {
if (this.isDead) {
@ -946,7 +948,7 @@ export class DialogRenderer extends Dialog {
}
store.updateMessage('');
}, 3000);
}
// }
});
return true;

View File

@ -448,6 +448,7 @@ export default class Drawer extends React.Component<DrawerProps> {
statusStore && isAlive(statusStore) && statusStore.resetAll();
if (isAlive(store)) {
store.reset();
store.clearMessage();
store.setEntered(false);
if (typeof lazySchema === 'function') {
store.setSchema('');
@ -891,12 +892,13 @@ export class DrawerRenderer extends Drawer {
store.updateMessage(reason.message, true);
store.markBusying(false);
if (reason.constructor?.name === ValidateError.name) {
// 通常都是数据错误,过 3 秒自动清理错误信息
// if (reason.constructor?.name === ValidateError.name) {
clearTimeout(this.clearErrorTimer);
this.clearErrorTimer = setTimeout(() => {
store.updateMessage('');
}, 3000);
}
// }
});
return true;