zouyf_dev #102

Merged
zouyf merged 6 commits from zouyf_dev into main 2024-12-10 11:10:57 +08:00
3 changed files with 20 additions and 10 deletions
Showing only changes of commit 2c238b5706 - Show all commits

View File

@ -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 } from 'html-to-image' // html-to-image
const mainStore = useMainStore()
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
@ -199,8 +200,9 @@ const insertImageElement = (files: FileList) => {
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
}
const onhtml2canvas = async (imgbs64: String) => {
createImageElement(imgbs64);
const onhtml2canvas = async (html: HTMLElement) => {
const ele = await toPng(html)
createImageElement(ele);
}
const shapePoolVisible = ref(false)

View File

@ -120,7 +120,6 @@ 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 { toPng } from 'html-to-image' // html-to-image
import { listEntpcoursework, listEntpcourseworkLocal } from '@/api/education/entpCourseWork'
import { listEvaluationclue } from '@/api/classTask'
@ -460,10 +459,15 @@ const handleDelete = async(item, index) => {
const captureScreenshot = (id) => {
const targetElement = document.getElementById('screenshot-target-' + id);
if (targetElement) {
toPng(targetElement).then(canvas => {
emit('addQuizImgBs64', canvas);
});
emit('addQuizImgBs64', targetElement);
}
// html2canvas(targetElement).then(canvas => {
// // canvasURL
// const screenshotUrl = canvas.toDataURL('image/png');
// //
// // console.log(screenshotUrl);
// emit('addQuizImgBs64', screenshotUrl);
// });
}
//

View File

@ -107,7 +107,6 @@
<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'
@ -446,10 +445,15 @@ const getPaginationList = async ( page, limit ) => {
const captureScreenshot = (id) => {
const targetElement = document.getElementById('screenshot-target-' + id);
if (targetElement) {
toPng(targetElement).then(canvas => {
emit('addQuizImgBs64', canvas);
});
emit('addQuizImgBs64', targetElement);
}
// html2canvas(targetElement).then(canvas => {
// // canvasURL
// const screenshotUrl = canvas.toDataURL('image/png');
// //
// // console.log(screenshotUrl);
// emit('addQuizImgBs64', screenshotUrl);
// });
}