| | |
| | | <script lang="ts" setup> |
| | | import { ref, reactive, onMounted } from 'vue' |
| | | import draggable from 'vuedraggable' |
| | | |
| | | //引入人脸识别方法 |
| | | import { useFaceDetection } from '@/utils/HaveFace' |
| | | import Vue3DraggableResizable from 'vue3-draggable-resizable' |
| | | import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css' |
| | | import { config } from '@/config/axios/config' |
| | |
| | | const message = useMessage() |
| | | const isEditing = ref(false) |
| | | const inputRef = ref(null) |
| | | //当前是否存在人脸 |
| | | const IsHaveFace = ref(false) |
| | | //当前是否完成ppt人脸校验 |
| | | const IsEndCheckFace = ref(true) |
| | | // 切换到编辑模式 |
| | | const toggleEdit = () => { |
| | | isEditing.value = true |
| | |
| | | } |
| | | return selectPPT.value?.pictureUrl || '' |
| | | }) |
| | | //ppt人脸校验方法 |
| | | const PPtIsHaveFace = async ()=>{ |
| | | IsEndCheckFace.value = false |
| | | //添加ppt中人脸校验 |
| | | //向原始ppt添加数据,用作后续ppt中是否包含人脸的数据校验原始数据 |
| | | const InitPpt = PPTArr.value.map( (item)=>{ |
| | | return item.innerPicture.src |
| | | } ) |
| | | const { detectFacesInImages } = useFaceDetection() |
| | | IsHaveFace.value = await detectFacesInImages(InitPpt) |
| | | IsEndCheckFace.value = true |
| | | } |
| | | // 打开智能讲稿弹窗 |
| | | const openScriptRewriter = () => { |
| | | if (!selectPPT.value?.pptRemark && !currentImageUrl.value) { |
| | |
| | | console.log('selectPPT.value', selectPPT.value) |
| | | showLeftList.value = true |
| | | clearInterval(schedulePPTTimer.value) |
| | | |
| | | //ppt人脸校验 |
| | | PPtIsHaveFace() |
| | | |
| | | //轮询保存课程 |
| | | /** |
| | | * 后端数据库压力过大,暂时停止定时保存 |
| | |
| | | return false |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //人脸校验 |
| | | while(!IsEndCheckFace.value){} //一个空循环,主要为了避免极端情况下当用户点击保存按钮或者视频合成按钮时,人脸校验未完成的问题 |
| | | |
| | | if( IsHaveFace.value ){ |
| | | message.warning('当前ppt中存在人脸元素,为方便后续视频生成,请去除该元素') |
| | | return |
| | | } |
| | | |
| | | |
| | | |
| | | //保存课程 |
| | | let saveSubmitForm = { |
| | | accountId: courseInfo.value.accountId, |
| | |
| | | for (let i = 0; i < PPTArr.value.length; i++) { |
| | | const item = PPTArr.value[i] |
| | | console.log(item) |
| | | console.log( "宽度", item.width ) |
| | | console.log( "高度", item.height ) |
| | | // 校验背景宽高 |
| | | if (!item.width || !item.height) { |
| | | message.warning('背景尺寸无效,请检查宽高设置,或者重新选择模板') |