群解散的本地消息删除,提醒

This commit is contained in:
2022-02-17 12:06:30 +08:00
parent 155d59a6a3
commit 411b1ea349
7 changed files with 42 additions and 21 deletions

View File

@@ -6,10 +6,12 @@
</view>
<view class="content">
<view class="header">
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3" class='qun'>[]</text></view>
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3"
class='qun'>[]</text></view>
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
</view>
<message-preview class="preview" :msg="item.latestMessage" :conversationType="item.conversationType" :user="item.latestMessage.userInfo" />
<message-preview class="preview" :msg="item.latestMessage" :conversationType="item.conversationType"
:user="item.latestMessage.userInfo" />
</view>
</view>
</template>
@@ -17,10 +19,6 @@
<script>
import messagePreview from './messagePreview'
export default {
props: {
item: {

View File

@@ -24,6 +24,9 @@
<view class="preview" v-if="msg.objectName=='RC:VideoMsg'">
<text v-if="conversationType == 3">{{ user.name }}</text>[视频通话]
</view>
<view class="preview" v-if="msg.objectName=='RC:GrpNtf'">
[{{ msg.message }}]
</view>
</view>
</template>

View File

@@ -3,7 +3,7 @@
<list class="body" :show-scrollbar="false">
<cell class="cell" v-for="(item, index) in messages" :key="index">
<view class="cell-system" v-if="item.senderUserId === '__system__'">
<text class="text">{{ item.content.content }}</text>
<text class="text">{{ item.content.message }}</text>
</view>
<view v-else :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
<u-avatar class="avatar" @click="toUser(item)" size="36" shape="square"
@@ -180,6 +180,7 @@
.cell-system {
align-items: center;
.text {
font-size: 24rpx;
color: $text-gray-m;

View File

@@ -273,6 +273,7 @@
success: (res) => {
if (res.confirm) {
dismissGroup(this.targetId).then(res => {
console.log('解散群', res);
uni.showToast({
icon: 'none',
title: '解散成功'

View File

@@ -94,9 +94,13 @@
getConversationList() {
const count = 1000
const timestamp = 0
RongIMLib.getConversationList([1, 3], count, timestamp, (res) => {
if (res.code === 0) {
this.conversations = res.conversations
RongIMLib.getConversationList([1, 3], count, timestamp, ({
code,
conversations
}) => {
console.log(conversations);
if (code === 0) {
this.conversations = conversations
}
})
},

View File

@@ -162,6 +162,19 @@ const addListeners = () => {
} else if (message.objectName === RongIMLib.ObjectName.ContactNotification) {
// 触发一个新好友的通知事件
uni.$emit('onContactNotification', message)
} else if (message.objectName === RongIMLib.ObjectName.GroupNotification) {
// 解散群
if (message.content.operation === 'Dismiss') {
RongIMLib.cleanHistoryMessages(message.conversationType, message.targetId,
message.sentTime - 1, false, ({
code
}) => {
if (code == 0) {
uni.$emit('onGroupDismiss', message.targetId)
}
})
}
uni.$emit('onReceiveMessage', message)
}
})

View File

@@ -15,7 +15,8 @@ const getMessageList = (conversationType, targetId, timeStamp, count, isForward,
'RC:LBSMsg',
'RC:SightMsg',
'RC:ReferenceMsg',
'RC:CombineMsg'
'RC:CombineMsg',
'RC:GrpNtf'
]
RongIMLib.getHistoryMessagesByTimestamp(