Compare commits

...

6 Commits

Author SHA1 Message Date
“zouyf” b47feb4a3a 1 2024-12-10 10:46:22 +08:00
“zouyf” c79911cc99 Merge branch 'main' into zouyf_dev 2024-12-10 10:40:07 +08:00
baigl fa776d2a8c Merge pull request 'baigl' (#100) from baigl into main
Reviewed-on: #100
2024-12-10 10:26:52 +08:00
白了个白 122487cf8b ppts习题插入:个人题库 习题截图放到ppts里面转换 2024-12-10 10:24:30 +08:00
白了个白 b7f11c5338 Merge branch 'zouyf_dev' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into baigl 2024-12-10 10:19:06 +08:00
白了个白 c78233a2f4 1 2024-12-10 10:16:07 +08:00
3 changed files with 13 additions and 21 deletions

View File

@ -162,7 +162,6 @@ 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)
@ -200,10 +199,8 @@ const insertImageElement = (files: FileList) => {
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL)) getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
} }
const onhtml2canvas = async (html: HTMLElement) => { const onhtml2canvas = async (imgbs64: String) => {
//createImageElement(imgbs64); createImageElement(imgbs64);
const ele = await toPng(html)
createImageElement(ele);
} }
const shapePoolVisible = ref(false) const shapePoolVisible = ref(false)

View File

@ -119,7 +119,8 @@
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'
@ -458,13 +459,11 @@ 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);
html2canvas(targetElement).then(canvas => { if (targetElement) {
// canvasURL toPng(targetElement).then(canvas => {
const screenshotUrl = canvas.toDataURL('image/png'); emit('addQuizImgBs64', canvas);
// });
// console.log(screenshotUrl); }
emit('addQuizImgBs64', screenshotUrl);
});
} }
// //

View File

@ -107,6 +107,7 @@
<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'
@ -445,15 +446,10 @@ 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) {
emit('addQuizImgBs64', targetElement); toPng(targetElement).then(canvas => {
emit('addQuizImgBs64', canvas);
});
} }
// html2canvas(targetElement).then(canvas => {
// // canvasURL
// const screenshotUrl = canvas.toDataURL('image/png');
// //
// // console.log(screenshotUrl);
// emit('addQuizImgBs64', screenshotUrl);
// });
} }