From 2360d95f1c31da34a830d5f6a5ceb14e8b4390cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Tue, 10 Dec 2024 10:12:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?pptList=E8=AF=95=E9=A2=98=E8=BD=AC=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/Editor/CanvasTool/index.vue | 7 +++++-- .../searchQuestion/index.vue | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue index 6896137..d7de64d 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -162,6 +162,7 @@ import PopoverMenuItem from '../../../components/PopoverMenuItem.vue' import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue' import MaterialDialog from './MaterialDialog.vue' import TextCreateImg from '@/components/ai-kolors/index.vue' +import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库 const mainStore = useMainStore() const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore) @@ -199,8 +200,10 @@ const insertImageElement = (files: FileList) => { getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL)) } -const onhtml2canvas = (imgbs64: string) => { - createImageElement(imgbs64) +const onhtml2canvas = async (html: HTMLElement) => { + //createImageElement(imgbs64); + const ele = await toPng(html) + createImageElement(ele); } const shapePoolVisible = ref(false) diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue index 87f529b..6c418e8 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue @@ -105,7 +105,7 @@