权限邀请调试测试

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

@@ -160,7 +160,7 @@ const deleteGroupAnnouncement = (groupId, announcementId) => {
const topGroupAnnouncement = (groupId, announcementId) => { const topGroupAnnouncement = (groupId, announcementId) => {
return request({ return request({
method: 'POST', 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({ return request({
method: 'POST', method: 'POST',
url: 'im/groups/' + groupId + '/invite', url: 'im/groups/' + groupId + '/invite',
data: { data: {
userIds userIds: userIds,
allowIds: allowIds
} }
}) })
} }
@@ -283,10 +284,10 @@ const transferGroupOwner = (groupId, userId) => {
// 通过审核验证群成员 // 通过审核验证群成员
const groupMakeSure = (groupId,user) => { const groupMakeSure = (groupId, user) => {
return request({ return request({
url:`im/groups/${groupId}/makesure/${user}`, url: `im/groups/${groupId}/makesure/${user}`,
method:'POST' method: 'POST'
}) })
} }

View File

@@ -89,14 +89,25 @@
this.getNewMessage() this.getNewMessage()
} }
}) })
uni.$on('onReceiptRequested', (msg) => { uni.$on('onReceiptRequest', (msg) => {
if (msg.targetId == this.targetId) { 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) uni.$once('cleanGroupMessage', this.getMessageList)
}, },
onUnload() {
uni.$off('onReceiptRequest')
uni.$off('onReceiptResponse')
},
onNavigationBarButtonTap() { onNavigationBarButtonTap() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/group/info?targetId=' + this.targetId url: '/pages/im/group/info?targetId=' + this.targetId
@@ -138,30 +149,13 @@
20, 20,
true, true,
(messages) => { (messages) => {
RongIMLib.sendReadReceiptResponse(3, this.targetId, messages, (res) => {
console.error('发送群聊已读回执成功', res);
})
this.messages = messages this.messages = messages
this.scrollBottom() 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) { scrollBottom(type) {
if (this.latestMessage) { if (this.latestMessage) {

View File

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

View File

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

View File

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