@@ -111,7 +112,7 @@ main { padding: 12px; }
}
.item:hover { background: #f5f5f5; }
-.avatar { width: 32px; height: 32px; border-radius: 4px; margin-right: 10px; }
+:deep(.avatar) { width: 32px; height: 32px; border-radius: 4px; margin-right: 10px; }
.name { flex: 1; font-size: 14px; }
footer { padding: 12px; }
diff --git a/frontend/pc/IM/src/renderer/src/components/messages/InfoSidebar.vue b/frontend/pc/IM/src/renderer/src/components/messages/InfoSidebar.vue
index 82b7dc6..1e8bb47 100644
--- a/frontend/pc/IM/src/renderer/src/components/messages/InfoSidebar.vue
+++ b/frontend/pc/IM/src/renderer/src/components/messages/InfoSidebar.vue
@@ -43,7 +43,7 @@
class="member-item"
>
-
![]()
+
{{ member.nickname }}
@@ -85,6 +85,7 @@ import { SYSTEM_BASE_STATUS } from '../../constants/systemBaseStatus';
import { useMessage } from './useAlert';
import { getFileHash } from '../../utils/uploadTools';
import CreateGroup from '../groups/CreateGroup.vue';
+import AsyncImage from '../AsyncImage.vue';
const props = defineProps({
chatType: {
@@ -339,7 +340,7 @@ onMounted(async () => {
height: 48px;
}
-.member-img {
+:deep(.member-img) {
width: 100%;
height: 100%;
border-radius: 12px;
diff --git a/frontend/pc/IM/src/renderer/src/constants/GroupDefine.js b/frontend/pc/IM/src/renderer/src/constants/GroupDefine.js
index 3e91b0d..1db830d 100644
--- a/frontend/pc/IM/src/renderer/src/constants/GroupDefine.js
+++ b/frontend/pc/IM/src/renderer/src/constants/GroupDefine.js
@@ -18,7 +18,12 @@ export const GROUP_REQUEST_STATUS = Object.freeze({
TARGET_PENDING: 'TargetPending',
/** 对方拒绝 */
TARGET_DECLINED: 'TargetDeclined'
-});
+})
+
+export const GROUP_REQUEST_ACTION = Object.freeze({
+ ACCEPT: 'Accept',
+ REJECT: 'Reject'
+})
export const getGroupRequestStatusTxt = (status) => {
@@ -36,4 +41,5 @@ export const getGroupRequestStatusTxt = (status) => {
default:
return '未知状态';
}
-};
+}
+
diff --git a/frontend/pc/IM/src/renderer/src/handler/messageHandler.js b/frontend/pc/IM/src/renderer/src/handler/messageHandler.js
index f7422db..3798772 100644
--- a/frontend/pc/IM/src/renderer/src/handler/messageHandler.js
+++ b/frontend/pc/IM/src/renderer/src/handler/messageHandler.js
@@ -3,10 +3,23 @@ import { MESSAGE_TYPE } from "../constants/MessageType";
export const messageHandler = (msg) => {
const conversationStore = useConversationStore();
- const conversation = conversationStore.conversations.find(x =>
- ((x.targetId == msg.senderId || x.targetId == msg.receiverId) && msg.chatType == MESSAGE_TYPE.PRIVATE) ||
- (x.targetId == msg.receiverId && msg.chatType == MESSAGE_TYPE.GROUP)
- );
+ const conversation = conversationStore.conversations.find(x => {
+ // 1. 如果是私聊:目标 ID 必须是对方(可能是发送者,也可能是接收者)
+ if (msg.chatType === MESSAGE_TYPE.PRIVATE) {
+ return x.chatType === MESSAGE_TYPE.PRIVATE &&
+ (x.targetId === msg.senderId || x.targetId === msg.receiverId);
+ }
+
+ // 2. 如果是群聊:目标 ID 必须是群 ID(即消息的 receiverId)
+ if (msg.chatType === MESSAGE_TYPE.GROUP) {
+ return x.chatType === MESSAGE_TYPE.GROUP &&
+ x.targetId === msg.receiverId;
+ }
+
+ return false;
+ });
+
+ if (!conversation) return; // 容错处理:如果没找到会话,不执行后续逻辑
conversation.lastMessage = msg.content;
if (conversation.targetId == msg.receiverId) {
conversation.unreadCount = 0;
diff --git a/frontend/pc/IM/src/renderer/src/services/group.js b/frontend/pc/IM/src/renderer/src/services/group.js
index 471d884..f407716 100644
--- a/frontend/pc/IM/src/renderer/src/services/group.js
+++ b/frontend/pc/IM/src/renderer/src/services/group.js
@@ -42,5 +42,21 @@ export const groupService = {
* 获取群聊通知
* @returns
*/
- getGroupNotification: () => request.get('/Group/GetGroupNotification')
+ getGroupNotification: () => request.get('/Group/GetGroupNotification'),
+ /**
+ * 处理入群邀请
+ * @param {*} inviteId
+ * @param {*} action
+ * @returns
+ */
+ handleGroupInvite: (inviteId, action) =>
+ request.post('/Group/HandleGroupInvite', { inviteId: inviteId, action: action }),
+ /**
+ * 处理入群请求
+ * @param {*} requestId
+ * @param {*} action
+ * @returns
+ */
+ handleGroupRequest: (requestId, action) =>
+ request.post('/Group/HandleGroupRequest', { requestId: requestId, action: action })
}
diff --git a/frontend/pc/IM/src/renderer/src/stores/chat.js b/frontend/pc/IM/src/renderer/src/stores/chat.js
index 67a53ec..30e015a 100644
--- a/frontend/pc/IM/src/renderer/src/stores/chat.js
+++ b/frontend/pc/IM/src/renderer/src/stores/chat.js
@@ -50,7 +50,6 @@ export const useChatStore = defineStore('chat', {
this.isEnded = false;
//先从浏览器缓存加载一部分消息列表
const localHistory = await messagesDb.getLatestMessages(sessionId, this.pageSize);
- console.log(localHistory)
if (localHistory.length > 0) {
this.messages = localHistory;
this.maxSequenceId = this.messages.reduce((max, m) =>
diff --git a/frontend/pc/IM/src/renderer/src/utils/sessionIdTools.js b/frontend/pc/IM/src/renderer/src/utils/sessionIdTools.js
index 57b9fde..48e5fc1 100644
--- a/frontend/pc/IM/src/renderer/src/utils/sessionIdTools.js
+++ b/frontend/pc/IM/src/renderer/src/utils/sessionIdTools.js
@@ -10,5 +10,5 @@ export const generateSessionId = (id1, id2, isGroup = false) => {
if (isGroup) {
return `g:${id2}`;
}
- return [String(id1), String(id2)].sort().join('_');
+ return 'p:' + [String(id1), String(id2)].sort().join('_');
};
\ No newline at end of file
diff --git a/frontend/pc/IM/src/renderer/src/views/Test.vue b/frontend/pc/IM/src/renderer/src/views/Test.vue
index be34c8a..d0b6581 100644
--- a/frontend/pc/IM/src/renderer/src/views/Test.vue
+++ b/frontend/pc/IM/src/renderer/src/views/Test.vue
@@ -1,6 +1,7 @@
-
+
+
@@ -9,6 +10,7 @@ import { ref } from 'vue';
import { useCacheStore } from '../stores/cache';
import { FILE_TYPE } from '../constants/fileTypeDefine';
import AsyncImage from '../components/AsyncImage.vue';
+import Dropdown from '../components/Dropdown.vue';
const url = ref('')
diff --git a/frontend/pc/IM/src/renderer/src/views/contact/GroupRequest.vue b/frontend/pc/IM/src/renderer/src/views/contact/GroupRequest.vue
index 436906c..67fed8b 100644
--- a/frontend/pc/IM/src/renderer/src/views/contact/GroupRequest.vue
+++ b/frontend/pc/IM/src/renderer/src/views/contact/GroupRequest.vue
@@ -9,30 +9,25 @@
-
![]()
+ ? 'is-group'
+ : 'is-user'
+ ]" />
{{ item.name }}
-
+ ? 'tag-orange'
+ : 'tag-green'
+ ]">
{{ getTypeText(item.type) }}
14:20
@@ -42,25 +37,23 @@
目标群聊:
{{ item.groupName }}
-
+
目标用户:
{{
myInfo.id === item.userId ? item.inviteUserNickname : item.nickName
- }}
+ }}
入群描述:{{ item.description }}
-
+
-
+
@@ -78,18 +71,26 @@