This commit is contained in:
Your Name
2026-03-27 18:06:12 +08:00
parent 9160c36735
commit 099bc1dd22
645 changed files with 276473 additions and 957 deletions
+19 -8
View File
@@ -26,7 +26,7 @@
<div v-else class="chat-content">
<UIKitProvider language="zh-CN" theme="light">
<div class="chat-layout">
<ConversationList class="conversation-list" />
<!-- 嵌入式问诊窗口仅与当前患者会话不展示全局会话列表 -->
<Chat class="chat-area">
<MessageList :conversationID="conversationId" />
<MessageInput>
@@ -129,7 +129,6 @@ import {
} from '@/utils/tuicall-error'
import useUserStore from '@/stores/modules/user'
import {
ConversationList,
Chat,
MessageList,
MessageInput,
@@ -183,6 +182,8 @@ const BIND_ROOM_MAX_ATTEMPTS = 40
const BIND_ROOM_RETRY_MS = 100
const localCallRecorder = new CallLocalRecorder()
/** 与 server .env [trtc] ISLOCHOSTVOD 一致:由 getCallSignature 下发,false 时不做浏览器本地录制 */
const isLochostVodEnabled = ref(false)
const localRecordingBadge = ref(false)
let localRecordingRound = 0
let startLocalRecTimer: ReturnType<typeof setTimeout> | null = null
@@ -199,6 +200,10 @@ function clearLocalRecordingStartTimer() {
}
}
function syncLochostVodFromSignature(res: { isLochostVod?: boolean }) {
isLochostVodEnabled.value = Boolean(res?.isLochostVod)
}
function finalizeLocalRecordingAndAttach(): Promise<void> {
if (finalizeLocalRecordingPromise) {
return finalizeLocalRecordingPromise
@@ -206,6 +211,9 @@ function finalizeLocalRecordingAndAttach(): Promise<void> {
finalizeLocalRecordingPromise = (async () => {
clearLocalRecordingStartTimer()
localRecordingBadge.value = false
if (!isLochostVodEnabled.value) {
return
}
localCallRecorder.beginStopNow()
const id = recordingDiagnosisIdSnapshot ?? diagnosisId.value
try {
@@ -621,8 +629,12 @@ function setupCallRoomBinding() {
if (next === CALL_STATUS_CONNECTED) {
void tryBindRoomIfReady()
clearLocalRecordingStartTimer()
if (!isLochostVodEnabled.value) {
previousCallStatus = next
return
}
const roundAtSchedule = localRecordingRound
// 立即尝试启动录制,不要等待 1200ms
const attemptStartRecording = (retryCount = 0) => {
if (roundAtSchedule !== localRecordingRound) {
@@ -889,6 +901,7 @@ watch(() => activeConversation.value, async (newConversation) => {
patient_id: newConversation.userProfile.userID.replace("patient_", ""),
diagnosis_id: diagnosisId.value
})
syncLochostVodFromSignature(res)
patientUserId.value = res.patientUserId
assistant_ids.value = res.assistant_id
console.log('会话切换后获取到 assistant_id:', assistant_ids.value, '完整响应:', res)
@@ -922,6 +935,7 @@ const open = async (data: { patientId: number; patientName: string; diagnosisId?
patient_id: data.patientId,
diagnosis_id: data.diagnosisId || 0
})
syncLochostVodFromSignature(res)
assistant_ids.value = res.assistant_id
console.log('后端返回的签名数据:', res)
console.log('assistant_id:', assistant_ids.value)
@@ -1062,6 +1076,7 @@ const startGroupVideoCall = async () => {
patient_id: patientId.value!,
diagnosis_id: diagnosisId.value
})
syncLochostVodFromSignature(res)
assistant_ids.value = res.assistant_id
console.log('重新获取 assistant_id:', assistant_ids.value)
}
@@ -1344,13 +1359,9 @@ defineExpose({ open })
height: 100%;
width: 100%;
.conversation-list {
width: 285px;
flex-shrink: 0;
}
.chat-area {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
position: relative;