From b680ee3fac93224b46effecf5d3e25d778d2ec16 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 15 May 2025 23:18:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(system/file):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/file.ts | 2 +- src/apis/system/type.ts | 17 +++---- .../system/config/storage/StorageAddModal.vue | 2 +- .../FileAudioModal/ModalContent.vue | 2 +- .../FileDetailModal/ModalContent.vue | 18 ++++---- .../FileRenameModal/ModalContent.vue | 6 +-- .../file/components/FileRenameModal/index.ts | 2 +- .../system/file/main/FileMain/FileGrid.vue | 9 +--- .../system/file/main/FileMain/FileImage.vue | 8 +++- .../system/file/main/FileMain/FileList.vue | 7 +-- src/views/system/file/main/FileMain/index.vue | 44 +++++++++---------- 11 files changed, 55 insertions(+), 62 deletions(-) diff --git a/src/apis/system/file.ts b/src/apis/system/file.ts index 6c5a739..48c5510 100644 --- a/src/apis/system/file.ts +++ b/src/apis/system/file.ts @@ -32,5 +32,5 @@ export function checkFile(sha256: string) { /** @desc 创建文件夹 */ export function createDir(path: string, name: string) { - return http.post(`${BASE_URL}/createDir`, { parentPath: path, name }) + return http.post(`${BASE_URL}/dir`, { path, originalName: name }) } diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index e4487fa..a487cd0 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -202,24 +202,25 @@ export interface NoticePageQuery extends NoticeQuery, PageQuery { export interface FileItem { id: string name: string + originalName: string size: number url: string - parentPath: string - absPath: string - metadata: string + path: string sha256: string contentType: string + metadata: string thumbnailSize: number - thumbnailUrl: string + thumbnailName: string thumbnailMetadata: string + thumbnailUrl: string extension: string type: number storageId: string storageName: string createUserString: string createTime: string - updateUserString: string - updateTime: string + updateUserString?: string + updateTime?: string } /** 文件资源统计信息 */ export interface FileStatisticsResp { @@ -230,9 +231,9 @@ export interface FileStatisticsResp { data: Array } export interface FileQuery { - name?: string + originalName?: string type?: string - absPath?: string + path?: string sort: Array } export interface FilePageQuery extends FileQuery, PageQuery { diff --git a/src/views/system/config/storage/StorageAddModal.vue b/src/views/system/config/storage/StorageAddModal.vue index dd1e294..09d67aa 100644 --- a/src/views/system/config/storage/StorageAddModal.vue +++ b/src/views/system/config/storage/StorageAddModal.vue @@ -101,7 +101,7 @@ const columns: ColumnItem[] = reactive([ field: 'domain', type: 'input', span: 24, - required: true, + required: false, show: () => form.type === 2, }, { diff --git a/src/views/system/file/components/FileAudioModal/ModalContent.vue b/src/views/system/file/components/FileAudioModal/ModalContent.vue index 0531ebc..196d949 100644 --- a/src/views/system/file/components/FileAudioModal/ModalContent.vue +++ b/src/views/system/file/components/FileAudioModal/ModalContent.vue @@ -5,7 +5,7 @@
- {{ props.data?.name }}.{{ props.data?.extension }} + {{ props.data?.originalName }}
diff --git a/src/views/system/file/components/FileDetailModal/ModalContent.vue b/src/views/system/file/components/FileDetailModal/ModalContent.vue index a38c006..a23c652 100644 --- a/src/views/system/file/components/FileDetailModal/ModalContent.vue +++ b/src/views/system/file/components/FileDetailModal/ModalContent.vue @@ -9,14 +9,19 @@ - {{ getFileName(data) }} + {{ data.originalName }} {{ formatFileSize(data.size) }} - {{ data.absPath + getFileName(data) }} - {{ data.sha256 }} + {{ `${data.path === '/' ? '' : data.path}/${data.name}` }} + + + + {{ data.sha256 }} + + {{ data.createTime }} - {{ data.updateTime }} + {{ data?.updateTime }} {{ data.storageName }} @@ -32,11 +37,6 @@ interface Props { } withDefaults(defineProps(), {}) - -// 文件名称带后缀 -const getFileName = (item: FileItem) => { - return `${item.name}${item.extension ? `.${item.extension}` : ''}` -}