电话咨询

This commit is contained in:
duoaohui
2026-06-04 15:10:40 +08:00
parent 3ffdaa30d9
commit 3cffd160f5

View File

@@ -60,13 +60,14 @@
</view> </view>
<view v-if="!isVoiceMode" class="video-topbar"> <view v-if="!isVoiceMode" class="video-topbar">
<text v-if="isLawRole" class="video-back" @click="minimizeToMiniProgram"></text>
<view class="top-window-icon" @click="swapPrimaryTile"></view> <view class="top-window-icon" @click="swapPrimaryTile"></view>
<text class="top-duration">{{ durationText }}</text> <text class="top-duration">{{ durationText }}</text>
<text class="top-plus"></text> <text class="top-plus"></text>
</view> </view>
<view v-else class="voice-topbar"> <view v-else class="voice-topbar">
<text class="voice-back" @click="hangup"></text> <text class="voice-back" @click="onTopBack"></text>
</view> </view>
<view v-if="isVoiceMode" class="voice-duration">{{ durationText }}</view> <view v-if="isVoiceMode" class="voice-duration">{{ durationText }}</view>
@@ -206,6 +207,10 @@ const captureIconError = ref(false)
const flipCameraIconError = ref(false) const flipCameraIconError = ref(false)
const snapshotPreviewUrl = ref('') const snapshotPreviewUrl = ref('')
const snapshotBusy = ref(false) const snapshotBusy = ref(false)
/** 用户点击挂断(区别于返回上一页最小化会议) */
const userInitiatedHangup = ref(false)
/** 律师端从小程序 web-view 返回:仅本地离会,不结束云律通话、不通知小程序通话已结束 */
const minimizingToMiniProgram = ref(false)
const digitsOf = (value) => String(value || '').replace(/\D/g, '').slice(0, 9) const digitsOf = (value) => String(value || '').replace(/\D/g, '').slice(0, 9)
const sameUser = (a, b) => String(a || '') === String(b || '') const sameUser = (a, b) => String(a || '') === String(b || '')
@@ -926,8 +931,36 @@ const onCamToggle = async () => {
} }
} }
const onTopBack = () => {
if (isLawRole.value) {
minimizeToMiniProgram()
} else {
hangup()
}
}
/** 律师端返回小程序上一页:保留进行中通话,便于「返回会议」浮窗再次进入 */
const minimizeToMiniProgram = () => {
if (leaving.value || ended.value || minimizingToMiniProgram.value) return
minimizingToMiniProgram.value = true
stopCommandPolling()
meetingStore.leave().catch(() => {})
const mp = getMiniProgram()
try {
if (mp && typeof mp.navigateBack === 'function') {
mp.navigateBack({ delta: 1 })
return
}
} catch (e) {
console.warn('[CloudLawVideoCall] minimize navigateBack failed', e)
}
minimizingToMiniProgram.value = false
uni.showToast({ title: '请使用左上角返回', icon: 'none' })
}
const hangup = async () => { const hangup = async () => {
if (leaving.value) return if (leaving.value) return
userInitiatedHangup.value = true
leaving.value = true leaving.value = true
stopCommandPolling() stopCommandPolling()
try { try {
@@ -997,6 +1030,11 @@ onMounted(() => {
} }
if (s === MEETING_LOCAL_STATE_ENDED) { if (s === MEETING_LOCAL_STATE_ENDED) {
stopCommandPolling() stopCommandPolling()
// 律师端仅「返回上一页」最小化:不结束云律通话、不 postMessage 通知小程序通话结束
if (minimizingToMiniProgram.value) {
minimizingToMiniProgram.value = false
return
}
const reason = meetingStore.lastEndedReason const reason = meetingStore.lastEndedReason
const label = MEETING_ENDED_REASON_LABEL?.[reason] || '视频咨询已结束' const label = MEETING_ENDED_REASON_LABEL?.[reason] || '视频咨询已结束'
uni.showToast({ title: label, icon: 'none' }) uni.showToast({ title: label, icon: 'none' })
@@ -1032,6 +1070,13 @@ onBeforeUnmount(() => {
onUnload(() => { onUnload(() => {
stopCommandPolling() stopCommandPolling()
if (isLawRole.value && !ended.value && !userInitiatedHangup.value) {
minimizingToMiniProgram.value = true
if (meetingStore.isInMeeting && meetingStore.localState !== MEETING_LOCAL_STATE_LEAVING) {
meetingStore.leave().catch(() => {})
}
return
}
if (!ended.value && callId.value) { if (!ended.value && callId.value) {
notifyCloudLawEnd().catch(() => {}) notifyCloudLawEnd().catch(() => {})
} }
@@ -1186,6 +1231,13 @@ onUnload(() => {
height: 100%; height: 100%;
border-radius: 0; border-radius: 0;
} }
.video-back {
font-size: 56rpx;
line-height: 1;
color: #ffffff;
padding: 0 12rpx;
flex-shrink: 0;
}
.video-topbar { .video-topbar {
position: absolute; position: absolute;
left: 0; left: 0;
@@ -1196,6 +1248,7 @@ onUnload(() => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 16rpx;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%); background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
box-sizing: border-box; box-sizing: border-box;
z-index: 6; z-index: 6;