Ver Fonte

fix(photography):修复输出目录打开逻辑并更新路径处理

- 修改 openOutputDir 方法以支持动态路径参数
- 更新 shellFun 控制器逻辑,确保目录存在后再打开
- 调整 .gitignore 忽略 output 目录和修正 .DS_Store 规则
-修正 package.json 中 releaseNotes 字段的语法错误
- 统一使用 appPath 替代 pyPath 作为基础路径变量
panqiuyao há 1 mês atrás
pai
commit
c55a62ade0

+ 2 - 1
.gitignore

@@ -1,5 +1,6 @@
 node_modules
 out/
+output/
 logs/
 run/
 .idea/
@@ -12,4 +13,4 @@ __pycache__
 *.pyc
 build/*
 **/dist/
-.DS_Store
+.DS_Store

+ 5 - 2
electron/controller/utils.js

@@ -39,14 +39,17 @@ class UtilsController extends Controller {
    * upload
    */
   async shellFun (params) {
-    console.log(params)
     // 如果是打开路径操作,确保路径存在
-    if (params.action === 'openPath') {
+    if (params.action === 'openMkPath') {
       try {
         // 确保目录存在,如果不存在就创建
         if (!fs.existsSync(params.params)) {
           fs.mkdirSync(params.params, { recursive: true });
         }
+
+        shell.openPath(params.params)
+
+        return;
       } catch (err) {
         console.error('创建目录失败:', err);
         // 即使创建目录失败,也尝试打开路径(可能已经存在)

+ 14 - 9
frontend/src/views/Photography/detail.vue

@@ -879,8 +879,8 @@ const handleSegmentProgressMessage = (data: any) => {
         return;
       }
       updateProgressStep('segment_progress', data.progress)
-      if(data.progress?.status === '处理完成'){
-      //  openOutputDir()
+      if(data.progress?.folder){
+       openOutputDir(data.progress?.folder)
       }
     }
   }
@@ -955,15 +955,20 @@ const handleUploadGoodsProgressMessage = (data: any) => {
 }
 
 // 打开输出目录:appConfig.appPath + '/build/extraResources/py/output'
-const openOutputDir = () => {
+const openOutputDir = (path) => {
   try {
-
-    const pyPath = useConfigInfoStore?.appConfig?.pyPath || ''
-    if (!pyPath) {
-      ElMessage.error('未获取到应用目录 appPath')
-      return
+    let fullPath = ''
+    if(path){
+      fullPath = path
+    }else{
+
+      const appPath = useConfigInfoStore?.appConfig?.appPath || ''
+      if (!appPath) {
+        ElMessage.error('未获取到应用目录 appPath')
+        return
+      }
+      fullPath  = `${pyPath}\\output`
     }
-    const fullPath = `${pyPath}\\output`
     clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
     clientStore.ipc.send(icpList.utils.shellFun, {
       action: 'openPath',

+ 4 - 4
frontend/src/views/Photography/shot.vue

@@ -305,15 +305,15 @@ const menu = computed(()=>{
 const openOutputDir = () => {
   try {
 
-    const pyPath = configInfoStore?.appConfig?.pyPath || ''
-    if (!pyPath) {
+    const appPath = configInfoStore?.appConfig?.appPath || ''
+    if (!appPath) {
       ElMessage.error('未获取到应用目录 appPath')
       return
     }
-    const fullPath = `${pyPath}\\output`
+    const fullPath = `${appPath}\\output`
     clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
     clientStore.ipc.send(icpList.utils.shellFun, {
-      action: 'openPath',
+      action: 'openMkPath',
       params: fullPath.replace(/\//g, '\\')
     });
   } catch (e) {

+ 1 - 1
package.json

@@ -2,7 +2,7 @@
   "name": "ZhiHuiYin",
   "version": "1.3.2",
   "description": "智慧拍照机是一种结合人工智能技术与传统摄影设备的创新产品,版本号为1.3.2",
-  "releaseNotes": "1.3.2 详情页目录调整,
+  "releaseNotes": "1.3.2 详情页目录调整",
   "main": "main.js",
   "scripts": {
     "dev": "ee-bin dev",