Selaa lähdekoodia

feat(frontend): 添加首页快速访问资源目录功能并优化相机预览

- 在首页添加快速访问资源目录功能,连续点击5次可打开资源目录
- 优化相机预览页面,动态加载示例图片
- 更新配置文件,增加 debug 模式和远程 URL 设置
- 调整开发工具开启条件,根据配置文件中的 debug 设置决定是否开启
panqiuyao 4 kuukautta sitten
vanhempi
commit
7b85528124

+ 2 - 2
electron/config/config.prod.js

@@ -11,7 +11,7 @@ module.exports = (appInfo) => {
   /**
    * 开发者工具
    */
-  config.openDevTools = configDeault.openDevTools;
+  config.openDevTools = configDeault.debug;
 
   /**
    * 应用程序顶部菜单
@@ -28,7 +28,7 @@ module.exports = (appInfo) => {
    * 远程模式-web地址
    */
   config.remoteUrl = {
-    enable: false,
+    enable: configDeault.remoteUrl || false,
     url: 'http://localhost:3000/#/home'
   };
 

+ 2 - 1
electron/utils/config.default.json

@@ -1,9 +1,10 @@
 {
-  "openDevTools":false,
+  "debug":false,
   "controlType": "SmartShooter",
   "controlPath": "C:\\Program Files\\Smart Shooter 5",
   "digiCamControlPath":"C:\\Program Files (x86)\\digiCamControl",
   "SmartShooterPath":"C:\\Program Files\\Smart Shooter 5",
   "pyapp": "127.0.0.1",
+  "remoteUrl": false,
   "env": "prod"
 }

+ 37 - 1
frontend/src/views/Home/index.vue

@@ -4,7 +4,10 @@
               [{
                 type:'ota'
               }]"
-  />
+  >
+
+    <template  #title><div @click="handleSettingClick">首页</div></template>
+  </headerBar>
   <div class="home-container" v-loading="loading">
     <!-- 背景图片 -->
     <img src="@/assets/images/home/bg.png" alt="背景图片" class="background-image" />
@@ -29,6 +32,8 @@ import { useRouter } from "vue-router";
 import configInfo from '@/stores/modules/config';
 import { ref, onMounted } from 'vue';
 import axios from 'axios';
+import client from "@/stores/modules/client";
+import icpList from '@/utils/ipc';
 
 const configInfoStore = configInfo();
 const router = useRouter();
@@ -74,6 +79,37 @@ const checkHealth = async () => {
     }
 };
 
+const settingClickCount = ref(0);
+// 修改headerBar的点击处理函数
+function handleSettingClick() {
+  console.log('handleSettingClickhandleSettingClick')
+  settingClickCount.value++;
+
+  if (settingClickCount.value >= 5) {
+      openResourceDirectory()
+    settingClickCount.value = 0;
+  }
+
+  setTimeout(() => {
+    settingClickCount.value = 0;
+  }, 3000); // 3秒内未再次点击则重置计数器
+}
+
+const clientStore = client();
+
+function openResourceDirectory() {
+  clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
+  let params = {
+    action: 'openPath',
+    params: configInfoStore.appConfig.userDataPath.replaceAll('/', '\\')
+  };
+  clientStore.ipc.send(icpList.utils.shellFun, params);
+}
+
+
+
+
+
 // 在组件挂载时执行健康检查
 onMounted(() => {
     checkHealth();

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

@@ -23,7 +23,9 @@
             <div class="camera-preview  flex col center ">
               <div class="camera-preview-img" v-if="step === 1">
                 <img v-if="previewKey" class="camera-img" :src="previewSrc" />
-                <div class="example-image flex-col" v-if="!isSetting && previewKey > 1"><img src="https://huilimaimg.cnhqt.com/frontend/zhihuiyin/demo.jpg?x-oss-process=image/resize,w_400"></div>
+                <div class="example-image flex-col" v-if="!isSetting && previewKey > 1">
+                  <img :src="exampleImage">
+                </div>
               </div>
               <template v-if="step === 2" >
                 <img class="camera-img"  :src="getFilePath(imageTplPath)" />
@@ -286,12 +288,16 @@ clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, resul
   }
 
 })
+
+const exampleImage = ref('https://huilimaimg.cnhqt.com/frontend/zhihuiyin/demo.jpg?x-oss-process=image/resize,w_400')
 onMounted(async ()=>{
   if(isSetting.value)   showVideo()
   await  configInfoStore.getAppConfig()
   if(configInfoStore.appConfig.controlType === "SmartShooter"){
     preview.value = configInfoStore.appConfig.userDataPath  + "\\preview\\liveview.png"
   }
+  exampleImage.value =  configInfoStore.appConfig.exampleImage || 'https://huilimaimg.cnhqt.com/frontend/zhihuiyin/demo.jpg?x-oss-process=image/resize,w_400'
+
 })
 
 /**