浏览代码

Merge remote-tracking branch 'origin/dev-frontend' into dev-frontend

panqiuyao 8 月之前
父节点
当前提交
66f1664fe1
共有 3 个文件被更改,包括 58 次插入50 次删除
  1. 10 19
      frontend/src/composables/userCheck.ts
  2. 30 16
      frontend/src/views/Photography/shot.vue
  3. 18 15
      frontend/src/views/Setting/index.vue

+ 10 - 19
frontend/src/composables/userCheck.ts

@@ -2,8 +2,16 @@
 import { ElMessageBox  } from 'element-plus';
 export function useCheckInfo() {
 
-    console.log(localStorage.getItem('check'));
-    if(localStorage.getItem('check') === 'false'){
+        if(localStorage.getItem('check') === 'false'){
+            ShowError()
+        }
+        window.addEventListener('storage',(e)=>{
+            if(e.key === 'check' && e.newValue === false && e.oldValue === true){
+                ShowError()
+            }
+        })
+        function ShowError(){
+
             ElMessageBox({
                 title:"链接出错!",
                 message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
@@ -15,23 +23,6 @@ export function useCheckInfo() {
                 showClose:false
             })
         }
-        window.addEventListener('storage',(e)=>{
-            console.log('addEventListener')
-            console.log(e)
-            if(e.key === 'check' && e.newValue === false && e.oldValue === true){
-                ElMessageBox({
-                    title:"链接出错!",
-                    message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
-                    showCancelButton:false,
-                    showConfirmButton:false,
-                    closeOnClickModal:false,
-                    closeOnPressEscape:false,
-                    closeOnHashChange:false,
-                    showClose:false
-                })
-
-            }
-        })
 
 
 }

+ 30 - 16
frontend/src/views/Photography/shot.vue

@@ -193,7 +193,10 @@ const socketStore = socket()
  * 保存货号模板到货号变量中。
  */
 function saveGoodsArtNo(){
-  if(goods_art_no_tpl.value) goods_art_no.value = goods_art_no_tpl.value
+  if(goods_art_no_tpl.value){
+    goods_art_no.value = goods_art_no_tpl.value
+    ElMessage.success('商品货号'+goods_art_no.value+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
+  }
 }
 
 /**
@@ -235,11 +238,25 @@ async function runGoods(data) {
   })
 
   ElMessage.success('开始拍摄,请稍后')
-  console.log('aa4')
   runLoading.value = true;
   runAction.value = data
   goods_art_no.value = ''
   goods_art_no_tpl.value = ''
+
+
+  clientStore.ipc.on(icpList.socket.message + '_run_mcu', (event, result) => {
+
+    clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
+    console.log('_run_mcu');
+    console.log(result);
+    if(result.code !== 0 && result.msg){
+      ElMessage.error(result.msg)
+      runLoading.value = false
+      return;
+    }
+  })
+
+
 }
 
 /**
@@ -307,20 +324,15 @@ onMounted(async () => {
 
     console.log('_blue_tooth_scan')
     if (result.code === 0 && result.data?.data) {
-      if(result.data?.data.goods_art_no) runGoods(result.data?.data)
-      if(!result.data?.data.goods_art_no && goods_art_no.value){
-        console.log('aa')
-        console.log('手工')
-        console.log({
-          ...result.data?.data,
-          goods_art_no: goods_art_no.value
-        })
-        runGoods({
-          ...result.data?.data,
-          goods_art_no: goods_art_no.value
-        })
-        console.log('aa1')
+      console.log(goods_art_no.value);
+      if(!goods_art_no.value){
+          ElMessage.error('请先扫描货号或者手动输入货号!')
+          return;
       }
+      runGoods({
+        ...result.data?.data,
+        goods_art_no: goods_art_no.value
+      })
 
     }
   });
@@ -383,7 +395,8 @@ const checkInfoStore = checkInfo()
 checkInfoStore.set_blue_tooth_scan_NO('')
 watchEffect(async ()=>{
   if(checkInfoStore.blue_tooth_scan_NO){
-    ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请根据左右脚按遥控器上的左右脚按键启动拍摄')
+    ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
+    goods_art_no.value = checkInfoStore.blue_tooth_scan_NO
     checkInfoStore.set_blue_tooth_scan_NO('')
   }
 })
@@ -395,6 +408,7 @@ watchEffect(async ()=>{
 onBeforeUnmount(() => {
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_blue_tooth_scan');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_image_process');
+  clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take_finish');
 

+ 18 - 15
frontend/src/views/Setting/index.vue

@@ -823,15 +823,15 @@ function testShoesFlip(){
     socketStore.sendMessage({
       type: 'run_mcu_single',
       data: {
-        camera_height: editRowData.value.camera_height,
-        camera_angle: editRowData.value.camera_angle,
+        camera_height: Number(editRowData.value.camera_height),
+        camera_angle:  Number(editRowData.value.camera_angle),
         led_switch:editRowData.value.led_switch,
         id:0,
         mode_type:'执行'+ activeTab.value === 'left' ? '左脚' : '右脚'+'程序',
-        turntable_position:editRowData.value.turntable_position,
+        turntable_position:Number(editRowData.value.turntable_position),
         action_name:editRowData.value.action_name || '测试',
-        turntable_angle: editRowData.value.turntable_angle,
-        shoe_upturn: editRowData.value.shoe_upturn,
+        turntable_angle: Number(editRowData.value.turntable_angle),
+        shoe_upturn: Number(editRowData.value.shoe_upturn),
         action_index:1,
         number_focus:0,
         take_picture:false,
@@ -843,17 +843,20 @@ function testShoesFlip(){
 
 
     clientStore.ipc.on(icpList.socket.message+'_run_mcu_single_finish', async (event, result) => {
-
-      clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
-      clientStore.ipc.send(icpList.camera.takePictures,false);
-      clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
-        setTimeout(()=>{
-          imageUrlkey.value++;
-          preview(imageUrl.value+'?key='+imageUrlkey.value)
-          captureLoading.value = false;
-        },5000)
+      console.log('_run_mcu_single_finish')
+      setTimeout(()=>{
         clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
-      })
+        clientStore.ipc.send(icpList.camera.takePictures,false);
+        clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
+          setTimeout(()=>{
+            imageUrlkey.value++;
+            console.log('preview')
+            preview(imageUrl.value+'?key='+imageUrlkey.value)
+            captureLoading.value = false;
+          },8000)
+          clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
+        })
+      },1000)
 
 
     })