feat: 新增以下为新消息提示

This commit is contained in:
kuaifan 2023-12-14 21:05:23 +08:00
parent c0342ea6d1
commit 3cce9b67d4
4 changed files with 49 additions and 1 deletions

View File

@ -1411,3 +1411,5 @@ APP推送
当前服务器 当前服务器
你确定取消待办吗? 你确定取消待办吗?
取消成功 取消成功
以下为新消息

View File

@ -1,5 +1,8 @@
<template> <template>
<div :class="classArray"> <div :class="classArray">
<div v-if="isUnreadStart" class="dialog-unread-label">
<em></em><span>{{$L('以下为新消息')}}</span><em></em>
</div>
<div v-if="source.type === 'tag'" class="dialog-tag" @click="onViewTag"> <div v-if="source.type === 'tag'" class="dialog-tag" @click="onViewTag">
<div class="tag-user"><UserAvatar :userid="source.userid" :show-name="true" :show-icon="false"/></div> <div class="tag-user"><UserAvatar :userid="source.userid" :show-name="true" :show-icon="false"/></div>
{{$L(source.msg.action === 'remove' ? '取消标注' : '标注了')}} {{$L(source.msg.action === 'remove' ? '取消标注' : '标注了')}}
@ -93,6 +96,10 @@ export default {
type: Number, type: Number,
default: 0 default: 0
}, },
unreadMsgId: {
type: Number,
default: 0
},
scrollIng: { scrollIng: {
type: Number, type: Number,
default: 0 default: 0
@ -118,6 +125,10 @@ export default {
return this.isRightMsg || this.source.read_at return this.isRightMsg || this.source.read_at
}, },
isUnreadStart() {
return this.unreadMsgId === this.source.id
},
hidePercentage() { hidePercentage() {
return this.simpleView || this.isMyDialog || this.isReply return this.simpleView || this.isMyDialog || this.isReply
}, },
@ -130,6 +141,7 @@ export default {
return { return {
'dialog-item': true, 'dialog-item': true,
'reply-item': this.isReply, 'reply-item': this.isReply,
'unread-start': this.isUnreadStart,
'self': this.isRightMsg, 'self': this.isRightMsg,
} }
}, },

View File

@ -155,7 +155,7 @@
:data-component="msgItem" :data-component="msgItem"
:item-class-add="itemClassAdd" :item-class-add="itemClassAdd"
:extra-props="{dialogData, operateVisible, operateItem, isMyDialog, msgId, scrollIng}" :extra-props="{dialogData, operateVisible, operateItem, isMyDialog, msgId, unreadMsgId, scrollIng}"
:estimate-size="dialogData.type=='group' ? 105 : 77" :estimate-size="dialogData.type=='group' ? 105 : 77"
:keeps="25" :keeps="25"
:disabled="scrollDisabled" :disabled="scrollDisabled"
@ -570,6 +570,7 @@ export default {
msgNew: 0, msgNew: 0,
msgType: '', msgType: '',
loadIng: 0, loadIng: 0,
unreadMsgId: 0,
allMsgs: [], allMsgs: [],
tempMsgs: [], tempMsgs: [],
@ -964,6 +965,7 @@ export default {
} }
const item = $A.cloneJSON(position_msgs[0]) const item = $A.cloneJSON(position_msgs[0])
if (item.label === '{UNREAD}') { if (item.label === '{UNREAD}') {
item.is_unread = unread > 1
item.label = this.$L(`未读消息${unread}`) item.label = this.$L(`未读消息${unread}`)
} }
return item return item
@ -994,6 +996,7 @@ export default {
this.msgNew = 0 this.msgNew = 0
this.msgType = '' this.msgType = ''
this.searchShow = false this.searchShow = false
this.unreadMsgId = 0
// //
if (this.allMsgList.length > 0) { if (this.allMsgList.length > 0) {
this.allMsgs = this.allMsgList this.allMsgs = this.allMsgList
@ -1197,6 +1200,12 @@ export default {
requestAnimationFrame(this.onToBottom) requestAnimationFrame(this.onToBottom)
} }
} }
},
positionMsg(msg) {
if (msg && msg.is_unread === true) {
this.unreadMsgId = msg.msg_id
}
} }
}, },

View File

@ -1115,6 +1115,31 @@
} }
&.unread-start {
position: relative;
padding-top: 44px;
.dialog-unread-label {
position: absolute;
top: 4px;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
> em {
height: 1px;
background-color: #e9e9e9;
flex: 1;
margin: 0 12px;
max-width: 60px;
}
> span {
font-size: 12px;
color: $primary-desc-color;
}
}
}
&.loading { &.loading {
height: 20px; height: 20px;
box-sizing: content-box; box-sizing: content-box;