فهرست منبع

refactor(frontend): 优化摄影视图和套索通信

- 修改加载状态显示逻辑
-调整预览图片刷新间隔
- 优化 Python 套索初始化和消息处理
-移除不必要的错误日志
panqiuyao 5 ماه پیش
والد
کامیت
9a49212bca
3فایلهای تغییر یافته به همراه11 افزوده شده و 7 حذف شده
  1. 1 1
      electron/controller/socket.js
  2. 7 3
      electron/utils/socket.js
  3. 3 3
      frontend/src/views/Photography/check.vue

+ 1 - 1
electron/controller/socket.js

@@ -16,7 +16,7 @@ class SocketController extends Controller {
   async connect() {
   async connect() {
 
 
      await new Promise(async (resolve,reject) => {
      await new Promise(async (resolve,reject) => {
-       pySocket.init()
+       pySocket.init(this.app)
 
 
     })
     })
 
 

+ 7 - 3
electron/utils/socket.js

@@ -4,7 +4,7 @@ const CoreWindow = require('ee-core/electron/window');
 const WebSocket = require('ws'); // 引入原生 ws 库
 const WebSocket = require('ws'); // 引入原生 ws 库
 const { readConfigFile } = require('./config');
 const { readConfigFile } = require('./config');
 const pyapp = readConfigFile().pyapp
 const pyapp = readConfigFile().pyapp
-const {  app} = require('electron');
+const { app } = require('electron');
 const path = require('path');
 const path = require('path');
 const fs = require('fs');
 const fs = require('fs');
 
 
@@ -42,7 +42,6 @@ function livePreview(data){
       } else {
       } else {
         fs.rename(tempFilePath, previewPath, (renameErr) => {
         fs.rename(tempFilePath, previewPath, (renameErr) => {
           if (renameErr) {
           if (renameErr) {
-            Log.error('重命名文件失败:', renameErr);
           } else {
           } else {
           }
           }
         });
         });
@@ -55,7 +54,9 @@ function livePreview(data){
 
 
 const pySocket = function () {
 const pySocket = function () {
 
 
-  this.init = async function () {
+  this.app = null;
+  this.init = async function (this_app) {
+    if(this_app)   this.app = this_app;
     await new Promise(async (resolve,reject) => {
     await new Promise(async (resolve,reject) => {
 
 
       const win = CoreWindow.getMainWindow()
       const win = CoreWindow.getMainWindow()
@@ -83,11 +84,14 @@ const pySocket = function () {
 
 
           if(this_data.msg_type){
           if(this_data.msg_type){
 
 
+            let notAllMessage = false
             switch (this_data.msg_type){
             switch (this_data.msg_type){
               case 'smart_shooter_enable_preview':
               case 'smart_shooter_enable_preview':
+                notAllMessage = true;
                 livePreview(this_data);
                 livePreview(this_data);
                 break;
                 break;
             }
             }
+            if(notAllMessage) return;
             let channel = 'controller.socket.message_'+this_data.msg_type;
             let channel = 'controller.socket.message_'+this_data.msg_type;
             if(typeToMessage[this_data.msg_type]){
             if(typeToMessage[this_data.msg_type]){
               if(typeof typeToMessage[this_data.msg_type] === 'object'){
               if(typeof typeToMessage[this_data.msg_type] === 'object'){

+ 3 - 3
frontend/src/views/Photography/check.vue

@@ -161,7 +161,7 @@ async function checkConfirm(init){
 }
 }
 
 
 function onRunMcuSingle (){
 function onRunMcuSingle (){
-  loading.value = true
+  loading.value = false
 }
 }
 const showrEditRow = ref(false)
 const showrEditRow = ref(false)
 
 
@@ -179,8 +179,8 @@ function showVideo(){
       setTimeout(()=>{
       setTimeout(()=>{
         interval = setInterval(()=>{
         interval = setInterval(()=>{
           previewKey.value++;
           previewKey.value++;
-        },1000)
-      },500)
+        },200)
+      },2000)
 
 
     })
     })