Compare commits
No commits in common. "b47feb4a3a999903b7aa7c8dd91a56e4fbf1c6b8" and "755cfc615a007631f1a15b2571c156b03d70f1ce" have entirely different histories.
b47feb4a3a
...
755cfc615a
|
@ -162,6 +162,7 @@ import PopoverMenuItem from '../../../components/PopoverMenuItem.vue'
|
||||||
import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue'
|
import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue'
|
||||||
import MaterialDialog from './MaterialDialog.vue'
|
import MaterialDialog from './MaterialDialog.vue'
|
||||||
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
||||||
|
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
||||||
|
|
||||||
const mainStore = useMainStore()
|
const mainStore = useMainStore()
|
||||||
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
||||||
|
@ -199,8 +200,10 @@ const insertImageElement = (files: FileList) => {
|
||||||
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
|
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
|
||||||
}
|
}
|
||||||
|
|
||||||
const onhtml2canvas = async (imgbs64: String) => {
|
const onhtml2canvas = async (html: HTMLElement) => {
|
||||||
createImageElement(imgbs64);
|
//createImageElement(imgbs64);
|
||||||
|
const ele = await toPng(html)
|
||||||
|
createImageElement(ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
const shapePoolVisible = ref(false)
|
const shapePoolVisible = ref(false)
|
||||||
|
|
|
@ -119,8 +119,7 @@
|
||||||
import { Search } from '@element-plus/icons-vue'
|
import { Search } from '@element-plus/icons-vue'
|
||||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
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 { listEntpcoursework, listEntpcourseworkLocal } from '@/api/education/entpCourseWork'
|
||||||
import { listEvaluationclue } from '@/api/classTask'
|
import { listEvaluationclue } from '@/api/classTask'
|
||||||
|
@ -459,12 +458,14 @@ const handleDelete = async(item, index) => {
|
||||||
*/
|
*/
|
||||||
const captureScreenshot = (id) => {
|
const captureScreenshot = (id) => {
|
||||||
const targetElement = document.getElementById('screenshot-target-' + id);
|
const targetElement = document.getElementById('screenshot-target-' + id);
|
||||||
if (targetElement) {
|
html2canvas(targetElement).then(canvas => {
|
||||||
toPng(targetElement).then(canvas => {
|
// 将canvas转换为图像URL
|
||||||
emit('addQuizImgBs64', canvas);
|
const screenshotUrl = canvas.toDataURL('image/png');
|
||||||
|
// 在这里可以将截图保存到本地或上传到服务器
|
||||||
|
// console.log(screenshotUrl);
|
||||||
|
emit('addQuizImgBs64', screenshotUrl);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 防抖
|
// 防抖
|
||||||
const debounceQueryData = debounce(() => {
|
const debounceQueryData = debounce(() => {
|
||||||
|
|
|
@ -107,7 +107,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Search } from '@element-plus/icons-vue'
|
import { Search } from '@element-plus/icons-vue'
|
||||||
//import html2canvas from 'html2canvas';
|
//import html2canvas from 'html2canvas';
|
||||||
import { toPng } from 'html-to-image' // 引入html-to-image库
|
|
||||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||||
|
|
||||||
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||||
|
@ -446,10 +445,15 @@ const getPaginationList = async ( page, limit ) => {
|
||||||
const captureScreenshot = (id) => {
|
const captureScreenshot = (id) => {
|
||||||
const targetElement = document.getElementById('screenshot-target-' + id);
|
const targetElement = document.getElementById('screenshot-target-' + id);
|
||||||
if (targetElement) {
|
if (targetElement) {
|
||||||
toPng(targetElement).then(canvas => {
|
emit('addQuizImgBs64', targetElement);
|
||||||
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