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