开始录屏方法修改

This commit is contained in:
limengnan 2025-08-28 09:24:42 +08:00
parent a5e9ee749c
commit 13be9337b9
2 changed files with 58 additions and 9 deletions

View File

@ -51,7 +51,7 @@
</header> </header>
<!-- 核心内容区网格布局 --> <!-- 核心内容区网格布局 -->
<div id="detectare" class="content-grid"> <div id="detectare" ref="contenGridRef" class="content-grid">
<!-- 身体姿态模块 --> <!-- 身体姿态模块 -->
<div class="module-card body-posture" style="width: 25%;margin-right: 1px; "> <div class="module-card body-posture" style="width: 25%;margin-right: 1px; ">
<div class="module-header"> <div class="module-header">
@ -572,6 +572,9 @@ const dataCollectionLoading = ref(false)
const isRecording = ref(false) const isRecording = ref(false)
const cameraDialogVisible =ref(false) // const cameraDialogVisible =ref(false) //
const contenGridRef =ref(null) // box
const wholeBodyRef = ref(null) // 姿ref const wholeBodyRef = ref(null) // 姿ref
const videoImgRef =ref(null) // ref const videoImgRef =ref(null) // ref
@ -1628,6 +1631,8 @@ async function handleDataCollection() {
// //
async function saveDetectionData() { async function saveDetectionData() {
console.log(tempInfo.value)
return
if (screenshotLoading.value) return if (screenshotLoading.value) return
try { try {
@ -1639,18 +1644,37 @@ async function saveDetectionData() {
if (!patientInfo.value.sessionId) { if (!patientInfo.value.sessionId) {
throw new Error('请先开始检测再进行截图') throw new Error('请先开始检测再进行截图')
} }
const base64 = 'data:image/jpeg;base64,'
let pressure_image = ""
if(tempInfo.value.pressure_data != null
&& tempInfo.value.pressure_data.foot_pressure != null
&& tempInfo.value.pressure_data.foot_pressure.pressure_image != null){
pressure_image = base64 + tempInfo.value.pressure_data.foot_pressure.pressure_image
}
// API // API
const result = await sendDetectionData({ const result = await sendDetectionData({
patientId: patientInfo.value.id, // patientId: patientInfo.value.id,
patientName: patientInfo.value.name, // patientName: patientInfo.value.name,
// sessionId: patientInfo.value.sessionId,
// head_pose: tempInfo.value.imu_data,
// body_data: femtobolt_frame,
// foot_image: pressure_data,
sessionId: patientInfo.value.sessionId, sessionId: patientInfo.value.sessionId,
head_data: imu_data, patientId: patientInfo.value.id,
body_data: femtobolt_frame,
foot_data: pressure_data, body_pose:tempInfo.value.femtobolt_frame,
camera_data: camera_frame, body_image:base64 + tempInfo.value.femtobolt_frame,
foot_data:tempInfo.value.femtobolt_frame,
foot_data_image:base64+tempInfo.value.femtobolt_frame.image,
screen_image:null,
camera_data: base64+ tempInfo.value.camera_frame.image,
}) })
tempInfo.value
// //
ElMessage.success({ ElMessage.success({
message: `截图保存成功!`, message: `截图保存成功!`,
@ -2024,6 +2048,9 @@ async function startDetection() {
if (!patientInfo.value || !patientInfo.value.id) { if (!patientInfo.value || !patientInfo.value.id) {
throw new Error('缺少患者信息,无法开始检测') throw new Error('缺少患者信息,无法开始检测')
} }
let screen_location = contenGridRef.value.getBoundingClientRect()
let femtobolt_location = wholeBodyRef.value.getBoundingClientRect()
let camera_location = videoImgRef.value.getBoundingClientRect()
// API // API
const response = await fetch(`${BACKEND_URL}/api/detection/start`, { const response = await fetch(`${BACKEND_URL}/api/detection/start`, {
method: 'POST', method: 'POST',
@ -2034,6 +2061,25 @@ async function startDetection() {
patient_id: patientInfo.value.id, patient_id: patientInfo.value.id,
// //
creator_id: creatorId.value, creator_id: creatorId.value,
screen_location:{
x:screen_location.x,
y:screen_location.y,
w:screen_location.width,
h:screen_location.height
},
femtobolt_location :{
x:femtobolt_location.x,
y:femtobolt_location.y,
w:femtobolt_location.width,
h:femtobolt_location.height
},
camera_location :{
x:camera_location.x,
y:camera_location.y,
w:camera_location.width,
h:camera_location.height
}
// settings: JSON.stringify({ // settings: JSON.stringify({
// frequency: 30, // // frequency: 30, //
// // // //
@ -3020,6 +3066,7 @@ onUnmounted(() => {
:deep(.tsDialog.el-dialog .el-input__wrapper) { :deep(.tsDialog.el-dialog .el-input__wrapper) {
background-color: #242424; background-color: #242424;
font-size: 16px;
border: none; border: none;
box-shadow: none; box-shadow: none;
} }
@ -3032,6 +3079,7 @@ onUnmounted(() => {
} }
:deep(.tsDialog.el-dialog .el-input__inner) { :deep(.tsDialog.el-dialog .el-input__inner) {
font-size: 16px;
color: #ffffff; color: #ffffff;
} }

View File

@ -617,6 +617,7 @@ const loadPatientInfo = async () => {
const response = await patientAPI.getById(patientId) const response = await patientAPI.getById(patientId)
if (response.success) { if (response.success) {
patient.value = response.data patient.value = response.data
selectedPatient.value = response.data
console.log('加载患者信息成功:', response.data) console.log('加载患者信息成功:', response.data)
} else { } else {
throw new Error(response.message) throw new Error(response.message)