Browse Source

mod:初始化 改造

panqiuyao 8 months ago
parent
commit
852a206e8b

+ 9 - 1
frontend/src/stores/modules/check.ts

@@ -7,6 +7,7 @@ import {ElMessage} from "element-plus";
 const socketStore = socket();
 const clientStore = client();
 
+
 export const checkInfo = defineStore('checkInfo', () => {
 
     // 定义设备列表
@@ -37,6 +38,7 @@ export const checkInfo = defineStore('checkInfo', () => {
     const checkTime = ref(0)
     let CKTimerInterval:any = null
     let CKCamControlInterval:any = null
+    let init_mcu_type = ref(true)
     const isCheckStatus = ref(true)
     const set_isCheckStatus = (value)=>{
         isCheckStatus.value = value
@@ -133,7 +135,12 @@ export const checkInfo = defineStore('checkInfo', () => {
                         console.log(result);
                         if(result.status === 2 ){
                             if(!mcu.isInitSend){
-                                socketStore.sendMessage({ type: 'init_mcu' });
+                                socketStore.sendMessage({
+                                    type: 'init_mcu',
+                                    data:{
+                                        value:init_mcu_type.value
+                                    }
+                                });
                                 mcu.isInitSend = true
                                 mcu.status = 1
                             }
@@ -141,6 +148,7 @@ export const checkInfo = defineStore('checkInfo', () => {
                                 devices[deviceName].status = result.status;
                                 devices[deviceName].msg = result.msg;
                                 mcu.status = 2
+                                init_mcu_type.value = false;
                             }
                             if(checkTime.value >= 60 &&   mcu.status !== 2){
                                 mcu.status == -1;

+ 3 - 1
frontend/src/views/Developer/index.vue

@@ -191,7 +191,9 @@ async function  connect_mcu__init(){
 
     socketStore.sendMessage({
       type: 'init_mcu',
-      data:"init_mcu"
+      data:{
+        value:true
+      }
     })
   }
 }

+ 4 - 1
frontend/src/views/Home/index.vue

@@ -259,9 +259,12 @@ async function connect_mcu__init(){
   if(clientStore.isClient){
 
     await socketStore.connectSocket();
+
     socketStore.sendMessage({
       type: 'init_mcu',
-      data:"init_mcu"
+      data:{
+        value:true
+      }
     })
   }