Compare commits
6 Commits
755cfc615a
...
b47feb4a3a
Author | SHA1 | Date |
---|---|---|
“zouyf” | b47feb4a3a | |
“zouyf” | c79911cc99 | |
baigl | fa776d2a8c | |
白了个白 | 122487cf8b | |
白了个白 | b7f11c5338 | |
白了个白 | c78233a2f4 |
|
@ -162,7 +162,6 @@ 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)
|
||||
|
@ -200,10 +199,8 @@ const insertImageElement = (files: FileList) => {
|
|||
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
|
||||
}
|
||||
|
||||
const onhtml2canvas = async (html: HTMLElement) => {
|
||||
//createImageElement(imgbs64);
|
||||
const ele = await toPng(html)
|
||||
createImageElement(ele);
|
||||
const onhtml2canvas = async (imgbs64: String) => {
|
||||
createImageElement(imgbs64);
|
||||
}
|
||||
|
||||
const shapePoolVisible = ref(false)
|
||||
|
|
|
@ -119,7 +119,8 @@
|
|||
import { Search } from '@element-plus/icons-vue'
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import html2canvas from 'html2canvas';
|
||||
// import html2canvas from 'html2canvas';
|
||||
import { toPng } from 'html-to-image' // 引入html-to-image库
|
||||
|
||||
import { listEntpcoursework, listEntpcourseworkLocal } from '@/api/education/entpCourseWork'
|
||||
import { listEvaluationclue } from '@/api/classTask'
|
||||
|
@ -458,13 +459,11 @@ const handleDelete = async(item, index) => {
|
|||
*/
|
||||
const captureScreenshot = (id) => {
|
||||
const targetElement = document.getElementById('screenshot-target-' + id);
|
||||
html2canvas(targetElement).then(canvas => {
|
||||
// 将canvas转换为图像URL
|
||||
const screenshotUrl = canvas.toDataURL('image/png');
|
||||
// 在这里可以将截图保存到本地或上传到服务器
|
||||
// console.log(screenshotUrl);
|
||||
emit('addQuizImgBs64', screenshotUrl);
|
||||
});
|
||||
if (targetElement) {
|
||||
toPng(targetElement).then(canvas => {
|
||||
emit('addQuizImgBs64', canvas);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 防抖
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
<script setup>
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
//import html2canvas from 'html2canvas';
|
||||
import { toPng } from 'html-to-image' // 引入html-to-image库
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||
|
@ -445,15 +446,10 @@ const getPaginationList = async ( page, limit ) => {
|
|||
const captureScreenshot = (id) => {
|
||||
const targetElement = document.getElementById('screenshot-target-' + id);
|
||||
if (targetElement) {
|
||||
emit('addQuizImgBs64', targetElement);
|
||||
toPng(targetElement).then(canvas => {
|
||||
emit('addQuizImgBs64', canvas);
|
||||
});
|
||||
}
|
||||
// html2canvas(targetElement).then(canvas => {
|
||||
// // 将canvas转换为图像URL
|
||||
// const screenshotUrl = canvas.toDataURL('image/png');
|
||||
// // 在这里可以将截图保存到本地或上传到服务器
|
||||
// // console.log(screenshotUrl);
|
||||
// emit('addQuizImgBs64', screenshotUrl);
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue