diff --git a/src/api/file-api.js b/src/api/file-api.js index fa131bb..35ce9a5 100644 --- a/src/api/file-api.js +++ b/src/api/file-api.js @@ -471,4 +471,13 @@ export default { data }) }, + // 获取office文件历史 + getOfficeHistoryList: function(params) { + return request({ + url: '/history/office/list', + method: 'get', + params, + }) + }, + } diff --git a/src/components/HistoryPopover/index.vue b/src/components/HistoryPopover/index.vue index 1e3a95a..a90e779 100644 --- a/src/components/HistoryPopover/index.vue +++ b/src/components/HistoryPopover/index.vue @@ -1,223 +1,468 @@ - + + diff --git a/src/components/Timeline/index.vue b/src/components/Timeline/index.vue index f505256..6aa2ae7 100644 --- a/src/components/Timeline/index.vue +++ b/src/components/Timeline/index.vue @@ -236,9 +236,9 @@ export default { .timeline-line { position: absolute; left: 20px; /* (Avatar宽度 / 2) */ - top: 45px; /* 大约是 Avatar 下方开始 */ + top: 50px; /* 大约是 Avatar 下方开始 */ /* bottom: 0; */ /* 不再使用 bottom */ - height: calc(100% - 40px); /* 从 Avatar 下方到底部 */ + height: calc(100% - 30px); /* 从 Avatar 下方到底部 */ width: 1px; background-color: #e1e4e8; z-index: 1; diff --git a/src/components/office/OnlyOfficeEditor.vue b/src/components/office/OnlyOfficeEditor.vue index 8e38057..c8e3d1a 100644 --- a/src/components/office/OnlyOfficeEditor.vue +++ b/src/components/office/OnlyOfficeEditor.vue @@ -211,22 +211,43 @@ export default { this.docEditorConfig.document.key = key ? key : this.fileKey this.docEditor = new DocsAPI.DocEditor(this.id, this.docEditorConfig) }, - onRequestHistoryData(event, historyInfo, url) { - let historyConfig = { - "fileType": this.fileType, - "key": `${new Date(historyInfo.metadata.time).getTime()}-${SparkMD5.hash(this.file.id)}`, - "url": url, - "version": historyInfo.metadata.time, + onRequestHistoryData(event, historyInfo, historyUrl) { + let historyConfig; + if (historyInfo && historyUrl){ + historyConfig = { + "fileType": this.fileType, + "key": `${new Date(historyInfo.metadata.time).getTime()}-${SparkMD5.hash(this.file.id)}`, + "url": historyUrl, + "version": historyInfo.metadata.time, + } + } else { + historyInfo = this.fileHistoryDateList.find(historyInfo => historyInfo.version === event.data) + console.log('historyInfo', historyInfo) + historyUrl = window.location.origin + fileConfig.previewHistoryUrl(historyInfo.key, this.$store.state.user.name, this.$store.state.user.token) + historyConfig = { + "fileType": this.fileType, + "key": historyInfo.key, + "url": historyUrl, + "version": historyInfo.version, + } } api.getOfficeJwt(historyConfig).then(res => { historyConfig.token = res.data this.docEditor.setHistoryData(historyConfig) }) }, + onRequestHistoryClose() { + console.log('onRequestHistoryClose') + this.reloadDocument() + }, onRequestHistory() { - this.docEditor.refreshHistory({ - "currentVersion": 'currentVersion', - "history": [] + api.getOfficeHistoryList({fileId: this.file.id, pageSize: 100, pageIndex: 1}).then(res => { + const currentVersion = res.data.length + 1 + this.fileHistoryDateList = res.data + this.docEditor.refreshHistory({ + "currentVersion": currentVersion, + "history": this.fileHistoryDateList + }) }) }, getType(type) { @@ -345,6 +366,7 @@ export default { "onDocumentStateChange": this.onDocumentStateChange, "onRequestHistory": this.onRequestHistory, "onRequestHistoryData": this.onRequestHistoryData, + "onRequestHistoryClose": this.onRequestHistoryClose, } this.$nextTick(() => { this.titleObserver = null diff --git a/src/components/preview/FileDetails.vue b/src/components/preview/FileDetails.vue index 3214841..79f45f2 100644 --- a/src/components/preview/FileDetails.vue +++ b/src/components/preview/FileDetails.vue @@ -83,6 +83,9 @@ {{ filepath }} + + {{ file.etag }} + {{ file.uploadDate }} diff --git a/src/styles/index.scss b/src/styles/index.scss index de614c5..63ac178 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -376,48 +376,6 @@ input { } -.file-history-popover { - .el-popconfirm { - width: 310px; - } -} -.dark-file-history-popover { - background-color: #202021; - color: #b7b7b7; - border: 1px solid #2e2e30; - .el-popconfirm { - width: 310px; - } -} - -.dark-file-history-list.el-table--enable-row-hover { - .el-table__body tr:hover>td { - background-color: #2e2e30; - color: #fff; - } -} - -.dark-file-history-list.el-table { - background-color: #202021; - tr,th,td { - background-color: #202021; - color: #b7b7b7; - border-bottom: 1px solid #3e3e3e; - } - - .dark-button { - background: #3e3e3e; - border: 1px solid #3e3e3e; - color: #ffffff; - } - .dark-button:hover { - color: #409EFF; - background-color: #181818; - } -} -.dark-file-history-list.el-table::before { - background-color: #3e3e3e; -} kbd { display: inline-block; margin-left: 3px;