Browse Source

mod:调整

panqiuyao 8 months ago
parent
commit
352b73b728

+ 7 - 4
electron/controller/camera.js

@@ -129,7 +129,7 @@ function closeCameraControlTips() {
 
 
 }
-
+let  isOPen = false
 class CameraController extends Controller {
   constructor(ctx) {
     super(ctx);
@@ -137,9 +137,12 @@ class CameraController extends Controller {
 
   async connect() {
     try {
-      await checkCameraControlCmdExists()
-      await  CMD('All_Minimize')
-      closeCameraControlTips()
+      if(!isOPen){
+        await checkCameraControlCmdExists()
+        await  CMD('All_Minimize')
+        closeCameraControlTips()
+        isOPen = true
+      }
 
       const res = await getParams('iso')
       if(res  === '未将对象引用设置到对象的实例。'){

+ 6 - 5
frontend/src/components/check/index.vue

@@ -54,7 +54,7 @@
             <div class="check-btn cu-p" @click="reCheck">重新监测</div>
         </div>
         <div class="flex" v-else>
-            <div class="check-btn cu-p" style="width: 180px" @click="confirm()"> {{ checkInfoStore.isFirstCheck ? '正常,开始下一步' : '检测成功,继续操作'}}</div>
+            <div class="check-btn cu-p" style="width: 180px" @click="confirm()"> {{ checkInfoStore.isCheckStatus ? '正常,开始下一步' : '检测成功,继续操作'}}</div>
         </div>
     </template>
   </el-dialog>
@@ -115,7 +115,9 @@ const visible = ref(false);
  * 该函数会重置进度条并启动定时器,逐步增加进度值直到达到 80。
  */
 function startProgress() {
+  checkInfoStore.set_isCheckStatus(true);
   checkLoading.value = true;
+  checkSuccess.value = false;
   checkInfoStore.reCheckAction()
 }
 
@@ -136,7 +138,7 @@ function reCheck() {
  * 并尝试连接 WebSocket 和发送消息。
  */
 watchEffect(async ()=>{
-  if( useUserInfoStore.userInfo.id && checkCount.value === 0){
+  if( useUserInfoStore.userInfo.id && checkCount.value === 0 && checkInfoStore.isCheckStatus){
     if(clientStore.isClient){
       visible.value = true
       //python 启动有延时,延迟2秒执行
@@ -149,9 +151,8 @@ watchEffect(async ()=>{
 })
 
 
-
 watchEffect(async ()=>{
-  if( checkCount.value >= 1 && checkInfoStore.getProgress !== 100 && !checkInfoStore.isFirstCheck.value){
+  if( checkCount.value >= 1 && checkInfoStore.getProgress !== 100 && !checkInfoStore.isCheckStatus){
     visible.value = true
     checkLoading.value = false;
     checkSuccess.value = false;
@@ -187,7 +188,7 @@ watchEffect(async ()=>{
 
 function confirm(){
   visible.value = false;
-  checkInfoStore.set_isFirstCheck(false);
+  checkInfoStore.set_isCheckStatus(false);
   emit('confirm')
 }
 

+ 1 - 2
frontend/src/composables/userCheck.ts

@@ -1,13 +1,12 @@
 import { watchEffect } from 'vue';
 import { ElMessageBox  } from 'element-plus';
 import checkInfo from "../stores/modules/check";
-import {fa} from "element-plus/es/locale";
 
 const checkInfoStore = checkInfo()
 export function useCheckInfo() {
 
     watchEffect(async ()=>{
-        if( checkInfoStore.getProgress !== 100 && !checkInfoStore.isFirstCheck.value){
+        if( checkInfoStore.getProgress !== 100 && !checkInfoStore.isCheckStatus){
             ElMessageBox({
                 title:"链接出错!",
                 message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',

+ 1 - 1
frontend/src/router/index.ts

@@ -5,7 +5,7 @@ import { authGuard } from './plugins/authGuard'
 const routes: RouteRecordRaw[] = [
     {
         path: "/",
-        redirect: "/home"
+        redirect: "/photography/check"
     },
     {
         path: "/home",

+ 12 - 10
frontend/src/stores/modules/check.ts

@@ -11,11 +11,11 @@ export const checkInfo = defineStore('checkInfo', () => {
 
     // 定义设备列表
     const devices = reactive({
-        mcu: {
+/*        mcu: {
             status: 0,
             msg_type: "connect_mcu",
             msg: "未连接",
-        },
+        },*/
         blue_tooth: {
             status: 0,
             msg_type: "connect_bluetooth",
@@ -37,13 +37,15 @@ export const checkInfo = defineStore('checkInfo', () => {
     const checkTime = ref(0)
     let CKTimerInterval:any = null
     let CKCamControlInterval:any = null
-    const isFirstCheck = ref(true)
-    const set_isFirstCheck = ()=>{
-        isFirstCheck.value = false
+    const isCheckStatus = ref(true)
+    const set_isCheckStatus = (value)=>{
+        isCheckStatus.value = value
         //开始监听相机软件连接状态
-        CKCamControlInterval =   setInterval(()=>{
-            checkcamControl()
-        },3000)
+        if(!value){
+            CKCamControlInterval =   setInterval(()=>{
+                checkcamControl()
+            },3000)
+        }
     }
     //mcu 初始化
     const mcu = reactive({
@@ -225,8 +227,8 @@ export const checkInfo = defineStore('checkInfo', () => {
         blueTooth: devices.blueTooth,
         camControl: devices.camControl,
         camera: devices.camera,
-        isFirstCheck,
-        set_isFirstCheck,
+        isCheckStatus,
+        set_isCheckStatus,
         blue_tooth_scan_NO,
         set_blue_tooth_scan_NO,
         checkAction,

+ 1 - 1
frontend/src/views/Setting/index.vue

@@ -340,7 +340,7 @@ import icpList from '@/utils/ipc';
 const clientStore = client();
 import { ElMessage, ElMessageBox } from 'element-plus';
 
-import { useCheckInfo } from '@/composables/useCheckInfo';
+import { useCheckInfo } from '@/composables/userCheck';
 useCheckInfo();
 // 路由和状态管理初始化
 const route = useRoute();