Browse Source

mod:交互调整

panqiuyao 8 months ago
parent
commit
c06548f2f3

+ 1 - 2
frontend/src/components/check/index.vue

@@ -141,9 +141,8 @@ watchEffect(async ()=>{
       visible.value = true
       //python 启动有延时,延迟2秒执行
       setTimeout(()=>{
-
         startProgress()
-      },2000)
+      },5000)
     }
     checkCount.value++;
   }

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

@@ -3,7 +3,7 @@ import { ref, reactive, computed } from 'vue';
 import socket from "./socket";
 import icpList from "../../utils/ipc";
 import client from "./client";
-
+import {ElMessage} from "element-plus";
 const socketStore = socket();
 const clientStore = client();
 
@@ -33,6 +33,7 @@ export const checkInfo = defineStore('checkInfo', () => {
         },*/
     });
 
+    const blue_tooth_scan_NO = ref('')
     const checkTime = ref(0)
     let CKTimerInterval:any = null
 
@@ -58,7 +59,7 @@ export const checkInfo = defineStore('checkInfo', () => {
             clearInterval(CKTimerInterval)
             checkTime.value = 0
             mcu.isInitSend = false
-            return '相机初始化失败,请重新监测或强制初始化!';
+            return '拍照机初始化失败,请重新监测!';
         }
         for (const device of Object.values(devices)) {
             if (device.status === -1) {
@@ -137,10 +138,18 @@ export const checkInfo = defineStore('checkInfo', () => {
                             devices[deviceName].status = result.status;
                             devices[deviceName].msg = result.msg;
                         }
-                    }else if([-1,0,2].includes(result.status)){
-                        devices[deviceName].status = result.status;
-                        devices[deviceName].msg = result.msg;
                     }
+                    if(deviceName === 'blue_tooth'){
+                        if (result.code === 0 && result.data?.data && result.data._type === 0 && typeof(result.data.data) === 'string'){
+                            blue_tooth_scan_NO.value = result.data.data
+                       //     ElMessage.success('商品货号'+result.data.data+'获取成功,请根据左右脚按遥控器上的左右脚按键启动拍摄')
+                        }
+                        if([-1,0,2].includes(result.status)){
+                            devices[deviceName].status = result.status;
+                            devices[deviceName].msg = result.msg;
+                        }
+                    }
+
                 }
             });
         } catch (error) {
@@ -194,6 +203,10 @@ export const checkInfo = defineStore('checkInfo', () => {
 
     };
 
+    function set_blue_tooth_scan_NO(value){
+        blue_tooth_scan_NO.value = value
+    }
+
 
     return {
         getProgress,
@@ -202,6 +215,8 @@ export const checkInfo = defineStore('checkInfo', () => {
         blueTooth: devices.blueTooth,
         camControl: devices.camControl,
         camera: devices.camera,
+        blue_tooth_scan_NO,
+        set_blue_tooth_scan_NO,
         checkAction,
         reCheckAction,
     };

+ 17 - 5
frontend/src/views/Photography/shot.vue

@@ -155,13 +155,14 @@
 </template>
 <script setup lang="ts">
 import headerBar from '@/components/header-bar/index.vue'
-import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
+import { ref, reactive, onMounted, onBeforeUnmount,watchEffect } from 'vue'
 import icpList from '@/utils/ipc'
 import client from "@/stores/modules/client";
 import socket from "@/stores/modules/socket";
 import { ElMessage ,ElMessageBox } from 'element-plus'
 import { getFilePath,getRouterUrl } from '@/utils/appfun'
 import {useRouter} from "vue-router";
+import checkInfo from "@/stores/modules/check";
 
 
 const loading = ref(false)
@@ -228,10 +229,7 @@ async function runGoods(data) {
     data,
   })
 
-  ElMessage({
-    message: '开始拍摄,请稍后',
-    type: 'success',
-  })
+  ElMessage.success('开始拍摄,请稍后')
   console.log('aa4')
   runLoading.value = true;
   runAction.value = data
@@ -322,6 +320,7 @@ onMounted(async () => {
     }
   });
 
+
   await getPhotoRecords();
   // 监听图片处理完成事件
   clientStore.ipc.on(icpList.socket.message + '_image_process', (event, result) => {
@@ -362,6 +361,9 @@ onMounted(async () => {
         ElMessage.error('拍摄程序正在运行,请稍候')
         return
       }
+
+      ElMessage.success('正在拍摄中,请稍候')
+
       await socketStore.connectSocket();
       socketStore.sendMessage(result.data)
       takePictureLoading.value = true;
@@ -372,6 +374,16 @@ onMounted(async () => {
 
 })
 
+const checkInfoStore = checkInfo()
+checkInfoStore.set_blue_tooth_scan_NO('')
+watchEffect(async ()=>{
+  if(checkInfoStore.blue_tooth_scan_NO){
+    ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请根据左右脚按遥控器上的左右脚按键启动拍摄')
+    checkInfoStore.set_blue_tooth_scan_NO('')
+  }
+})
+
+
 /**
  * 页面卸载时移除所有事件监听器。
  */