From ae7f3a8bc5df93963831e2e449d8789ce43a086c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 18 May 2026 00:12:28 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(im):=20=E7=BE=A4=E9=80=9A?= =?UTF-8?q?=E8=AF=9D=E6=9C=AC=E7=AB=AF=E6=8B=92=E7=BB=9D=20/=20=E6=8C=82?= =?UTF-8?q?=E6=96=AD=E5=90=8E=E7=AB=8B=E5=8D=B3=E4=BB=8E=E8=83=B6=E5=9B=8A?= =?UTF-8?q?=E6=9D=A1=E7=A7=BB=E9=99=A4=E8=87=AA=E5=B7=B1=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E9=9C=80=E7=AD=89=E5=90=8E=E7=AB=AF=E6=8E=A8=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/components/rtc/RtcCallContainer.vue | 31 +++++++++---------- src/views/im/home/store/rtcStore.ts | 4 ++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/views/im/home/components/rtc/RtcCallContainer.vue b/src/views/im/home/components/rtc/RtcCallContainer.vue index c28f7d52e..90d636216 100644 --- a/src/views/im/home/components/rtc/RtcCallContainer.vue +++ b/src/views/im/home/components/rtc/RtcCallContainer.vue @@ -309,17 +309,19 @@ async function handleCancel() { /** 被叫拒绝来电 */ async function handleReject() { const payload = rtcStore.incomingPayload - const room = payload?.room - if (room) { + if (payload?.room) { try { - await rejectCall(room) + await rejectCall(payload.room) } catch (e) { - console.warn('[Call] reject 失败', { room }, e) + console.warn('[Call] reject 失败', { room: payload.room }, e) } - } - // 本端先行把自己从胶囊条移除,避免等后端 RTC_CALL(REJECTED) 推回的延迟 - if (payload?.conversationType === ImConversationType.GROUP && payload.groupId) { - rtcStore.applyParticipantRejected({ ...payload, operatorUserId: getCurrentUserId() }) + // 本端先行从胶囊条移除自己,免等后端 RTC_CALL(REJECTED) 推回;私聊场景 store 内部 no-op + rtcStore.applyParticipantRejected({ + room: payload.room, + conversationType: payload.conversationType, + groupId: payload.groupId, + operatorUserId: getCurrentUserId() + }) } rtcStore.reset() } @@ -341,18 +343,15 @@ async function handleAccept() { /** 通话中挂断 */ async function handleHangup() { const call = rtcStore.call - const room = call?.room - if (room) { + if (call?.room) { try { - await leaveCall(room) + await leaveCall(call.room) } catch (e) { - console.warn('[Call] leave 失败', { room }, e) + console.warn('[Call] leave 失败', { room: call.room }, e) } - } - // 群聊:本端先行把自己从胶囊条移除,避免等后端 1603 推回的延迟(私聊场景整通话结束走 END 移除整条) - if (call?.conversationType === ImConversationType.GROUP && call.groupId && room) { + // 本端先行从胶囊条移除自己,免等后端 RTC_PARTICIPANT_DISCONNECTED 推回;私聊场景 store 内部 no-op,整通话由 END 关掉 rtcStore.applyParticipantDisconnected({ - room, + room: call.room, userId: getCurrentUserId(), conversationType: call.conversationType, groupId: call.groupId diff --git a/src/views/im/home/store/rtcStore.ts b/src/views/im/home/store/rtcStore.ts index 64586760f..66247df34 100644 --- a/src/views/im/home/store/rtcStore.ts +++ b/src/views/im/home/store/rtcStore.ts @@ -325,7 +325,9 @@ export const useRtcStore = defineStore('imRtc', () => { } /** 群通话单人拒绝邀请:标记 leftUserIds + 从胶囊条 inviteeIds 移除(私聊拒绝走 RTC_CALL_END,不入本通道) */ - function applyParticipantRejected(payload: ImRtcCallNotification) { + function applyParticipantRejected( + payload: Pick + ) { if (!payload.operatorUserId) { return }