修正了检测页面错误
This commit is contained in:
parent
439b248c27
commit
0a417ce4f5
@ -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
|
||||
|
@ -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('缺少患者信息,无法开始录屏')
|
||||
|
Loading…
Reference in New Issue
Block a user