Explorar el Código

refactor(frontend): 重构摄影页面初始化逻辑和路由配置

- 移除 Photography/check.vue 中冗余的初始化代码
-调整 showVideo() 函数的调用时机
- 更新路由配置,将 Home 组件指向旧的实现
- 优化 socket 消息日志输出,减少冗余信息
panqiuyao hace 4 meses
padre
commit
df9666b661

+ 1 - 4
electron/utils/socket.js

@@ -78,13 +78,10 @@ const pySocket = function () {
       // 监听消息事件
       app.socket.on('message', (data) => {
         try {
-          console.log('socket.on.message11111111111111111111111');
-
           let this_data = JSON.parse(data.toString());
 
-          if(this_data.msg_type !== 'smart_shooter_enable_preview'){ console.log(this_data);}
+          if(!['blue_tooth','smart_shooter_enable_preview'].includes(this_data.msg_type)){ console.log(this_data);}
           if(this_data.msg_type){
-
             let notAllMessage = false
             switch (this_data.msg_type){
               case 'smart_shooter_enable_preview':

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

@@ -14,7 +14,7 @@ const routes: RouteRecordRaw[] = [
     {
         path: "/home",
         name: "home",
-        component: () => import("@/views/Home/index.vue"),
+        component: () => import("@/views/Home/index_old.vue"),
         meta: {
             noAuth: true,
         },

+ 6 - 8
frontend/src/views/Photography/check.vue

@@ -145,12 +145,6 @@ async function checkConfirm(init){
       type:'toggleModel'
     })
   }
-  if(init){
-    await  configInfoStore.getAppConfig()
-    if(configInfoStore.appConfig.controlType === "SmartShooter"){
-        preview.value = configInfoStore.appConfig.userDataPath  + "\\preview\\liveview.png"
-      }
-  }
   if(!init) previewKey.value++;
 
   showVideo()
@@ -287,8 +281,12 @@ clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, resul
   }
 
 })
-onMounted(()=>{
- // showVideo()
+onMounted(async ()=>{
+  if(isSetting.value)   showVideo()
+  await  configInfoStore.getAppConfig()
+  if(configInfoStore.appConfig.controlType === "SmartShooter"){
+    preview.value = configInfoStore.appConfig.userDataPath  + "\\preview\\liveview.png"
+  }
 })
 
 /**