perf: 优化通知内容

This commit is contained in:
kuaifan 2025-07-07 14:52:24 +08:00
parent 1e0a19ea7a
commit f21d45e697

View File

@ -1057,17 +1057,16 @@ export default {
if (userid == this.userId) { if (userid == this.userId) {
return; // return; //
} }
const body = $A.getMsgSimpleDesc(data);
this.__notificationId = id; this.__notificationId = id;
// //
const notificationFuncA = async (title) => { const notificationFuncA = async (title, body) => {
const tempUser = await this.$store.dispatch("getUserData", userid).catch(_ => {}); const tempUser = await this.$store.dispatch("getUserData", userid).catch(_ => {});
if (dialog_type === 'group' && tempUser) { if (dialog_type === 'group' && tempUser) {
title = `${title} (${tempUser.nickname})` body = tempUser.nickname + ': ' + body;
} }
notificationFuncB(title, tempUser?.userimg) notificationFuncB(title, body, tempUser?.userimg)
} }
const notificationFuncB = (title, userimg) => { const notificationFuncB = (title, body, userimg) => {
if (this.__notificationId === id) { if (this.__notificationId === id) {
this.__notificationId = null this.__notificationId = null
if (this.$isEEUIApp) { if (this.$isEEUIApp) {
@ -1103,10 +1102,11 @@ export default {
} }
} }
const dialog = this.cacheDialogs.find((item) => item.id == dialog_id); const dialog = this.cacheDialogs.find((item) => item.id == dialog_id);
const summary = $A.getMsgSimpleDesc(data);
if (dialog) { if (dialog) {
notificationFuncA(dialog.name) notificationFuncA(dialog.name, summary)
} else { } else {
this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => notificationFuncA(data.name)).catch(() => {}) this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => notificationFuncA(data.name, summary)).catch(() => {})
} }
}, },