From 6f78ca47abccf5a58b712a2e2326276517d6b6a3 Mon Sep 17 00:00:00 2001 From: jmal Date: Sun, 4 Sep 2022 16:10:08 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=E4=BC=98=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AFoffice=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/office/OnlyOfficeEditor.vue | 16 ++++++++++++++-- src/components/preview/OfficePreview.vue | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/office/OnlyOfficeEditor.vue b/src/components/office/OnlyOfficeEditor.vue index ca32f1a..07b770f 100644 --- a/src/components/office/OnlyOfficeEditor.vue +++ b/src/components/office/OnlyOfficeEditor.vue @@ -121,8 +121,8 @@ export default { this.docEditor = null } this.fileUrl = window.location.origin + fileConfig.previewUrl(this.$store.state.user.name, this.file, this.$store.getters.token) - if(this.readOnly){ - this.fileUrl = window.location.origin + fileConfig.publicPreviewUrl(this.file.id, window.shareId); + if(this.readOnly && window.shareId){ + this.fileUrl = window.location.origin + fileConfig.publicPreviewUrl(this.file.id, window.shareId) } let fileKey = `${new Date(this.file.updateDate).getTime()}-${this.file.id}` @@ -187,16 +187,28 @@ export default { }, onAppReady() { this.$emit('onReady') + console.log('onAppReady') }, onDocumentReady() { + console.log('onDocumentReady') let parentDoc = document.querySelector('.component-only-office') let doc = parentDoc.getElementsByTagName('iframe')[0].contentWindow.document + + if (!this.$pc) { + parentDoc.style.top = '5rem' + doc.querySelector('.navbar.main-navbar.navbar-with-logo').style.height = '0' + let editorNavbar = doc.getElementById("editor-navbar") + console.log(editorNavbar) + // editorNavbar.style.display = 'none' + } + let logo = doc.querySelector('.extra .logo') // 隐藏logo,about logo.style.display = 'none' let about = doc.getElementById('left-btn-about') about.style.display = 'none' this.saveBtnDoc = doc.getElementById('slot-btn-dt-save').getElementsByTagName('button')[0] + }, onDocumentStateChange() { this.saved = this.saveBtnDoc.classList.contains('disabled') diff --git a/src/components/preview/OfficePreview.vue b/src/components/preview/OfficePreview.vue index 8f36f35..8baf75b 100644 --- a/src/components/preview/OfficePreview.vue +++ b/src/components/preview/OfficePreview.vue @@ -224,8 +224,8 @@ export default { }) } this.fileUrl = window.location.origin + fileConfig.previewUrl(this.$store.state.user.name, this.file, this.$store.getters.token) - if(this.readOnly){ - this.fileUrl = window.location.origin + fileConfig.publicPreviewUrl(this.file.id, window.shareId); + if(this.readOnly && window.shareId){ + this.fileUrl = window.location.origin + fileConfig.publicPreviewUrl(this.file.id, window.shareId) } }, }