diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts index c27f0d8..aa255d2 100644 --- a/src/renderer/src/AixPPTist/src/api/index.ts +++ b/src/renderer/src/AixPPTist/src/api/index.ts @@ -11,10 +11,15 @@ import * as API_smarttalk from '@/api/file' // 相关api import * as useStore from '../store' // pptist-状态管理 import { sessionStore } from '@/utils/store' // electron-store 状态管理 import useUserStore from '@/store/modules/user' // 外部-用户信息 - +import * as Api_server from '@/api/apiService' // 相关api +import * as commUtils from '@/utils/comm.js' const slidesStore = useStore.useSlidesStore() const userStore = useUserStore() +import { getClassWorkList,getStudentClassWorkData } from '@/views/tool/createHomework' +import {createWindow} from '@/utils/tool' +import { useToolState } from '@/store/modules/tool' +const toolStore = useToolState() /** 工具类 */ export class Utils { static mxData: any = { @@ -186,6 +191,30 @@ export class PPTApi { else msgUtils.msgError(res.msg || '更新失败');return false }) } + + // 图片|音频|视频 转换为在线地址 + static toRousrceUrl =async (o:any) => { + const formData = new FormData() + formData.append('file', o) + const res = await Api_server.Other.uploadFile(formData) + if (res && res.code == 200){ + const url = res?.url + url &&(o.src = url) + return url + } + +} } +export class Homework{ + // 作业弹窗 + static async showHomework(id: any) { + let result = await getClassWorkList(id) +   result = await getStudentClassWorkData() +   localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0])); +   toolStore.isTaskWin=true; // 设置打开批改窗口 + //   emit('closeActive') +   createWindow('open-taskwin',{url:'/teachClassTask'}); + } +} export default PPTApi \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MediaInput.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MediaInput.vue index 371447a..c08635b 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MediaInput.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MediaInput.vue @@ -7,19 +7,44 @@ /> @@ -30,6 +55,8 @@ import message from '../../../utils/message' import Tabs from '../../../components/Tabs.vue' import Input from '../../../components/Input.vue' import Button from '../../../components/Button.vue' +import FileInput from '../../../components/FileInput.vue' +import { PPTApi } from '../../../api' type TypeKey = 'video' | 'audio' interface TabItem { @@ -45,9 +72,33 @@ const emit = defineEmits<{ const type = ref('video') -const videoSrc = ref('https://mazwai.com/videvo_files/video/free/2019-01/small_watermarked/181004_04_Dolphins-Whale_06_preview.webm') -const audioSrc = ref('https://freesound.org/data/previews/614/614107_11861866-lq.mp3') +const videoSrc = ref('') +const audioSrc = ref('') +// https://freesound.org/data/previews/614/614107_11861866-lq.mp3 +const tabvalue = ref('0') +const tabvalue1 = ref('0') +const insertImageElementvideo = (files: FileList) => { + console.log('files', files) + const imageFile = files[0] + if (!imageFile) return + PPTApi.toRousrceUrl(imageFile).then(data=>{ + videoSrc.value=data + insertVideo() + }) + +} + +const insertImageElementaudio = (files: FileList) => { + console.log('files', files) + const imageFile = files[0] + if (!imageFile) return + PPTApi.toRousrceUrl(imageFile).then(data=>{ + videoSrc.value=data + insertAudio() + }) + +} const tabs: TabItem[] = [ { key: 'video', label: '视频' }, { key: 'audio', label: '音频' }, @@ -74,4 +125,33 @@ const insertAudio = () => { margin-top: 10px; text-align: right; } +.updivs{ + width: 100%; + height: 100%; + background: #f5f7fa; + border: 1px dashed #d9d9d9; + border-radius: 6px; + text-align: center; + line-height: 100px; + cursor: pointer; +} +.demo-tabs{ + :deep(.el-tabs__content){ + display: flex; + align-items: center; + div{ + width: 100%; + } + } + :deep( .el-tabs__item.is-active) { + color: #d14424; + } + :deep( .el-tabs__item:hover) { + color: #d14424; + } +:deep(.el-tabs__active-bar) { + background-color: #d14424; + height: 3px; +} +} 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..879865f 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -161,7 +161,9 @@ import Popover from '../../../components/Popover.vue' import PopoverMenuItem from '../../../components/PopoverMenuItem.vue' import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue' import MaterialDialog from './MaterialDialog.vue' +import { PPTApi } from '../../../api' 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) @@ -194,13 +196,21 @@ const { } = useCreateElement() const insertImageElement = (files: FileList) => { + console.log('files', files) const imageFile = files[0] if (!imageFile) return - getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL)) + // 上传图片转为线上地址 + PPTApi.toRousrceUrl(imageFile).then(data=>{ + createImageElement(data) + }) + // getImageDataURL(imageFile).then(dataURL => { + // createImageElement(dataURL) + // }) } -const onhtml2canvas = (imgbs64: string) => { - createImageElement(imgbs64) +const onhtml2canvas = async (html: HTMLElement) => { + const ele = await toPng(html); + createImageElement(ele); } const shapePoolVisible = ref(false) diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index 0496bee..218f71c 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -949,11 +949,11 @@ const showExamAnalyseDrawer = (row) => { } const tableRef = ref(); -const getPaginationList = ( page, limit ) => { +const getPaginationList = async ( page, limit ) => { paginationParams.pageNum = page; paginationParams.pageSize = limit; //console.log(page, limit) - handleQueryFromEntpCourseWork(0); + await handleQueryFromEntpCourseWork(0); // 重置滚动条至顶部 tableRef.value.setScrollTop(0); } diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue index 2495908..54118ca 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/myQuestion/index.vue @@ -49,6 +49,7 @@ :data="workResource.entpCourseWorkList" style="width: 100%; height: calc(100% - 55px);" v-loading="pageParams.loading" + ref="tableRef" > @@ -118,7 +119,7 @@ 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 { listEntpcoursework, listEntpcourseworkLocal } from '@/api/education/entpCourseWork' import { listEvaluationclue } from '@/api/classTask' @@ -364,11 +365,15 @@ const showExamAnalyseDrawer = (row) => { proxy.$refs.examDetailsDrawerRef.acceptParams(activeParams); }) } -const getPaginationList = ( page, limit ) => { + +const tableRef = ref(); +const getPaginationList = async ( page, limit ) => { paginationParams.pageNum = page; paginationParams.pageSize = limit; console.log(page, limit) - handleQueryFromEntpCourseWork(0); + await handleQueryFromEntpCourseWork(0); + // 重置滚动条至顶部 + tableRef.value.setScrollTop(0); } /** 单题上传弹出框----纠错修改框 */ @@ -453,13 +458,16 @@ 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) { + emit('addQuizImgBs64', targetElement); + } + // html2canvas(targetElement).then(canvas => { + // // 将canvas转换为图像URL + // const screenshotUrl = canvas.toDataURL('image/png'); + // // 在这里可以将截图保存到本地或上传到服务器 + // // console.log(screenshotUrl); + // emit('addQuizImgBs64', screenshotUrl); + // }); } // 防抖 diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue index 87f529b..9cf6b7e 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/searchQuestion/index.vue @@ -62,6 +62,7 @@ :data="workResource.entpCourseWorkList" style="width: 100%; height: calc(100% - 50px);" v-loading="pageParams.loading" + ref="tableRef" > @@ -105,7 +106,7 @@