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> - + {{$L('打开')}} “{{contextMenuItem.name}}” - {{$L(selectIds.includes(contextMenuItem.id) ? '取消选择' : '选择')}} + + {{$L('在上层文件夹中显示')}} + + + {{$L(selectIds.includes(contextMenuItem.id) ? '取消选择' : '选择')}} - + {{$L('新建')}} @@ -168,22 +173,22 @@ v-if="type.label" :key="key" :divided="!!type.divided" - @click.native="addFile(type.value)"> + :name="`new:${type.value}`"> {{$L(type.label)}} - {{$L('重命名')}} - {{$L('复制')}} - {{$L('剪切')}} + {{$L('重命名')}} + {{$L('复制')}} + {{$L('剪切')}} - {{$L('共享')}} - {{$L('退出共享')}} - {{$L('链接')}} - {{$L('下载')}} + {{$L('共享')}} + {{$L('退出共享')}} + {{$L('链接')}} + {{$L('下载')}} - {{$L('删除')}} + {{$L('删除')}} + :name="`new:${type.value}`"> {{$L(type.label)}} @@ -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);