Browse Source

fix(photography):修复抠图步骤显示问题

- 调整ProgressSteps组件中当前处理款数的计算逻辑- 当步骤状态为"正在处理"且名称为"抠图"时,当前款数加1显示

feat(electron): 增强路径打开功能

- 在打开路径前检查并创建不存在的目录
- 添加异常处理确保即使目录创建失败也能尝试打开路径
- 提高文件系统操作的健壮性
panqiuyao 1 month ago
parent
commit
ffe789d8a9

+ 12 - 0
electron/controller/utils.js

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

+ 1 - 1
frontend/src/views/Photography/components/ProgressSteps.vue

@@ -29,7 +29,7 @@
           <div class="step-status">
             {{ getStepTitle(step) }}
             <div v-if="step.status !== '等待处理'" class="step-details">
-              第{{ step.current }}/{{ step.total }}款
+              第{{ step.status === '正在处理' && step.name === '抠图' ?  step.current+1 : step.current }}/{{ step.total }}款
               {{ getCurrentGoodsNo(step) }}
               <span v-if="step.error" style="color: red; margin-left:5px;">失败:{{step.error}}款</span>