Browse Source

feat(camera): 添加相机未连接时的错误处理

- 在 camera.js 中增加相机未连接时的返回信息
- 在 check.ts 中添加相机未连接时的状态更新
- 优化了相机连接检查的逻辑,提高了系统稳定性
panqiuyao 4 tháng trước cách đây
mục cha
commit
7b7f3be06b
2 tập tin đã thay đổi với 11 bổ sung0 xóa
  1. 6 0
      electron/controller/camera.js
  2. 5 0
      frontend/src/stores/modules/check.ts

+ 6 - 0
electron/controller/camera.js

@@ -65,6 +65,12 @@ class CameraController extends Controller {
         }
 
 
+        return {
+          status:-1,
+          msg:"相机未连接,请链接相机。",
+        }
+
+
       }
 
 

+ 5 - 0
frontend/src/stores/modules/check.ts

@@ -122,6 +122,11 @@ export const checkInfo = defineStore('checkInfo', () => {
                           devices.cam_control.msg = result.msg;
                       }
                   }
+
+                  if(!result  && checkTime.value > 0){
+                      devices.cam_control.status = -1;
+                      devices.cam_control.msg = '相机未连接,请链接相机。';
+                  }
               });
 
     }