Browse Source

refactor(Photography): 更新打开输出目录功能

- 移除打开输出目录按钮的注释- 修改输出目录路径获取方式,使用 pyPath 替代 appPath
- 在 utils.js 中添加 pyPath 配置项
-优化路径拼接和日志输出
panqiuyao 3 months ago
parent
commit
388368d2ca
2 changed files with 11 additions and 5 deletions
  1. 4 1
      electron/controller/utils.js
  2. 7 4
      frontend/src/views/Photography/detail.vue

+ 4 - 1
electron/controller/utils.js

@@ -161,10 +161,13 @@ class UtilsController extends Controller {
 
   getAppConfig(){
     const config  =  readConfigFile()
+    const appPath = app.getAppPath();
+    const pyPath = path.join(path.dirname(appPath), 'extraResources', 'py');
     return  {
       ...config,
       userDataPath: app.getPath('userData'),
-      appPath: app.getAppPath()
+      appPath: appPath,
+      pyPath:pyPath,
     }
   }
   async readFileImageForPath(filePath,maxWidth=1500){

+ 7 - 4
frontend/src/views/Photography/detail.vue

@@ -291,7 +291,7 @@
         <div class="message-header">
           <span>处理进度</span>
           <div class="flex right" style="gap:8px; align-items:center;">
-<!--            <el-button type="text" @click="openOutputDir" v-log="{ describe: { action: '点击打开输出目录' } }">打开目录</el-button>-->
+            <el-button type="text" @click="openOutputDir" v-log="{ describe: { action: '点击打开输出目录' } }">打开目录</el-button>
             <el-button type="text" @click="showMessageHistory = !showMessageHistory" v-log="{ describe: { action: '点击查看进度详情' } }">
               {{ showMessageHistory ? '收起' : '查看详情' }}
             </el-button>
@@ -721,12 +721,15 @@ const handleUploadGoodsProgressMessage = (data: any) => {
 // 打开输出目录:appConfig.appPath + '/build/extraResources/py/output'
 const openOutputDir = () => {
   try {
-    const appPath = useConfigInfoStore?.appConfig?.appPath || ''
-    if (!appPath) {
+
+    const pyPath = useConfigInfoStore?.appConfig?.pyPath || ''
+    if (!pyPath) {
       ElMessage.error('未获取到应用目录 appPath')
       return
     }
-    const fullPath = `${appPath}/build/extraResources/py/output`
+    console.log(pyPath);
+    const fullPath = `${pyPath}\\output`
+    console.log(fullPath);
     clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
     clientStore.ipc.send(icpList.utils.shellFun, {
       action: 'openPath',