修正了检测页面错误

This commit is contained in:
root 2025-09-10 18:38:22 +08:00
parent 439b248c27
commit 0a417ce4f5
2 changed files with 18 additions and 22 deletions

View File

@ -985,7 +985,7 @@ class AppServer:
# 调用create_detection_session方法settings传空字典
session_id = self.db_manager.create_detection_session(patient_id, settings={}, creator_id=creator_id)
return jsonify({'success': True, 'session_id': session_id, 'detectionStartTime': start_time})
return jsonify({'success': True, 'session_id': session_id})
except Exception as e:
self.logger.error(f'开始检测失败: {e}')
return jsonify({'success': False, 'error': str(e)}), 500

View File

@ -26,15 +26,15 @@
class="start-title-btn" style="background-image: linear-gradient(to right, rgb(236, 50, 166), rgb(160, 5, 216));
--el-button-border-color: #409EFF;
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
{{ isConnected ? '开始' : '连接中...' }}
{{ isConnected ? '开始录像' : '录像中...' }}
</el-button>
<!-- handleStartStop -->
<el-button v-if="isRecording" @click="handleStartStop" type="primary" class="start-title-btn" style="background-image: linear-gradient(to right, rgb(236, 50, 166), rgb(160, 5, 216));
--el-button-border-color: #409EFF;
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
结束
结束录像
</el-button>
<el-button v-if="isStart && isConnected" @click="saveDetectionData" type="primary" class="start-title-btn" style="background-image: linear-gradient(to right, #FBB106, #A817C6);
<el-button @click="saveDetectionData" type="primary" class="start-title-btn" style="background-image: linear-gradient(to right, #FBB106, #A817C6);
--el-button-border-color: #409EFF;
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
保存数据
@ -1513,7 +1513,7 @@ async function handleDiagnosticInfo(status) {
message: status + '诊断信息成功',
duration: 5000
})
patientInfo.value.sessionId = null
} else {
throw new Error(result.message || '诊断信息失败')
}
@ -1522,9 +1522,9 @@ async function handleDiagnosticInfo(status) {
message: errorMessage,
duration: 5000
})
patientInfo.value.sessionId = null
} finally {
patientInfo.value.sessionId = null
}
}
@ -1673,7 +1673,6 @@ async function handleStartStop() {
//
await stopRecord()
} else {
patientInfo.value.sessionId = null
//
await startRecord()
}
@ -1682,7 +1681,7 @@ async function handleStartStop() {
async function startDetection() {
try {
console.log('🚀 正在开始检测...')
startTimer()
//
if (!patientInfo.value || !patientInfo.value.id) {
throw new Error('缺少患者信息,无法开始检测')
@ -1704,7 +1703,7 @@ async function startDetection() {
}
const result = await response.json()
debugger
if (result.success) {
console.log('✅ 检测开始成功')
// ID
@ -1767,6 +1766,7 @@ const loadPatientInfo = async () => {
const result = await response.json()
if (result.success) {
patientInfo.value = { ...result.data, sessionId: null }
startDetection()
console.log('患者信息加载成功:', patientInfo.value)
} else {
throw new Error(result.message)
@ -1784,16 +1784,13 @@ const loadPatientInfo = async () => {
const handleBeforeUnload = (event) => {
console.log('页面即将关闭,正在清理资源...')
//
if (isStart.value) {
stopDetection()
}
//
if (isRecording.value) {
stopRecording()
}
//
stopDetection()
// WebSocket
disconnectWebSocket()
@ -1947,7 +1944,7 @@ onMounted(() => {
loadPatientInfo()
// WebSocket
connectWebSocket()
startDetection()
//
window.addEventListener('beforeunload', handleBeforeUnload)
if (authStore.currentUser) {
@ -1966,7 +1963,6 @@ onUnmounted(() => {
stopRecording()
}
if(isStart.value == true){
stopRecord()
}
@ -2007,7 +2003,7 @@ onUnmounted(() => {
const startRecord = async () => { //
try {
console.log('🚀 正在开始录屏...')
debugger
//
if (!patientInfo.value || !patientInfo.value.sessionId) {
throw new Error('缺少患者信息,无法开始录屏')