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

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>
<view class="content"> <view class="content">
<view class="header"> <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 class="time">{{ item.sentTime|timeCustomCN }}</view>
</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>
</view> </view>
</template> </template>
@@ -17,10 +19,6 @@
<script> <script>
import messagePreview from './messagePreview' import messagePreview from './messagePreview'
export default { export default {
props: { props: {
item: { item: {

View File

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

View File

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

View File

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

View File

@@ -94,9 +94,13 @@
getConversationList() { getConversationList() {
const count = 1000 const count = 1000
const timestamp = 0 const timestamp = 0
RongIMLib.getConversationList([1, 3], count, timestamp, (res) => { RongIMLib.getConversationList([1, 3], count, timestamp, ({
if (res.code === 0) { code,
this.conversations = res.conversations 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) { } else if (message.objectName === RongIMLib.ObjectName.ContactNotification) {
// 触发一个新好友的通知事件 // 触发一个新好友的通知事件
uni.$emit('onContactNotification', message) 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:LBSMsg',
'RC:SightMsg', 'RC:SightMsg',
'RC:ReferenceMsg', 'RC:ReferenceMsg',
'RC:CombineMsg' 'RC:CombineMsg',
'RC:GrpNtf'
] ]
RongIMLib.getHistoryMessagesByTimestamp( RongIMLib.getHistoryMessagesByTimestamp(