From 9354b5720ec69e536a3054cabea1086130bb9b30 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Tue, 10 Sep 2024 18:08:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E9=87=91=E6=B8=A0=E9=81=93=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/views/contract/contractEdit.vue | 62 ++++++++++++++--------------- src/views/preview/index.vue | 19 ++++++++- 3 files changed, 47 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 6564312..f56ee93 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@vue/composition-api": "^1.7.2", "axios": "0.18.1", "core-js": "3.6.5", + "docx-preview": "^0.3.2", "echarts": "^5.0.0", "element-resize-detector": "^1.2.4", "element-ui": "2.13.2", diff --git a/src/views/contract/contractEdit.vue b/src/views/contract/contractEdit.vue index 4764bae..d67f760 100644 --- a/src/views/contract/contractEdit.vue +++ b/src/views/contract/contractEdit.vue @@ -214,6 +214,33 @@ + + + + + + @@ -24,6 +30,7 @@ import '@vue-office/excel/lib/index.css' //引入VueOfficePdf组件 import VueOfficePdf from '@vue-office/pdf' import axios from 'axios' +//import { renderAsync } from 'docx-preview' export default { components: { VueOfficeDocx, @@ -37,7 +44,7 @@ export default { } }, methods: { - resolveUrl(url) { + async resolveUrl(url) { if(url) { let originalUrl try { @@ -48,11 +55,19 @@ export default { this.type = this.$route.query.type || originalUrl.split('.').at(-1) try { this.url = process.env.VUE_APP_DOMIAN + (window.location.origin === window.top.location.origin ? '' : '/oa') + new URL(originalUrl).pathname - console.log(this.url) } catch (err) { + //this.url = this.$route.query.url this.url = process.env.VUE_APP_DOMIAN + '/oa' + new URL(originalUrl).pathname } } + console.log(this.url) + // if(this.type === 'doc') { + // const res = await fetch(this.url) + // const blob = res.blob() + // this.$nextTick(() => { + // renderAsync(blob, this.$refs['docPreview']) + // }) + // } } }, computed: {},