From a08474d32c28e22f2083d075a570d7682f6d7054 Mon Sep 17 00:00:00 2001 From: vertoryao Date: Tue, 6 May 2025 10:28:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(@vben/web-antd):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 PPT 和 Word 预览组件的样式和背景色 - 更新 PPT 和 Word 文件的请求路径 - 调整 Vite 配置,增加对文档文件的代理支持 --- apps/web-antd/vite.config.mts | 10 ++++++---- packages/effects/common-ui/src/ui/ppt/ppt-perview.vue | 11 +++++++++-- .../effects/common-ui/src/ui/ppt/ppt-work-view.vue | 4 ++-- .../effects/common-ui/src/ui/word/word-preview.vue | 6 +++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/apps/web-antd/vite.config.mts b/apps/web-antd/vite.config.mts index f921083..7a5f58b 100644 --- a/apps/web-antd/vite.config.mts +++ b/apps/web-antd/vite.config.mts @@ -13,13 +13,15 @@ export default defineConfig(async () => { target: 'http://localhost:8081/api', ws: true, }, - '/static/*.docx': { + '/docx': { changeOrigin: true, - target: 'http://47.112.173.8:6805', + rewrite: (path) => path.replace(/^\/docx/, ''), + target: 'http://47.112.173.8:6805/static', }, - '/static/*.ppt': { + '/pptx': { changeOrigin: true, - target: 'http://47.112.173.8:6802', + rewrite: (path) => path.replace(/^\/pptx/, ''), + target: 'http://47.112.173.8:6802/static', }, '/v1': { changeOrigin: true, diff --git a/packages/effects/common-ui/src/ui/ppt/ppt-perview.vue b/packages/effects/common-ui/src/ui/ppt/ppt-perview.vue index 96445f9..76d1939 100644 --- a/packages/effects/common-ui/src/ui/ppt/ppt-perview.vue +++ b/packages/effects/common-ui/src/ui/ppt/ppt-perview.vue @@ -6,13 +6,14 @@ import { useVbenDrawer } from '@vben/common-ui'; import VueOfficePptx from '@vue-office/pptx'; // import '@vue-office/pptx/lib/index.css'; - +// http://47.112.173.8:6802/static/66f3cfd95e364a239d8036390db658ae.pptx const url = ref(''); -const pptx = ref('/static/43b7da46a6ca47e5a9d7710d8dcf499c.pptx'); +const pptx = ref('/pptx/66f3cfd95e364a239d8036390db658ae.pptx'); const pptStyle = ref({ height: 'calc(100vh - 100px)', width: '100%', margin: 'auto', + background: '#ffffff', }); const renderedHandler = () => { console.warn('渲染完成'); @@ -44,3 +45,9 @@ const [Drawer, drawerApi] = useVbenDrawer({ /> + + diff --git a/packages/effects/common-ui/src/ui/ppt/ppt-work-view.vue b/packages/effects/common-ui/src/ui/ppt/ppt-work-view.vue index 49c806e..a5cfb17 100644 --- a/packages/effects/common-ui/src/ui/ppt/ppt-work-view.vue +++ b/packages/effects/common-ui/src/ui/ppt/ppt-work-view.vue @@ -87,8 +87,8 @@ const startFetching = async () => { // }, // }, // ); - // 保存抓取结果 url - fetchResult.value = '/static/43b7da46a6ca47e5a9d7710d8dcf499c.pptx'; + // 保存抓取结果 url http://47.112.173.8:6802/static/66f3cfd95e364a239d8036390db658ae.pptx + fetchResult.value = '/static/66f3cfd95e364a239d8036390db658ae.pptx'; resultItems.value.push({ key: resultItems.value.length + 1, role: 'ai', diff --git a/packages/effects/common-ui/src/ui/word/word-preview.vue b/packages/effects/common-ui/src/ui/word/word-preview.vue index 62d771e..70f44c2 100644 --- a/packages/effects/common-ui/src/ui/word/word-preview.vue +++ b/packages/effects/common-ui/src/ui/word/word-preview.vue @@ -5,10 +5,10 @@ import { useVbenDrawer } from '@vben/common-ui'; import VueOfficeDocx from '@vue-office/docx'; -// import '@vue-office/pptx/lib/index.css'; +import '@vue-office/docx/lib/index.css'; const url = ref(''); -const docx = ref('/static/9e1c421e-991c-411f-8176-6350a97e70f3.docx'); +const docx = ref('/docx/027c6b7c-fea6-4964-839b-27857c4d3181.docx'); const pptStyle = ref({ height: 'calc(100vh - 100px)', width: '100%', @@ -35,7 +35,7 @@ const [Drawer, drawerApi] = useVbenDrawer({ });