权限邀请调试测试
This commit is contained in:
@@ -143,7 +143,7 @@ const createGroupAnnouncement = (groupId, content) => {
|
||||
})
|
||||
}
|
||||
// 查看该公告详情
|
||||
const getGroupAnnouncement = (groupId, announcementId) => {
|
||||
const getGroupAnnouncement = (groupId, announcementId) => {
|
||||
return request({
|
||||
method: 'GET',
|
||||
url: 'im/groups/' + groupId + '/announcements/' + announcementId
|
||||
@@ -157,10 +157,10 @@ const deleteGroupAnnouncement = (groupId, 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
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -283,10 +284,10 @@ const transferGroupOwner = (groupId, 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'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
title:err.message,
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 500
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
uni.$emit('groupInvitedUser')
|
||||
|
||||
@@ -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);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user