权限邀请调试测试

This commit is contained in:
Z
2022-02-22 16:42:57 +08:00
5 changed files with 50 additions and 55 deletions

View File

@@ -88,9 +88,9 @@ const searchFriend = (value) => {
const pedingFriend = (recipient, message) => {
return request({
method: 'POST',
url: 'im/friends/' + recipient,
data: {
message
url: 'im/friends/' + recipient,
data: {
message
}
})
}
@@ -120,7 +120,7 @@ const getGroupBase = (groupId) => {
})
}
const getGroupUsers = (groupId, limit) => {
const getGroupUsers = (groupId, limit) => {
limit = limit || 0
return request({
url: 'im/groups/' + groupId + '/users?limit=' + limit
@@ -141,9 +141,9 @@ const createGroupAnnouncement = (groupId, content) => {
content: content
}
})
}
}
// 查看该公告详情
const getGroupAnnouncement = (groupId, announcementId) => {
const getGroupAnnouncement = (groupId, announcementId) => {
return request({
method: 'GET',
url: 'im/groups/' + groupId + '/announcements/' + announcementId
@@ -155,12 +155,12 @@ const deleteGroupAnnouncement = (groupId, announcementId) => {
method: 'DELETE',
url: 'im/groups/' + groupId + '/announcements/' + announcementId
})
}
// 置顶群公告
const topGroupAnnouncement = (groupId, announcementId) => {
}
// 置顶群公告
const topGroupAnnouncement = (groupId, announcementId) => {
return request({
method: 'POST',
url: 'im/groups/' + groupId + '/announcements/' + announcementId+'/top',
url: 'im/groups/' + groupId + '/announcements/' + announcementId + '/top',
})
}
@@ -241,12 +241,13 @@ const removeGroupUser = (groupId, userId) => {
/**
* 邀请群成员
*/
const inviteGroupUser = (groupId, userIds) => {
const inviteGroupUser = (groupId, userIds, allowIds) => {
return request({
method: 'POST',
url: 'im/groups/' + groupId + '/invite',
data: {
userIds
userIds: userIds,
allowIds: allowIds
}
})
}
@@ -280,16 +281,16 @@ const transferGroupOwner = (groupId, userId) => {
url: 'im/groups/' + groupId + '/owner/' + userId
})
}
// 通过审核验证群成员
const groupMakeSure = (groupId,user) => {
const groupMakeSure = (groupId, user) => {
return request({
url:`im/groups/${groupId}/makesure/${user}`,
method:'POST'
url: `im/groups/${groupId}/makesure/${user}`,
method: 'POST'
})
}
}
export {
@@ -310,16 +311,16 @@ export {
getGroupInfo,
getGroupBase,
getGroupUsers,
getGroupAnnouncements,
getGroupAnnouncements,
getGroupAnnouncement,
createGroupAnnouncement,
deleteGroupAnnouncement,
deleteGroupAnnouncement,
topGroupAnnouncement,
searchGroup,
joinGroupPre,
joinGroup,
quitGroup,
dismissGroup,
dismissGroup,
inviteGroupUser,
removeGroupUser,
setGroupAdmin,

View File

@@ -89,14 +89,25 @@
this.getNewMessage()
}
})
uni.$on('onReceiptRequested', (msg) => {
uni.$on('onReceiptRequest', (msg) => {
if (msg.targetId == this.targetId) {
console.log('群聊消息是否已读', msg);
RongIMLib.getMessageByUId(msg.messageUId, (result) => {
RongIMLib.sendReadReceiptResponse(3, this.targetId, [result.message], (res) => {
console.error('发送群聊已读回执成功', res);
})
})
}
})
uni.$on('onReceiptResponse', (msg) => {
console.log('远端消息已读,本地获取有几个人读了', msg);
})
// 清理聊天记录
uni.$once('cleanGroupMessage', this.getMessageList)
},
onUnload() {
uni.$off('onReceiptRequest')
uni.$off('onReceiptResponse')
},
onNavigationBarButtonTap() {
uni.navigateTo({
url: '/pages/im/group/info?targetId=' + this.targetId
@@ -138,30 +149,13 @@
20,
true,
(messages) => {
RongIMLib.sendReadReceiptResponse(3, this.targetId, messages, (res) => {
console.error('发送群聊已读回执成功', res);
})
this.messages = messages
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) {

View File

@@ -8,8 +8,8 @@
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column">
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#ededed" height="20" size="12"
color="#666" style="padding:10rpx 30rpx" />
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#f9f9f9f" height="20" size="12"
color="#666" style="border:none !important;padding: 10rpx 30rpx;background-color: #f9f9f9 !important;" />
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
@click="addContact(friendItem.targetId)">
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
@@ -125,14 +125,14 @@
onInvite() {
console.log(this.checkboxValue,'userIds.....')
console.log(this.selectValue,'userIds.....')
// let userIds = []
// this.checkboxValue.filter(item=>{
// if(!utils.inArray(item, this.selectValue)){
// userIds.push(item)
// }
// })
let userIds = []
this.checkboxValue.filter(item=>{
if(!utils.inArray(item, this.selectValue)){
userIds.push(item)
}
})
// console.log(userIds)
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
inviteGroupUser(this.targetId, this.checkboxValue,userIds).then(res => {
uni.navigateBack({
delta: 1,
animationType: 'pop-out',

View File

@@ -96,7 +96,7 @@
title:err.message,
icon: 'none',
mask: true,
duration: 500
duration: 2000
})
this.getList()
uni.$emit('groupInvitedUser')

View File

@@ -101,11 +101,11 @@ const imLibListeners = () => {
data
}) => {
console.error('onReceiptRequested', data);
uni.$emit('onReceiptRequested', data)
uni.$emit('onReceiptRequest', data)
})
// 群消息已读的回执
IMLib.addReceiptResponseListener((res) => {
console.error('addReceiptResponseListener', res);
console.error('onReceiptResponse', res);
})
}