Merge "fix: fix close the error message"

This commit is contained in:
Zuul 2023-04-21 09:31:53 +00:00 committed by Gerrit Code Review
commit 4817423f80
2 changed files with 16 additions and 2 deletions

View File

@ -66,7 +66,9 @@ export class BaseLayout extends Component {
} }
get noticeCount() { get noticeCount() {
return this.rootStore.noticeCount; return (
this.rootStore.noticeCount - (this.rootStore.noticeCountWaitRemove || 0)
);
} }
get user() { get user() {

View File

@ -66,6 +66,8 @@ export class RootStore {
@observable @observable
noticeCount = 0; noticeCount = 0;
noticeCountWaitRemove = 0;
@observable @observable
enableBilling = false; enableBilling = false;
@ -187,6 +189,7 @@ export class RootStore {
this.hasAdminPageRole = false; this.hasAdminPageRole = false;
this.version = ''; this.version = '';
this.noticeCount = 0; this.noticeCount = 0;
this.noticeCountWaitRemove = 0;
this.goToLoginPage(); this.goToLoginPage();
} }
@ -238,12 +241,21 @@ export class RootStore {
@action @action
removeNoticeCount() { removeNoticeCount() {
this.noticeCount -= 1; const elements = document.getElementsByClassName('ant-modal');
// if there is an modal in the page, the notice count will be changed later, after no modal.
if (elements.length > 0) {
this.noticeCountWaitRemove += 1;
} else {
const noticeCount = this.noticeCount - 1 - this.noticeCountWaitRemove;
this.noticeCount = noticeCount < 0 ? 0 : noticeCount;
this.noticeCountWaitRemove = 0;
}
} }
@action @action
clearNoticeCount() { clearNoticeCount() {
this.noticeCount = 0; this.noticeCount = 0;
this.noticeCountWaitRemove = 0;
} }
clearData() { clearData() {