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

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: {
@@ -72,9 +70,9 @@
.name {
font-size: $title-size + 2;
color: #454545;
display: flex;
align-items: center;
color: #454545;
display: flex;
align-items: center;
.qun {
color: $main-color;

View File

@@ -23,6 +23,9 @@
</view>
<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"
@@ -178,8 +178,9 @@
.cell {
padding: 10rpx 30rpx;
.cell-system {
.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

@@ -53,10 +53,10 @@
},
onLoad() {
// 好友申请数量
this.checkNewFriendPending()
// 监听新的好友申请
uni.$on('onContactNotification', () => {
this.checkNewFriendPending()
this.checkNewFriendPending()
// 监听新的好友申请
uni.$on('onContactNotification', () => {
this.checkNewFriendPending()
})
},
onShow() {
@@ -76,7 +76,7 @@
},
methods: {
checkNewFriendPending() {
im.getPendingList((pendings) => {
im.getPendingList((pendings) => {
console.log(pendings);
this.hasNewFriends = pendings.length
})
@@ -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

@@ -159,9 +159,22 @@ const addListeners = () => {
}) => {
console.log('消息删除结果', code)
})
} else if (message.objectName === RongIMLib.ObjectName.ContactNotification) {
} 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(