From 1fb76ca72dadf42ece943ed233adf90362cf9f59 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Tue, 8 Apr 2025 15:09:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=BD=E6=9F=A5=E6=96=87=E6=A1=A3=E9=A2=84?= =?UTF-8?q?=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Preview_onlyoffice/fun.js | 23 +++++ src/components/Preview_onlyoffice/index.js | 7 ++ src/components/Preview_onlyoffice/index.vue | 45 ++++++++++ src/main.js | 2 + src/utils/onlyOffice_type.js | 66 ++++++++++++++ .../components/auditDocument/index.vue | 81 ++++++++++++++---- static/onlyOffice/viewer.html | 85 +++++++++++++++++++ 7 files changed, 292 insertions(+), 17 deletions(-) create mode 100644 src/components/Preview_onlyoffice/fun.js create mode 100644 src/components/Preview_onlyoffice/index.js create mode 100644 src/components/Preview_onlyoffice/index.vue create mode 100644 src/utils/onlyOffice_type.js create mode 100644 static/onlyOffice/viewer.html diff --git a/src/components/Preview_onlyoffice/fun.js b/src/components/Preview_onlyoffice/fun.js new file mode 100644 index 00000000..75a62a67 --- /dev/null +++ b/src/components/Preview_onlyoffice/fun.js @@ -0,0 +1,23 @@ +import Vue from "vue"; +import OnlyOffice from "./index.vue"; + +const PreviewConstructor = Vue.extend(OnlyOffice); + +const onlyOffice = options => { + const { path, type, title } = options; + if (!path) throw `path is requred.but ${path}` + const id = `OnlyOffice_${new Date().getTime()}`; + const instance = new PreviewConstructor(); + instance.id = id; + instance.vm = instance.$mount(); + if (instance.vm.visible) return; + document.body.appendChild(instance.vm.$el); + instance.vm.open(path, type, title); + instance.vm.$on("closed", () => { + instance.vm.docEditor = null + document.body.removeChild(instance.vm.$el); + instance.vm.$destroy(); + }); + return instance.vm; +} +export default onlyOffice; \ No newline at end of file diff --git a/src/components/Preview_onlyoffice/index.js b/src/components/Preview_onlyoffice/index.js new file mode 100644 index 00000000..b549c70f --- /dev/null +++ b/src/components/Preview_onlyoffice/index.js @@ -0,0 +1,7 @@ +import OnlyOffice from "./index.vue"; +import onlyOffice from "./fun"; + +export default Vue => { + Vue.component(OnlyOffice.name, OnlyOffice); + Vue.prototype.$onlyOffice = onlyOffice; +}; \ No newline at end of file diff --git a/src/components/Preview_onlyoffice/index.vue b/src/components/Preview_onlyoffice/index.vue new file mode 100644 index 00000000..ae94ac95 --- /dev/null +++ b/src/components/Preview_onlyoffice/index.vue @@ -0,0 +1,45 @@ +