group mangage

This commit is contained in:
cansnow
2026-01-10 15:40:38 +08:00
parent 825ac3457d
commit 941464c330
12 changed files with 392 additions and 181 deletions
+27 -15
View File
@@ -26,7 +26,7 @@
import SelectHeader from "./components/SelectHeader";
import SelectFooter from "./components/SelectFooter";
import {markConversationAsRead} from "@/util/imCommon";
import IMSDK, {MessageType} from "openim-uniapp-polyfill";
import IMSDK, {MessageType,GroupMemberRole} from "openim-uniapp-polyfill";
export default {
components: {
ChatingHeader,
@@ -52,8 +52,18 @@
...mapGetters([
"storeHistoryMessageList",
"storeCurrentUserID",
"storeCurrentConversation","storeCurrentMsg",'storeCurrentMsgID'
"storeCurrentConversation",
"storeCurrentMsg",
'storeCurrentMsgID',
"storeCurrentGroup",
"storeCurrentMemberInGroup"
]),
isOwner() {
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
},
isAdmin() {
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
},
},
created() {
this.Audio = uni.createInnerAudioContext(); //音频
@@ -174,7 +184,7 @@
this.onUserMessageEvent({type: 'cancelSelect'});
},
async doForwarMsg(userList, groupList, msgiem)
{
{b
//console.log(userList,groupList);
const _this = this;
for (var i = 0; i < userList.length; i++) {
@@ -234,7 +244,11 @@
}
return;
}
if (e.type == 'deleteMsg') {
if (e.type == 'deleteMsg' || e.type == 'deleteServerMsg') {
let method = IMSDK.IMMethods.DeleteMessageFromLocalStorage;
if(e.type == 'deleteServerMsg'){
method = IMSDK.IMMethods.DeleteMessage
}
let deleteMsgs = [];
if (!data) {
deleteMsgs = [...this.selectItems];
@@ -243,19 +257,11 @@
}
for (let i = 0; i < deleteMsgs.length; i++) {
let element = deleteMsgs[i];
IMSDK.asyncApi(IMSDK.IMMethods.DeleteMessageFromLocalStorage, IMSDK.uuid(), {
//IMSDK.asyncApi(IMSDK.IMMethods.DeleteMessage, IMSDK.uuid(), {
IMSDK.asyncApi(method, IMSDK.uuid(), {
conversationID: _this.storeCurrentConversation.conversationID,
clientMsgID: element.clientMsgID
}).then(res => {
}).catch(res => {
console.log('catch',res);
}).finally(() => {
console.log('finally',arguments);
})
});
}
this.selectItems = [];
this.$refs.chatingListRef.loadMessageList();
return;
@@ -316,7 +322,7 @@
})
return;
}
if(e.type == 'audio_msg_click'){
if (e.type == 'audio_msg_click'){
if(_this.storeCurrentMsgID){
_this.updateCurrentMsg({clientMsgID:""});
}else{
@@ -338,6 +344,9 @@
if (_this.storeCurrentUserID == data.sendID && diff < 120000) {
menu.push('撤回')
}
if(_this.isAdmin | _this.isOwner){
menu.push('删除(管理员功能)')
}
uni.showActionSheet({
itemList: menu,
success({tapIndex}) {
@@ -377,6 +386,9 @@
case "删除":
_this.onUserMessageEvent({type: 'deleteMsg'}, data);
break;
case "删除(管理员功能)":
_this.onUserMessageEvent({type: 'deleteServerMsg'}, data);
break;
default:
break;
}