From 82c6b84be3d275b9a80d940570e05ed88a52ad4c Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 30 May 2023 11:36:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=B3=E9=94=AE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=96=B0=E5=A2=9E'=E6=96=B0=E5=BB=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 19 ++++++++++++++++++- src/views/home/index.vue | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 606f31e..958f25a 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1823,6 +1823,7 @@ export default { return; } this.newFolderLoading = true + this.createFileLoading = true api.uploadFolder({ isFolder: true, filename: encodeURI(this.newFolderName), @@ -1837,6 +1838,8 @@ export default { type: 'warning' }); } else { + this.createFileLoading = false + this.newCreateFileDialog = false this.newFolderLoading = false this.showNewFolder = false this.isShowNewFolder = false @@ -1853,6 +1856,7 @@ export default { } }).catch(() => { this.newFolderLoading = false + this.createFileLoading = false }) } else { this.newFolderLoading = false @@ -1864,6 +1868,11 @@ export default { }, // 新建文件 createFile(newFileName) { + if (this.newCreateFileDialogTitle === "新建文件夹") { + this.newFolderName = newFileName + this.newFolderNameClick() + return + } if (newFileName) { if (/[\[\]\/\\"<>\?\*]/gi.test(newFileName)) { this.$message({ @@ -2636,6 +2645,10 @@ export default { this.newCreateFileDialogTitle = "新建文本文件" this.createNewFile('txt') break + case 'createFolder': + this.newCreateFileDialogTitle = "新建文件夹" + this.createNewFile('') + break case 'createDrawioFile': this.newCreateFileDialogTitle = "新建流程图" this.createNewFile('drawio') @@ -2663,7 +2676,11 @@ export default { }, // 新建文件 createNewFile(suffix) { - this.newCreateFileName = `未命名文件.${suffix}` + if (this.newCreateFileDialogTitle === "新建文件夹") { + this.newCreateFileName = `新建文件夹` + } else { + this.newCreateFileName = `未命名文件.${suffix}` + } this.newCreateFileName = this.getNewFileName(this.fileList, this.newCreateFileName) this.newCreateFileDialog = true this.$nextTick(() => { diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 3440914..8bb749d 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -34,6 +34,8 @@ export default { { label: '刷新', operation: 'refresh'}, { divider: true, operation: 'divider' }, { label: '新建', operation: 'create' ,child: [ + { label: '文件夹', operation: 'createFolder', iconClass: 'folder'}, + { divider: true, operation: 'divider' }, { label: '文本', operation: 'createTextFile', iconClass: 'file-txt'}, { label: '思维导图', operation: 'createMinderFile', iconClass: 'file-mind'}, { label: '流程图', operation: 'createDrawioFile', iconClass: 'file-drawio'},