mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-05 00:47:05 +00:00
perf: 移动客户端群消息通知加上群名称
This commit is contained in:
parent
444afc30e4
commit
4c6b58cbd5
@ -6,7 +6,7 @@
|
||||
@click.stop="onClick"
|
||||
@touchstart="onTouchstart"
|
||||
@touchmove="onTouchmove">
|
||||
<UserAvatar :userid="userid" :size="40" show-name/>
|
||||
<UserAvatar :userid="userid" :size="40" show-name :name-text="title"/>
|
||||
<div class="notification-desc">{{desc}}</div>
|
||||
</div>
|
||||
</transition>
|
||||
@ -18,6 +18,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
userid: 0,
|
||||
title: '',
|
||||
desc: '',
|
||||
duration: 6000,
|
||||
callback: null,
|
||||
@ -40,6 +41,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
this.userid = config.userid || 0;
|
||||
this.title = config.title || "";
|
||||
this.desc = config.desc || "";
|
||||
this.duration = typeof config.duration === "number" ? config.duration : 6000;
|
||||
this.callback = typeof config.callback === "function" ? config.callback : null;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
</EAvatar>
|
||||
</div>
|
||||
<template v-if="showName">
|
||||
<div class="avatar-name" :style="nameStyle">{{user.nickname}}</div>
|
||||
<div class="avatar-name" :style="nameStyle">{{nameText || user.nickname}}</div>
|
||||
</template>
|
||||
</div>
|
||||
</ETooltip>
|
||||
@ -56,6 +56,10 @@
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
nameText: {
|
||||
type: String,
|
||||
default: null // showName = true 时有效,留空就显示会员昵称
|
||||
},
|
||||
tooltipDisabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
||||
@ -485,6 +485,7 @@ export default {
|
||||
...mapState([
|
||||
'userInfo',
|
||||
'userIsAdmin',
|
||||
'cacheUserBasic',
|
||||
'cacheTasks',
|
||||
'cacheDialogs',
|
||||
'cacheProjects',
|
||||
@ -933,7 +934,7 @@ export default {
|
||||
return; // 窗口激活且最后打开的会话是通知的会话时不通知
|
||||
}
|
||||
//
|
||||
const {id, dialog_id, type, msg, userid} = data;
|
||||
const {id, dialog_id, dialog_type, type, msg, userid} = data;
|
||||
if (userid == this.userId) {
|
||||
return; // 自己的消息不通知
|
||||
}
|
||||
@ -949,11 +950,37 @@ export default {
|
||||
return;
|
||||
}
|
||||
this.__notificationId = id;
|
||||
const notificationFunc = (title) => {
|
||||
const notificationFuncA = (title) => {
|
||||
if (dialog_type === 'group') {
|
||||
let tempUser = this.cacheUserBasic.find(item => item.userid == userid);
|
||||
if (tempUser) {
|
||||
notificationFuncB(`${title} (${tempUser.nickname})`)
|
||||
} else {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'users/basic',
|
||||
data: {
|
||||
userid: [userid]
|
||||
},
|
||||
checkRole: false
|
||||
}).then(({data}) => {
|
||||
tempUser = data.find(item => item.userid == userid);
|
||||
if (tempUser) {
|
||||
notificationFuncB(`${title} (${tempUser.nickname})`)
|
||||
}
|
||||
}).catch(_ => {
|
||||
notificationFuncB(title)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
notificationFuncB(title)
|
||||
}
|
||||
}
|
||||
const notificationFuncB = (title) => {
|
||||
if (this.__notificationId === id) {
|
||||
if (this.$isEEUiApp) {
|
||||
this.$refs.mobileNotification.open({
|
||||
userid: userid,
|
||||
title,
|
||||
desc: body,
|
||||
callback: () => {
|
||||
this.goForward({name: 'manage-messenger'});
|
||||
@ -975,11 +1002,9 @@ export default {
|
||||
}
|
||||
const dialog = this.cacheDialogs.find((item) => item.id == dialog_id);
|
||||
if (dialog) {
|
||||
notificationFunc(dialog.name)
|
||||
notificationFuncA(dialog.name)
|
||||
} else {
|
||||
this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => {
|
||||
notificationFunc(data.name)
|
||||
}).catch(() => {})
|
||||
this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => notificationFuncA(data.name)).catch(() => {})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user