From ec1226a8ce5ea355fffef2feba0baf23a5f75db6 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 18 Jul 2022 07:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=96=87=E4=BB=B6=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=96=B0=E5=A2=9E=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=89=80=E5=9C=A8=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/pages/manage/file.vue | 58 ++++++++++++++++------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index 9593ea00f..28d7b73ca 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -147,19 +147,24 @@ trigger="custom" :visible="contextMenuVisible" transfer-class-name="page-file-dropdown-menu" + @on-click="handleContextClick" @on-clickoutside="handleClickContextMenuOutside" @on-visible-change="handleVisibleChangeMenu" transfer> @@ -909,7 +914,9 @@ export default { }, addFile(command) { - if (command == 'upload') { + if (!command) { + return; + } else if (command == 'upload') { this.uploadDir = false this.$refs.fileUpload.handleClick(); return; @@ -968,6 +975,7 @@ export default { if (id > 0) { this.goForward({name: 'manage-file', params: {folderId: id, fileId: null}}); } else { + this.searchKey = ''; this.goForward({name: 'manage-file'}); } }, @@ -1074,7 +1082,11 @@ export default { }, handleContextClick(command) { - this.dropFile(this.contextMenuItem, command) + if ($A.leftExists(command, "new:")) { + this.addFile($A.leftDelete(command, "new:")) + } else { + this.dropFile(this.contextMenuItem, command) + } }, handleClickContextMenuOutside() { @@ -1111,6 +1123,10 @@ export default { } break; + case 'upperFolder': + this.browseFolder(item.pid) + break; + case 'select': let index = this.selectIds.findIndex(id => id == item.id) if (index > -1) { @@ -1335,13 +1351,19 @@ export default { if (e.keyCode === 13) { this.onEnter(item); } else if (e.keyCode === 27) { - this.setLoad(item.id, false) - this.setEdit(item.id, false) + const isCreate = !/^\d+$/.test(item.id); + if (isCreate) { + item.newname = '' + this.$store.dispatch("forgetFile", item.id); + } else { + this.setLoad(item.id, false) + this.setEdit(item.id, false) + } } }, onEnter(item) { - let isCreate = !/^\d+$/.test(item.id); + const isCreate = !/^\d+$/.test(item.id); if (!item.newname) { if (isCreate) { this.$store.dispatch("forgetFile", item.id);