Kaynağa Gözat

feat: dialog api调整

zhangjie 12 saat önce
ebeveyn
işleme
af0ca29312

+ 1 - 1
package.json

@@ -7,7 +7,7 @@
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
     "lint": "vue-cli-service lint",
-    "win:build": "vue-cli-service electron:build --win --x64",
+    "win:build": "vue-cli-service electron:build --dir --win --x64",
     "e:build": "vue-cli-service electron:build --win --x64 --ia32",
     "e:serve": "vue-cli-service electron:serve",
     "postinstall": "electron-builder install-app-deps --arch=ia32",

+ 8 - 8
src/modules/cropper-task/ModifyCropperTask.vue

@@ -126,18 +126,18 @@ export default {
       this.modalIsShow = true;
     },
     seleteInputpath() {
-      remote.dialog.showOpenDialog(
-        {
+      remote.dialog
+        .showOpenDialog({
           title: "选择输入目录",
           filters: [{ name: "excel", extensions: ["xls", "xlsx"] }],
           properties: ["openFile"]
-        },
-        folderPaths => {
-          if (folderPaths && folderPaths[0]) {
-            this.modalForm.inputFile = folderPaths[0];
+        })
+        .then(({ canceled, filePaths }) => {
+          if (canceled) return;
+          if (filePaths && filePaths[0]) {
+            this.modalForm.inputFile = filePaths[0];
           }
-        }
-      );
+        });
     },
     checkData(data) {
       // let error

+ 8 - 8
src/modules/manage/views/PaperExport.vue

@@ -452,17 +452,17 @@ export default {
       this.startDownload();
     },
     seleteOutpath() {
-      remote.dialog.showOpenDialog(
-        {
+      remote.dialog
+        .showOpenDialog({
           title: "选择导出目录",
           properties: ["openDirectory"]
-        },
-        folderPaths => {
-          if (folderPaths && folderPaths[0]) {
-            this.scoreFilter.outputDir = folderPaths[0];
+        })
+        .then(({ canceled, filePaths }) => {
+          if (canceled) return;
+          if (filePaths && filePaths[0]) {
+            this.scoreFilter.outputDir = filePaths[0];
           }
-        }
-      );
+        });
     },
     initTask() {
       this.taskRunning = false;