perf: 优化通知
This commit is contained in:
parent
f7921bf388
commit
2fc039dd70
@ -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,39 +675,44 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addDialogMsg(data) {
|
addDialogMsg(data) {
|
||||||
if (this.natificationHidden && this.natificationReady) {
|
if (!this.natificationReady) {
|
||||||
const {id, dialog_id, type, msg} = data;
|
return;
|
||||||
let body = '';
|
}
|
||||||
switch (type) {
|
if (!this.natificationHidden && this.curPath == "/manage/messenger" && this.dialogOpenId == data.dialog_id) {
|
||||||
case 'text':
|
return;
|
||||||
body = msg.text;
|
}
|
||||||
break;
|
//
|
||||||
case 'file':
|
const {id, dialog_id, type, msg} = data;
|
||||||
body = '[' + this.$L(msg.type == 'img' ? '图片信息' : '文件信息') + ']'
|
let body = '';
|
||||||
break;
|
switch (type) {
|
||||||
default:
|
case 'text':
|
||||||
return;
|
body = msg.text;
|
||||||
}
|
break;
|
||||||
this._notificationId = id;
|
case 'file':
|
||||||
this.notificationClass.replaceOptions({
|
body = '[' + this.$L(msg.type == 'img' ? '图片信息' : '文件信息') + ']'
|
||||||
icon: $A.originUrl('images/logo.png'),
|
break;
|
||||||
body: body,
|
default:
|
||||||
data: data,
|
return;
|
||||||
tag: "dialog",
|
}
|
||||||
requireInteraction: true
|
this._notificationId = id;
|
||||||
});
|
this.notificationClass.replaceOptions({
|
||||||
let dialog = this.cacheDialogs.find((item) => item.id == dialog_id);
|
icon: $A.originUrl('images/logo.png'),
|
||||||
if (dialog) {
|
body: body,
|
||||||
this.notificationClass.replaceTitle(dialog.name);
|
data: data,
|
||||||
this.notificationClass.userAgreed();
|
tag: "dialog",
|
||||||
} else {
|
requireInteraction: true
|
||||||
this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => {
|
});
|
||||||
if (this._notificationId === id) {
|
let dialog = this.cacheDialogs.find((item) => item.id == dialog_id);
|
||||||
this.notificationClass.replaceTitle(data.name);
|
if (dialog) {
|
||||||
this.notificationClass.userAgreed();
|
this.notificationClass.replaceTitle(dialog.name);
|
||||||
}
|
this.notificationClass.userAgreed();
|
||||||
}).catch(() => {})
|
} else {
|
||||||
}
|
this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => {
|
||||||
|
if (this._notificationId === id) {
|
||||||
|
this.notificationClass.replaceTitle(data.name);
|
||||||
|
this.notificationClass.userAgreed();
|
||||||
|
}
|
||||||
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -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);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user