diff --git a/frontend/src/pages/cloud-law/video-call.vue b/frontend/src/pages/cloud-law/video-call.vue index 9127037..35117bf 100644 --- a/frontend/src/pages/cloud-law/video-call.vue +++ b/frontend/src/pages/cloud-law/video-call.vue @@ -505,6 +505,10 @@ const buildMiniProgramReturnUrl = () => { if (!consultId.value) { // #ifdef H5 try { + const cachedConsultId = window.sessionStorage.getItem('echo_cloud_law_consult_id') || '' + if (cachedConsultId) { + return `/pages_work/ai_consult/ai_consult?id=${encodeURIComponent(cachedConsultId)}&mode=detail&from=videoCall` + } const cached = window.sessionStorage.getItem('echo_cloud_law_return_url') || '' if (cached) return decodeRepeated(cached) } catch (e) {} @@ -1046,7 +1050,15 @@ const hangup = async () => { } finally { ended.value = true leaving.value = false + // 用户端:优先尝试跳转小程序咨询详情;失败则依赖小程序页轮询 /end 状态兜底 notifyMiniProgramCallEndedOnce() + if (!isLawRole.value) { + setTimeout(() => { + if (ended.value && !miniProgramRedirected) { + goToConsultDetail() + } + }, 600) + } } } @@ -1125,13 +1137,14 @@ onMounted(() => { watch(ended, (value) => { if (!value || isLawRole.value) return - const returnUrl = buildMiniProgramReturnUrl() - if (!returnUrl) return setTimeout(() => { if (ended.value && !miniProgramRedirected) { notifyMiniProgramCallEndedOnce() + if (!miniProgramRedirected) { + goToConsultDetail() + } } - }, 1500) + }, 800) }) onBeforeUnmount(() => {