好友申请流程优化,群创建简化

This commit is contained in:
2022-02-14 14:23:28 +08:00
parent d8c1ab7090
commit b61d90de4e
10 changed files with 113 additions and 114 deletions

View File

@@ -41,6 +41,21 @@ const getMessageList = (conversationType, targetId, timeStamp, count, isForward,
)
}
// 获取好友申请列表
const getPendingList = (callback, total) => {
total = total || 100
RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], total, 0, (res) => {
if (res.code === 0) {
const pendings = res.conversations.filter((item) => {
return item.objectName == RongIMLib.ObjectName.ContactNotification &&
item.latestMessage.operation === 'Request'
})
callback(pendings)
}
})
}
/**
* 发送文本消息
* @param {number} conversationType 消息类型
@@ -57,16 +72,16 @@ const sentText = (conversationType, targetId, content, user, callback) => {
content: content,
userInfo: user
}
}
}
RongIMLib.sendMessage(msg, ({
code,
messageId
}) => {
if (code === 0) {
callback(messageId)
} else {
console.log('发送失败', msg);
} else {
console.log('发送失败', msg);
uni.showToast({
icon: 'none',
title: '发送失败' + code
@@ -189,7 +204,8 @@ const sendFile = (conversationType, targetId, fileUrl, time, callback) => {
}
export default {
getMessageList,
getMessageList,
getPendingList,
sentText,
sentVoice,
sentImage,