群邀请消息获取

This commit is contained in:
2022-02-22 14:59:53 +08:00
parent d812ac2862
commit 66092967cb
9 changed files with 163 additions and 126 deletions

View File

@@ -77,7 +77,6 @@
this.targetId = e.targetId
// 获取群成员数量
getGroupBase(this.targetId).then(res => {
console.log(res);
uni.setNavigationBarTitle({
title: res.name + `(${res.members})`
})
@@ -90,6 +89,11 @@
this.getNewMessage()
}
})
uni.$on('onReceiptRequested', (msg) => {
if (msg.targetId == this.targetId) {
console.log('群聊消息是否已读', msg);
}
})
// 清理聊天记录
uni.$once('cleanGroupMessage', this.getMessageList)
},
@@ -138,14 +142,32 @@
this.scrollBottom()
})
},
// 发送已读回执
sendReadReceiptResponse(messages) {
const msgs = messages.map((item) => {
if (item.receivedStatus == 0) {
return {
conversationType: 3,
targetId: this.targetId,
messageId: item.messageId,
messageDirection: item.messageDirection,
objectName: item.objectName
}
}
}).filter(Boolean)
if (msgs.length) {
console.error('发送群聊已读回执', msgs);
RongIMLib.sendReadReceiptResponse(3, this.targetId, msgs, (res) => {
console.error('发送群聊已读回执成功', res);
})
}
},
// 滚动到底部
scrollBottom(type) {
if (this.latestMessage) {
// 清理当前会话,未读消息数量
RongIMLib.clearMessagesUnreadStatus(this.conversationType, this.targetId, this.latestMessage
.sentTime)
// // 发送消息已读状态给对方
// RongIMLib.sendReadReceiptMessage(this.conversationType, this.targetId, this.latestMessage.sentTime)
// 更新badge提醒数量
im.setNotifyBadge()
}
@@ -175,7 +197,7 @@
justify-content: flex-end;
.cell {
padding: 10rpx 30rpx;
padding: 10rpx 20rpx;
.time {
text-align: center;
@@ -183,9 +205,9 @@
color: #666;
}
.cell-item {
.cell-item {
display: flex;
width: 690rpx;
width: 710rpx;
justify-content: flex-start;
&.left {
@@ -203,20 +225,6 @@
.msg {
margin: 0 20rpx;
.state {
padding-top: 10rpx;
.state-text {
font-size: $title-size-m - 2;
color: rgba($color: $main-color, $alpha: 0.3)
}
.state-text-active {
font-size: $title-size-m - 2;
color: #cecece;
}
}
}
}