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

View File

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