From d1bca43678ae5e5b54737e15f3bf2283a1a097af Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 12 Aug 2022 19:45:54 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96office=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/file-api.js | 14 +++ src/components/ShowFile/ShowFile.vue | 5 +- src/components/office/OnlyOfficeEditor.vue | 131 +++++++++------------ src/components/preview/OfficePreview.vue | 45 +++---- src/icons/svg/file-csv.svg | 1 + src/icons/svg/file-docxf.svg | 1 + src/icons/svg/file-ppt.svg | 1 + src/utils/file-type.js | 4 + src/views/public/share/shareList.vue | 18 ++- 9 files changed, 119 insertions(+), 101 deletions(-) create mode 100644 src/icons/svg/file-csv.svg create mode 100644 src/icons/svg/file-docxf.svg create mode 100644 src/icons/svg/file-ppt.svg diff --git a/src/api/file-api.js b/src/api/file-api.js index 70229eb..a0e1154 100644 --- a/src/api/file-api.js +++ b/src/api/file-api.js @@ -271,4 +271,18 @@ export default { params }) }, + // 根据id获取文件信息 + getFileInfoById: function(id) { + return request({ + url: `/file_info/${id}`, + method: 'get' + }) + }, + // 根据id获取文件信息 + getPublicFileInfoById: function(id) { + return request({ + url: `/public/file_info/${id}`, + method: 'get' + }) + }, } diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 6527347..4d2b29f 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -378,7 +378,6 @@ - this.onmessage(msg)) }, beforeDestroy() { - console.log('beforeDestroy') window.removeEventListener('keydown', this.keydown, false) window.removeEventListener('keyup', this.keyup, false) window.removeEventListener('popstate', this.goBack, false) @@ -965,6 +963,7 @@ export default { if (index > -1) { this.fileList[index].size = fileDoc.size this.fileList[index].agoTime = 1 + this.fileList[index].updateDate = fileDoc.updateDate } } if ('deleteFile' === url) { @@ -3114,7 +3113,7 @@ export default { Bus.$emit('onAddAudio', row, this.audioCoverUrl) return } - if (row.contentType.indexOf('office') > -1) { + if (row.contentType.indexOf('office') > -1 || row.suffix === 'csv') { // office文件 this.officePreviewVisible = true this.officePreviewRow = row diff --git a/src/components/office/OnlyOfficeEditor.vue b/src/components/office/OnlyOfficeEditor.vue index 99bd5b7..43414ca 100644 --- a/src/components/office/OnlyOfficeEditor.vue +++ b/src/components/office/OnlyOfficeEditor.vue @@ -1,13 +1,12 @@