From 771e6d0d8ead56b52808cf712b00461572dd70f1 Mon Sep 17 00:00:00 2001 From: duoaohui <928970622@qq.com> Date: Mon, 25 May 2026 21:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=BF=9E=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/cloud-law/video-call.vue | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/src/pages/cloud-law/video-call.vue b/frontend/src/pages/cloud-law/video-call.vue index 8123481..08757e1 100644 --- a/frontend/src/pages/cloud-law/video-call.vue +++ b/frontend/src/pages/cloud-law/video-call.vue @@ -154,6 +154,7 @@ const userStore = useUserStore() const rawCode = ref('') const callId = ref('') const cloudLawApiBase = ref('') +const cloudLawToken = ref('') const callMode = ref('video') const joining = ref(false) const joinError = ref('') @@ -382,6 +383,20 @@ const requestCloudLawCommands = (url) => { }) } +const notifyCloudLawEnd = () => { + if (!callId.value || !cloudLawApiBase.value) return Promise.resolve() + return new Promise(resolve => { + uni.request({ + url: resolveCloudLawApiUrl(`/api/applet/voiceConnection/${encodeURIComponent(callId.value)}/end`), + method: 'POST', + data: {}, + header: cloudLawToken.value ? { 'Content-Type': 'application/json', token: `Bearer ${cloudLawToken.value}` } : { 'Content-Type': 'application/json' }, + timeout: 5000, + complete: resolve + }) + }) +} + const pollCommandsOnce = async () => { if (!callId.value || !meetingStore.isInMeeting || leaving.value || ended.value || commandPolling) return commandPolling = true @@ -687,6 +702,7 @@ const hangup = async () => { leaving.value = true stopCommandPolling() try { + await notifyCloudLawEnd() // 云律视频咨询:发起人(小程序端用户)在 CreateRoomForInternal 时被加成 host, // 用户挂机 = 咨询结束,无条件 endMeeting 让律师 iframe 收到 room.ended 自动退出。 // 不依赖 meetingStore.isHost(host_id/userId 偶发类型不一致导致误判 false 只走 leave, @@ -712,6 +728,7 @@ onLoad(query => { rawCode.value = query?.code || query?.roomCode || '' callId.value = query?.callId || query?.call_id || '' cloudLawApiBase.value = query?.cloudLawApiBase || query?.cloud_law_api_base || '' + cloudLawToken.value = query?.cloudLawToken || query?.cloud_law_token || '' const mode = String(query?.mode || query?.callType || query?.type || '').toLowerCase() callMode.value = mode === 'voice' || mode === 'audio' ? 'voice' : 'video' joinMeeting() @@ -752,6 +769,9 @@ onBeforeUnmount(() => { onUnload(() => { stopCommandPolling() + if (!ended.value && callId.value) { + notifyCloudLawEnd().catch(() => {}) + } if (meetingStore.isInMeeting && meetingStore.localState !== MEETING_LOCAL_STATE_LEAVING) { meetingStore.leave().catch(() => {}) }