diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileManagementApplicationServiceBase.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileManagementApplicationServiceBase.cs index 5b0dfbc85..3fb7d3781 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileManagementApplicationServiceBase.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileManagementApplicationServiceBase.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using LINGYUN.Abp.FileManagement.Localization; using Volo.Abp.Application.Services; namespace LINGYUN.Abp.FileManagement @@ -9,7 +7,7 @@ namespace LINGYUN.Abp.FileManagement { protected FileManagementApplicationServiceBase() { - + LocalizationResource = typeof(AbpFileManagementResource); } } } diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs index c715555ca..7e54afc81 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs @@ -379,6 +379,8 @@ namespace LINGYUN.Abp.FileManagement blobPath = Path.Combine(blobPath, containerName); } path = path.Replace(blobPath, ""); + path = path.Replace('/', Path.DirectorySeparatorChar); + path = path.Replace('\\', Path.DirectorySeparatorChar); return path; } /// @@ -393,6 +395,8 @@ namespace LINGYUN.Abp.FileManagement if (!path.IsNullOrWhiteSpace() && fileSystemConfiguration.AppendContainerNameToBasePath) { + path = path.Replace('/', Path.DirectorySeparatorChar); + path = path.Replace('\\', Path.DirectorySeparatorChar); // 去除第一个路径标识符 path = path.RemovePreFix("/", "\\"); blobPath = Path.Combine(blobPath, path); diff --git a/vueJs/package-lock.json b/vueJs/package-lock.json index c098e42d3..be3cf43d6 100644 --- a/vueJs/package-lock.json +++ b/vueJs/package-lock.json @@ -21273,6 +21273,11 @@ "integrity": "sha1-YIeoYTLqgSWqieX44Kl4+8jPb1k=", "dev": true }, + "vue-contextmenujs": { + "version": "1.3.10", + "resolved": "https://registry.npm.taobao.org/vue-contextmenujs/download/vue-contextmenujs-1.3.10.tgz", + "integrity": "sha1-fdl2wlwyHvRFQT/uWMo6x1uQnoQ=" + }, "vue-count-to": { "version": "1.0.13", "resolved": "https://registry.npm.taobao.org/vue-count-to/download/vue-count-to-1.0.13.tgz", diff --git a/vueJs/package.json b/vueJs/package.json index 6617266cf..e5f50de33 100644 --- a/vueJs/package.json +++ b/vueJs/package.json @@ -46,6 +46,7 @@ "view-design": "^4.2.0", "vue": "^2.6.11", "vue-class-component": "^7.2.3", + "vue-contextmenujs": "^1.3.10", "vue-count-to": "^1.0.13", "vue-i18n": "^8.16.0", "vue-image-crop-upload": "^2.5.0", diff --git a/vueJs/src/App.vue b/vueJs/src/App.vue index 2d7738f0e..f828bf2f9 100644 --- a/vueJs/src/App.vue +++ b/vueJs/src/App.vue @@ -17,7 +17,7 @@ import ServiceWorkerUpdatePopup from '@/pwa/components/ServiceWorkerUpdatePopup. } }) export default class extends Vue { - mounted() { + created() { this.initializeAbpConfiguration() } diff --git a/vueJs/src/api/filemanagement.ts b/vueJs/src/api/filemanagement.ts index 33c14b82f..f986231e6 100644 --- a/vueJs/src/api/filemanagement.ts +++ b/vueJs/src/api/filemanagement.ts @@ -75,23 +75,6 @@ export default class FileManagementService { return ApiService.Put(_url, payload, serviceUrl) } - public static mergeFile(name: string, path: string | undefined) { - const _url = baseUrl + '/files' - const _data = { - path: path, - fileName: name, - mergeFile: true - } - return ApiService.HttpRequest({ - url: _url, - data: qs.stringify(_data), - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - } - }) - } - public static downlodFle(name: string, path: string | undefined, currentByte: number | undefined) { let _url = baseUrl + '/files?name=' + name if (path) { diff --git a/vueJs/src/lang/en.ts b/vueJs/src/lang/en.ts index 7c7d002bb..e4349e598 100644 --- a/vueJs/src/lang/en.ts +++ b/vueJs/src/lang/en.ts @@ -78,7 +78,9 @@ export default { clients: 'clients', apiresources: 'api resources', identityresources: 'id resources', - organizationUnit: 'organization unit' + organizationUnit: 'organization unit', + filemanagement: 'file management', + filesystem: 'file system' }, navbar: { logOut: 'Log Out', @@ -612,10 +614,36 @@ export default { confirm: '确 定', correctEmailAddress: '正确的邮件地址', correctPhoneNumber: '正确的手机号码', - operatingFast: '您的操作过快,请稍后再试!' + operatingFast: '您的操作过快,请稍后再试!', + request404: '您所请求的资源不存在!' }, messages: { noNotifications: '没有通知', noMessages: '没有消息' + }, + fileSystem: { + setting: '文件系统', + name: '名称', + creationTime: '创建时间', + lastModificationTime: '修改时间', + type: '类型', + folder: '文件夹', + file: '文件', + fileType: '{exten}文件', + size: '大小', + root: '文件系统', + download: '下载文件', + upload: '上传文件', + deleteFolder: '删除目录', + deleteFile: '删除文件', + addFile: '添加文件', + addFolder: '添加目录', + uploadError: '上传失败', + uploading: '正在上传', + waitingUpload: '等待上传', + paused: '已暂停', + uploadSuccess: '上传成功', + folderNameIsRequired: '目录名称不能为空', + folderCreateSuccess: '目录 {name} 已创建!' } } diff --git a/vueJs/src/lang/zh.ts b/vueJs/src/lang/zh.ts index 88d027f68..2c5e712fb 100644 --- a/vueJs/src/lang/zh.ts +++ b/vueJs/src/lang/zh.ts @@ -642,6 +642,8 @@ export default { uploading: '正在上传', waitingUpload: '等待上传', paused: '已暂停', - uploadSuccess: '上传成功' + uploadSuccess: '上传成功', + folderNameIsRequired: '目录名称不能为空', + folderCreateSuccess: '目录 {name} 已创建!' } } diff --git a/vueJs/src/main.ts b/vueJs/src/main.ts index 751da2c76..fdee7340a 100644 --- a/vueJs/src/main.ts +++ b/vueJs/src/main.ts @@ -6,6 +6,7 @@ import ViewUI from 'view-design' import SvgIcon from 'vue-svgicon' import uploader from 'vue-simple-uploader' +import contextMenu from 'vue-contextmenujs' import '@/styles/element-variables.scss' import 'view-design/dist/styles/iview.css' @@ -40,6 +41,7 @@ Vue.use(SvgIcon, { }) Vue.use(uploader) +Vue.use(contextMenu) // Register global directives Object.keys(directives).forEach(key => { diff --git a/vueJs/src/shims.d.ts b/vueJs/src/shims.d.ts index 6fd27e077..a8e598bd3 100644 --- a/vueJs/src/shims.d.ts +++ b/vueJs/src/shims.d.ts @@ -27,4 +27,7 @@ declare module 'vue-image-crop-upload' declare module 'vue-splitpane' // TODO vue-simple-uploader -declare module 'vue-simple-uploader' \ No newline at end of file +declare module 'vue-simple-uploader' + +// TODO vue-contextmenujs +declare module 'vue-contextmenujs' \ No newline at end of file diff --git a/vueJs/src/views/file-management/components/FileUploadForm.vue b/vueJs/src/views/file-management/components/FileUploadForm.vue index c6a2ad9b4..d48afc184 100644 --- a/vueJs/src/views/file-management/components/FileUploadForm.vue +++ b/vueJs/src/views/file-management/components/FileUploadForm.vue @@ -22,7 +22,8 @@ diff --git a/vueJs/src/views/file-management/index.vue b/vueJs/src/views/file-management/index.vue index bd0ebb6d8..c6dffe812 100644 --- a/vueJs/src/views/file-management/index.vue +++ b/vueJs/src/views/file-management/index.vue @@ -37,6 +37,7 @@ :row-class-name="tableRowClassName" @row-click="onRowClick" @row-dblclick="onRowDoubleClick" + @contextmenu.native="onContextMenu" > { + let parent = '' + // 在根目录下 + if (this.fileSystemRoot.length > 1) { + parent = this.fileSystemRoot.slice(1).join('/') + } + this.$prompt(this.$t('global.pleaseInputBy', { key: this.$t('fileSystem.name') }).toString(), + this.$t('fileSystem.addFolder').toString(), { + showInput: true, + inputValidator: (val) => { + return !(!val || val.length === 0) + }, + inputErrorMessage: this.$t('fileSystem.folderNameIsRequired').toString(), + inputPlaceholder: this.$t('global.pleaseInputBy', { key: this.$t('fileSystem.name') }).toString() + }).then((val: any) => { + FileSystemService.createFolder(val.value, parent).then(() => { + this.$message.success(this.$t('fileSystem.folderCreateSuccess', { name: val.value }).toString()) + this.handleGetFileSystemList() + }) + }).catch(_ => _) + }, + divided: true + }, + { + label: this.$t('fileSystem.upload'), + disabled: !checkPermission(['AbpFileManagement.FileSystem.FileManager.Create']), + onClick: () => { + let path = '' + if (this.fileSystemRoot.length > 1) { + path = this.fileSystemRoot.slice(1).join('/') + } + this.lastFilePath = path + this.showFileUploadDialog = true + } + } + ], + event, + customClass: 'context-menu', + zIndex: 3, + minWidth: 150 + }) + return false + } + private l(name: string, values?: any[] | { [key: string]: any }) { return this.$t(name, values).toString() }