deletemsg

This commit is contained in:
cansnow
2026-01-09 20:22:25 +08:00
parent 7913a63a39
commit 825ac3457d
13 changed files with 214 additions and 133 deletions
+26 -18
View File
@@ -50,6 +50,8 @@
},
computed: {
...mapGetters([
"storeHistoryMessageList",
"storeCurrentUserID",
"storeCurrentConversation","storeCurrentMsg",'storeCurrentMsgID'
]),
},
@@ -91,8 +93,17 @@
if (options?.back2Tab) {
this.back2Tab = JSON.parse(options.back2Tab);
}
IMSDK.subscribe(IMSDK.IMEvents.OnMsgDeleted,({data})=>{
let list = this.storeHistoryMessageList;
//console.log(data);
list = list.filter((item)=>{
return item.serverMsgID != data.serverMsgID;
})
this.$store.commit('message/SET_HISTORY_MESSAGE_LIST',list);
})
},
onUnload() {
IMSDK.unsubscribe(IMSDK.IMEvents.OnMsgDeleted);
//console.log("unload");
this.disposePageListener();
markConversationAsRead({...this.$store.getters.storeCurrentConversation,},true);
@@ -215,18 +226,9 @@
if(noticeMessageTypes.includes(data.contentType)){
return ;
}
let founded = false;
let arr = [];
for (var index = 0; index < this.selectItems.length; index++) {
var v = this.selectItems[index];
if (v.clientMsgID == data.clientMsgID) {
founded = true;
} else {
arr.push(v);
}
}
if (!founded) {
arr.push(data);
let arr = this.selectItems.filter((item)=>item.clientMsgID != data.clientMsgID);
if(arr.length === this.selectItems.length){
arr.push(data)
}
this.selectItems = [...arr];
}
@@ -241,17 +243,19 @@
}
for (let i = 0; i < deleteMsgs.length; i++) {
let element = deleteMsgs[i];
IMSDK.asyncApi('deleteMessageFromLocalStorage', IMSDK.uuid(), {
IMSDK.asyncApi(IMSDK.IMMethods.DeleteMessageFromLocalStorage, IMSDK.uuid(), {
//IMSDK.asyncApi(IMSDK.IMMethods.DeleteMessage, IMSDK.uuid(), {
conversationID: _this.storeCurrentConversation.conversationID,
clientMsgID: element.clientMsgID
}).then(res => {
//console.log(res);
}).catch(res => {
//console.log(res);
console.log('catch',res);
}).finally(() => {
//console.log(arguments);
console.log('finally',arguments);
})
}
this.selectItems = [];
this.$refs.chatingListRef.loadMessageList();
return;
@@ -300,7 +304,11 @@
conversationID: _this.storeCurrentConversation.conversationID,
clientMsgID: data.clientMsgID
}).then(res => {
console.log(res);
let list = _this.storeHistoryMessageList;
list = list.filter((item)=>{
return item.clientMsgID != data.clientMsgID;
});
_this.$store.commit('message/SET_HISTORY_MESSAGE_LIST',list);
}).catch(res => {
console.log(res);
}).finally(() => {
@@ -327,7 +335,7 @@
let nowTime = new Date().getTime();
let msgTime = data.createTime;
let diff = nowTime - msgTime;
if (this.isSender && diff < 120000) {
if (_this.storeCurrentUserID == data.sendID && diff < 120000) {
menu.push('撤回')
}
uni.showActionSheet({