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
+21 -5
View File
@@ -1,5 +1,5 @@
import store from "@/store";
import {CustomType,GroupSystemMessageTypes,AddFriendQrCodePrefix,AddGroupQrCodePrefix} from "@/constant";
import {CustomType,GroupSystemMessageTypes,noticeMessageTypes} from "@/constant";
import IMSDK, {GroupAtType,MessageType,SessionType} from "openim-uniapp-polyfill";
import dayjs from "dayjs";
import {isThisYear} from "date-fns";
@@ -174,11 +174,17 @@ export const parseMessageByType = (pmsg) => {
kickStr = kickStr.slice(0, -1);
return `${getName(kickOpUser)}踢出了${kickStr}${kickdUserList.length > 3 ? "..." : ""}`;
case MessageType.GroupMemberMuted:
//群成员禁言通知
return `[GroupMemberMuted]`;
case MessageType.GroupMemberCancelMuted:
//取消群成员禁言通知
return `[GroupMemberCancelMuted]`;
case MessageType.GroupMuted:
//群禁言通知
return `[GroupMuted]`;
case MessageType.GroupCancelMuted:
//取消群禁言通知
return `[GroupCancelMuted]`;
case MessageType.MemberQuit:
const quitDetails = JSON.parse(pmsg.notificationElem.detail);
const quitUser = quitDetails.quitUser;
@@ -200,15 +206,19 @@ export const parseMessageByType = (pmsg) => {
const groupNameUpdateDetail = JSON.parse(pmsg.notificationElem.detail);
const groupNameUpdateUser = groupNameUpdateDetail.opUser;
return `${getName(groupNameUpdateUser)}修改了群名称为${groupNameUpdateDetail.group.groupName}`;
case MessageType.GroupCancelMuted:
return `[GroupCancelMuted]`;
case MessageType.GroupAnnouncementUpdated:
//群公告更新
const groupAnnouncementUpdatedDetail = JSON.parse(pmsg.notificationElem.detail);
return `${getName(groupAnnouncementUpdatedDetail.opUser)}更新了群公告`;
return `[GroupAnnouncementUpdated]`;
case MessageType.BurnMessageChange:
//阅后即焚开启或关闭通知
return `[BurnMessageChange]`;
case MessageType.RevokeMessage:
return `[RevokeMessage]`;
let notificationElem = JSON.parse(pmsg.notificationElem.detail);
return `${notificationElem.revokerNickname}撤回了一条消息`;
case MessageType.MsgPinned:
//消息置顶
return `[MsgPinned]`;
case 2001:
const body = JSON.parse(pmsg.notificationElem.detail);
@@ -370,11 +380,17 @@ export const offlinePushInfo = {
};
export const getConversationContent = (message) => {
if(noticeMessageTypes.includes(message.contentType)){
return `${parseMessageByType(message)}`;
}
if (
!message.groupID ||
message.sendID === store.getters.storeCurrentUserID
) {
return parseMessageByType(message);
}
return `${message.senderNickname}${parseMessageByType(message)}`;
if(message.senderNickname){
return `${message.senderNickname}${parseMessageByType(message)}`;
}
return parseMessageByType(message);
};