perf: 优化通知

This commit is contained in:
kuaifan 2022-02-12 09:50:02 +08:00
parent f7921bf388
commit 2fc039dd70
2 changed files with 44 additions and 36 deletions

View File

@ -337,6 +337,7 @@ export default {
'taskId', 'taskId',
'wsOpenNum', 'wsOpenNum',
'columnTemplate', 'columnTemplate',
'dialogOpenId',
'themeMode', 'themeMode',
'themeList', 'themeList',
@ -449,7 +450,7 @@ export default {
natificationHidden(val) { natificationHidden(val) {
clearTimeout(this.notificationTimeout); clearTimeout(this.notificationTimeout);
if (!val) { if (!val && this.notificationClass) {
this.notificationTimeout = setTimeout(() => { this.notificationTimeout = setTimeout(() => {
this.notificationClass.close(); this.notificationClass.close();
}, 6000); }, 6000);
@ -674,7 +675,13 @@ export default {
}, },
addDialogMsg(data) { addDialogMsg(data) {
if (this.natificationHidden && this.natificationReady) { if (!this.natificationReady) {
return;
}
if (!this.natificationHidden && this.curPath == "/manage/messenger" && this.dialogOpenId == data.dialog_id) {
return;
}
//
const {id, dialog_id, type, msg} = data; const {id, dialog_id, type, msg} = data;
let body = ''; let body = '';
switch (type) { switch (type) {
@ -707,7 +714,6 @@ export default {
} }
}).catch(() => {}) }).catch(() => {})
} }
}
}, },
taskVisibleChange(visible) { taskVisibleChange(visible) {

View File

@ -199,6 +199,10 @@ export default {
this.getContactsList(1); this.getContactsList(1);
} }
}, },
dialogId(id) {
$A.setStorage("messenger::dialogId", id);
this.$store.state.dialogOpenId = id;
},
dialogOpenId(id) { dialogOpenId(id) {
this.dialogId = id; this.dialogId = id;
}, },
@ -247,11 +251,9 @@ export default {
closeDialog() { closeDialog() {
this.dialogId = 0; this.dialogId = 0;
$A.setStorage("messenger::dialogId", 0)
}, },
openDialog(dialog, smooth) { openDialog(dialog, smooth) {
$A.setStorage("messenger::dialogId", dialog.id)
this.dialogId = dialog.id; this.dialogId = dialog.id;
this.scrollIntoActive(smooth); this.scrollIntoActive(smooth);
}, },