修正了检测页面错误
This commit is contained in:
parent
439b248c27
commit
0a417ce4f5
@ -985,7 +985,7 @@ class AppServer:
|
|||||||
|
|
||||||
# 调用create_detection_session方法,settings传空字典
|
# 调用create_detection_session方法,settings传空字典
|
||||||
session_id = self.db_manager.create_detection_session(patient_id, settings={}, creator_id=creator_id)
|
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:
|
except Exception as e:
|
||||||
self.logger.error(f'开始检测失败: {e}')
|
self.logger.error(f'开始检测失败: {e}')
|
||||||
return jsonify({'success': False, 'error': str(e)}), 500
|
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));
|
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: #409EFF;
|
||||||
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
|
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
|
||||||
{{ isConnected ? '开始' : '连接中...' }}
|
{{ isConnected ? '开始录像' : '录像中...' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- handleStartStop -->
|
<!-- 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 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: #409EFF;
|
||||||
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
|
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
|
||||||
结束
|
结束录像
|
||||||
</el-button>
|
</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: #409EFF;
|
||||||
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
|
--el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
|
||||||
保存数据
|
保存数据
|
||||||
@ -1513,7 +1513,7 @@ async function handleDiagnosticInfo(status) {
|
|||||||
message: status + '诊断信息成功',
|
message: status + '诊断信息成功',
|
||||||
duration: 5000
|
duration: 5000
|
||||||
})
|
})
|
||||||
patientInfo.value.sessionId = null
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.message || '诊断信息失败')
|
throw new Error(result.message || '诊断信息失败')
|
||||||
}
|
}
|
||||||
@ -1522,9 +1522,9 @@ async function handleDiagnosticInfo(status) {
|
|||||||
message: errorMessage,
|
message: errorMessage,
|
||||||
duration: 5000
|
duration: 5000
|
||||||
})
|
})
|
||||||
patientInfo.value.sessionId = null
|
|
||||||
} finally {
|
} finally {
|
||||||
patientInfo.value.sessionId = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1672,8 +1672,7 @@ async function handleStartStop() {
|
|||||||
if (isStart.value) {
|
if (isStart.value) {
|
||||||
// 停止录制视频
|
// 停止录制视频
|
||||||
await stopRecord()
|
await stopRecord()
|
||||||
} else {
|
} else {
|
||||||
patientInfo.value.sessionId = null
|
|
||||||
// 开始录制视频
|
// 开始录制视频
|
||||||
await startRecord()
|
await startRecord()
|
||||||
}
|
}
|
||||||
@ -1681,8 +1680,8 @@ async function handleStartStop() {
|
|||||||
// 开始检测
|
// 开始检测
|
||||||
async function startDetection() {
|
async function startDetection() {
|
||||||
try {
|
try {
|
||||||
console.log('🚀 正在开始检测...')
|
console.log('🚀 正在开始检测...')
|
||||||
startTimer()
|
|
||||||
// 验证患者信息
|
// 验证患者信息
|
||||||
if (!patientInfo.value || !patientInfo.value.id) {
|
if (!patientInfo.value || !patientInfo.value.id) {
|
||||||
throw new Error('缺少患者信息,无法开始检测')
|
throw new Error('缺少患者信息,无法开始检测')
|
||||||
@ -1704,7 +1703,7 @@ async function startDetection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json()
|
const result = await response.json()
|
||||||
|
debugger
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
console.log('✅ 检测开始成功')
|
console.log('✅ 检测开始成功')
|
||||||
// 保存会话ID和检测开始时间
|
// 保存会话ID和检测开始时间
|
||||||
@ -1767,6 +1766,7 @@ const loadPatientInfo = async () => {
|
|||||||
const result = await response.json()
|
const result = await response.json()
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
patientInfo.value = { ...result.data, sessionId: null }
|
patientInfo.value = { ...result.data, sessionId: null }
|
||||||
|
startDetection()
|
||||||
console.log('患者信息加载成功:', patientInfo.value)
|
console.log('患者信息加载成功:', patientInfo.value)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.message)
|
throw new Error(result.message)
|
||||||
@ -1782,18 +1782,15 @@ const loadPatientInfo = async () => {
|
|||||||
|
|
||||||
// 处理页面关闭或刷新事件
|
// 处理页面关闭或刷新事件
|
||||||
const handleBeforeUnload = (event) => {
|
const handleBeforeUnload = (event) => {
|
||||||
console.log('页面即将关闭,正在清理资源...')
|
console.log('页面即将关闭,正在清理资源...')
|
||||||
|
|
||||||
// 停止检测(如果正在检测)
|
|
||||||
if (isStart.value) {
|
|
||||||
stopDetection()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 停止录像(如果正在录像)
|
// 停止录像(如果正在录像)
|
||||||
if (isRecording.value) {
|
if (isRecording.value) {
|
||||||
stopRecording()
|
stopRecording()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 停止检测
|
||||||
|
stopDetection()
|
||||||
// 断开WebSocket连接
|
// 断开WebSocket连接
|
||||||
disconnectWebSocket()
|
disconnectWebSocket()
|
||||||
|
|
||||||
@ -1947,7 +1944,7 @@ onMounted(() => {
|
|||||||
loadPatientInfo()
|
loadPatientInfo()
|
||||||
// 页面加载时自动连接WebSocket
|
// 页面加载时自动连接WebSocket
|
||||||
connectWebSocket()
|
connectWebSocket()
|
||||||
startDetection()
|
|
||||||
// 监听页面关闭或刷新事件
|
// 监听页面关闭或刷新事件
|
||||||
window.addEventListener('beforeunload', handleBeforeUnload)
|
window.addEventListener('beforeunload', handleBeforeUnload)
|
||||||
if (authStore.currentUser) {
|
if (authStore.currentUser) {
|
||||||
@ -1966,7 +1963,6 @@ onUnmounted(() => {
|
|||||||
stopRecording()
|
stopRecording()
|
||||||
}
|
}
|
||||||
if(isStart.value == true){
|
if(isStart.value == true){
|
||||||
|
|
||||||
stopRecord()
|
stopRecord()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2007,7 +2003,7 @@ onUnmounted(() => {
|
|||||||
const startRecord = async () => { // 开始录屏
|
const startRecord = async () => { // 开始录屏
|
||||||
try {
|
try {
|
||||||
console.log('🚀 正在开始录屏...')
|
console.log('🚀 正在开始录屏...')
|
||||||
|
debugger
|
||||||
// 验证患者信息
|
// 验证患者信息
|
||||||
if (!patientInfo.value || !patientInfo.value.sessionId) {
|
if (!patientInfo.value || !patientInfo.value.sessionId) {
|
||||||
throw new Error('缺少患者信息,无法开始录屏')
|
throw new Error('缺少患者信息,无法开始录屏')
|
||||||
|
Loading…
Reference in New Issue
Block a user