소스 검색

mod:重新检查

panqiuyao 8 달 전
부모
커밋
ad58f7b96e

+ 13 - 13
electron/api/camera.js

@@ -4,14 +4,14 @@ const { net } = require('electron');
 
 //
 const baseURL = 'http://localhost:5513/';
-// 创建 Axios 实例
+// 鍒涘缓 Axios 瀹炰緥
 const service = axios.create({
   baseURL:baseURL,
   timeout: 60000,
 });
 
 
-// 封装 GET 方法
+// 灏佽� GET 鏂规硶
 function get(config = { url: '' }) {
   return service.get(config.url, {
     insecureHTTPParser: true,
@@ -90,16 +90,16 @@ module.exports = {
 
 /*
 *
-* 设置   iso
-* 光圈  aperture
-* 拍摄模式  mode
-* 快门速度  shutterSpeed
-* 白平衡    whitebalance
-* 曝光补偿  ExposureCompensation
-* 对焦模式 focusmode
+* 璁剧疆   iso
+* 鍏夊湀  aperture
+* 鎷嶆憚妯″紡  mode
+* 蹇�棬閫熷害  shutterSpeed
+* 鐧藉钩琛�    whitebalance
+* 鏇濆厜琛ュ伩  ExposureCompensation
+* 瀵圭劍妯″紡 focusmode
 *
-*folder 文件夹
-曝光度:exposure
-压缩:compression
-测光点:metering
+*folder 鏂囦欢澶�
+鏇濆厜搴︼細exposure
+鍘嬬缉锛歝ompression
+娴嬪厜鐐癸細metering
 * */

+ 7 - 5
frontend/src/components/check/index.vue

@@ -54,7 +54,7 @@
             <div class="check-btn cu-p" @click="reCheck">重新监测</div>
         </div>
         <div class="flex" v-else>
-            <div class="check-btn cu-p" style="width: 180px" @click="confirm()"> {{ checkInfoStore.isCheckStatus ? '正常,开始下一步' : '检测成功,继续操作'}}</div>
+            <div class="check-btn cu-p" style="width: 180px" @click="confirm()">检测成功,继续操作!</div>
         </div>
     </template>
   </el-dialog>
@@ -74,7 +74,7 @@ const clientStore = client();
  * @param {String} props.title - 对话框标题,默认为 '检测硬件'。
  */
 const props = defineProps({
-  modelValue: {
+  isInitCheck: {
     type: Boolean,
     default: false
   },
@@ -96,10 +96,10 @@ const checkSuccess = ref(false);
 const checkLoading = ref(true);
 
 // 定义事件发射器,用于更新父组件的 modelValue 和触发 confirm 事件
-const emit = defineEmits(['update:modelValue', 'confirm']);
+const emit = defineEmits([ 'confirm']);
 
 // 检测次数计数器
-const checkCount = ref(0);
+const checkCount = ref(props.isInitCheck ? 0 : 1);
 
 // 进度条的当前进度值
 
@@ -153,6 +153,7 @@ watchEffect(async ()=>{
 
 watchEffect(async ()=>{
   if( checkCount.value >= 1 && checkInfoStore.getProgress !== 100 && !checkInfoStore.isCheckStatus){
+    localStorage.setItem('check',false)
     visible.value = true
     checkLoading.value = false;
     checkSuccess.value = false;
@@ -179,7 +180,7 @@ watchEffect(async ()=>{
 })
 
 watchEffect(async ()=>{
-  if( checkInfoStore.getProgress   === 1){
+  if( checkInfoStore.getProgress   === 100){
     checkLoading.value = false;
     checkSuccess.value = true;
   }
@@ -189,6 +190,7 @@ watchEffect(async ()=>{
 function confirm(){
   visible.value = false;
   checkInfoStore.set_isCheckStatus(false);
+  localStorage.setItem('check',true)
   emit('confirm')
 }
 

+ 21 - 8
frontend/src/composables/userCheck.ts

@@ -1,12 +1,9 @@
-import { watchEffect } from 'vue';
-import { ElMessageBox  } from 'element-plus';
-import checkInfo from "../stores/modules/check";
 
-const checkInfoStore = checkInfo()
+import { ElMessageBox  } from 'element-plus';
 export function useCheckInfo() {
 
-    watchEffect(async ()=>{
-        if( checkInfoStore.getProgress !== 100 && !checkInfoStore.isCheckStatus){
+    console.log(localStorage.getItem('check'));
+    if(localStorage.getItem('check') === 'false'){
             ElMessageBox({
                 title:"链接出错!",
                 message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
@@ -17,8 +14,24 @@ export function useCheckInfo() {
                 closeOnHashChange:false,
                 showClose:false
             })
-            return
         }
-    })
+        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
+                })
+
+            }
+        })
+
 
 }

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

@@ -11,11 +11,11 @@ export const checkInfo = defineStore('checkInfo', () => {
 
     // 定义设备列表
     const devices = reactive({
-/*        mcu: {
+        mcu: {
             status: 0,
             msg_type: "connect_mcu",
             msg: "未连接",
-        },*/
+        },
         blue_tooth: {
             status: 0,
             msg_type: "connect_bluetooth",
@@ -47,6 +47,7 @@ export const checkInfo = defineStore('checkInfo', () => {
             },3000)
         }
     }
+
     //mcu 初始化
     const mcu = reactive({
         isInitSend:false,
@@ -223,10 +224,8 @@ export const checkInfo = defineStore('checkInfo', () => {
     return {
         getProgress,
         getErrorMsg,
-        mcu: devices.mcu,
-        blueTooth: devices.blueTooth,
-        camControl: devices.camControl,
-        camera: devices.camera,
+        devices,
+        mcu,
         isCheckStatus,
         set_isCheckStatus,
         blue_tooth_scan_NO,

+ 1 - 0
frontend/src/views/Photography/check.vue

@@ -52,6 +52,7 @@
   </div>
 
   <hardware-check
+   isInitCheck
    @confirm="checkConfirm(true)"
   />
 </template>

+ 1 - 0
frontend/src/views/Setting/index.vue

@@ -342,6 +342,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
 
 import { useCheckInfo } from '@/composables/userCheck';
 useCheckInfo();
+
 // 路由和状态管理初始化
 const route = useRoute();
 const router = useRouter();