From 59f1f7a0bdc4c95b090c4602eb75f00e0c8046e6 Mon Sep 17 00:00:00 2001
From: 康鲁杰 <60095866+KangLujie@users.noreply.github.com>
Date: 星期二, 22 四月 2025 10:58:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 easegen-front/src/views/chooseTemplate/index.vue |  104 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 71 insertions(+), 33 deletions(-)

diff --git a/easegen-front/src/views/chooseTemplate/index.vue b/easegen-front/src/views/chooseTemplate/index.vue
index 3f565f9..2e7d676 100644
--- a/easegen-front/src/views/chooseTemplate/index.vue
+++ b/easegen-front/src/views/chooseTemplate/index.vue
@@ -630,7 +630,7 @@
 <script lang="ts" setup>
 import { ref, reactive, onMounted } from 'vue'
 import draggable from 'vuedraggable'
-
+import { ElMessage, ElMessageBox } from 'element-plus'
 import Vue3DraggableResizable from 'vue3-draggable-resizable'
 import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'
 import { config } from '@/config/axios/config'
@@ -956,6 +956,7 @@
 const showLeftList = ref(true)
 
 const selectPPT = ref({
+  id:"",
   pictureUrl: '',
   innerPicture: {
     //瀹氫箟鐢讳腑鐢诲璞★紝灞炴�т笌鏁板瓧浜虹浉鍚�
@@ -1187,7 +1188,6 @@
         console.log('PPTArr.value', PPTArr.value)
         PPTArr.value[0].isActive = true
         selectPPT.value = PPTArr.value[0]
-        console.log('selectPPT.value', selectPPT.value)
         showLeftList.value = true
         clearInterval(schedulePPTTimer.value)
         //杞淇濆瓨璇剧▼
@@ -1244,13 +1244,48 @@
   clearInterval(schedulePPTTimer.value)
 }
 const copyDocument = (item, index) => {
-  let copyItem = cloneDeep(item)
-  copyItem.id = generateUUID()
-  copyItem.isActive = false
-  PPTArr.value.splice(index + 1, 0, copyItem)
+  ElMessageBox.confirm(
+    '鏄惁澶嶅埗杩欓〉PPT锛�',
+    '鎻愮ず',
+    {
+      confirmButtonText: '鏄�',
+      cancelButtonText: '鍚�',
+      type: 'warning',
+    }
+  )
+    .then(() => {
+      let copyItem = cloneDeep(item)
+      copyItem.id = generateUUID()
+      copyItem.isActive = false
+      PPTArr.value.splice(index + 1, 0, copyItem)
+    })
+    .catch(() => {
+      ElMessage({
+        type: 'info',
+        message: '宸插彇娑堝鍒�',
+      })
+    })
+
 }
 const deleteDocument = (item) => {
-  PPTArr.value = PPTArr.value.filter((child) => child.id !== item.id)
+  ElMessageBox.confirm(
+    '鏄惁鍒犻櫎杩欓〉PPT锛�',
+    '鎻愮ず',
+    {
+      confirmButtonText: '鏄�',
+      cancelButtonText: '鍚�',
+      type: 'warning',
+    }
+  )
+      .then(() => {
+      PPTArr.value = PPTArr.value.filter((child) => child.id !== item.id)
+      }).catch(() => {
+      ElMessage({
+        type: 'info',
+        message: '宸插彇娑堝垹闄�',
+      })
+  })
+
 }
 const deleteDigitalHuman = () => {
   selectPPT.value.showDigitalHuman = false
@@ -1380,12 +1415,25 @@
     accountId: userId.value
   }
   pptTemplateApi.coursesCreate(params).then((res) => {
-    console.log(res)
     if (res) {
       courseInfo.value.id = res
     }
   })
 }
+
+
+//ppt浜鸿劯鏍¢獙
+const PPtIsHaveFace = async ()=>{
+  //娣诲姞ppt涓汉鑴告牎楠�
+  //鍚戝師濮媝pt娣诲姞鏁版嵁锛岀敤浣滃悗缁璸pt涓槸鍚﹀寘鍚汉鑴哥殑鏁版嵁鏍¢獙鍘熷鏁版嵁
+  const InitPpt = PPTArr.value.map( (item)=>{
+      return item.innerPicture.src
+  } )
+  const { detectFacesInImages } = useFaceDetection()
+  const IsHaveFace = await detectFacesInImages(InitPpt)
+  return IsHaveFace
+}
+
 
 //鑾峰彇淇濆瓨鏃堕棿
 const saveTime = ref()
@@ -1433,7 +1481,6 @@
 
 //浼犲叆 save 鍒欎唬琛ㄤ繚瀛橈紝绌哄瓧绗︿紶鍒欐槸鍚堟垚瑙嗛
 const saveSubmit = async (type) => {
-
   if( type.length === 0 ){
     //姝ゆ椂涓鸿棰戝悎鎴�
     MakeLoading.value = true
@@ -1446,21 +1493,6 @@
   // 妫�鏌ュ満鏅槸鍚︿负绌�
   if (!PPTArr.value || PPTArr.value.length === 0) {
     message.warning('鍦烘櫙涓虹┖锛岃鍏堜笂浼燩PT锛�')
-    //鍏抽棴瑙嗛鍚堟垚涓庝繚瀛樻寜閽殑loading鍔ㄧ敾
-    MakeLoading.value = false
-    SaveLoading.value = false
-    return false
-  }
-
-  //娣诲姞ppt涓汉鑴告牎楠�
-  //鍚戝師濮媝pt娣诲姞鏁版嵁锛岀敤浣滃悗缁璸pt涓槸鍚﹀寘鍚汉鑴哥殑鏁版嵁鏍¢獙鍘熷鏁版嵁
-  const InitPpt = PPTArr.value.map( (item)=>{
-      return item.innerPicture.src
-  } )
-  const { detectFacesInImages } = useFaceDetection()
-  const IsHaveFace = await detectFacesInImages(InitPpt)
-  if( IsHaveFace ){
-    message.warning('褰撳墠ppt涓寘鍚汉鑴稿厓绱�, 涓烘柟渚垮悗缁棰戠敓鎴� ,璇峰幓闄よ鍏冪礌')
     //鍏抽棴瑙嗛鍚堟垚涓庝繚瀛樻寜閽殑loading鍔ㄧ敾
     MakeLoading.value = false
     SaveLoading.value = false
@@ -1520,7 +1552,6 @@
     matting: 1,
     marker: 1
   }
-
   let pageNum = 1
   if (PPTArr.value && PPTArr.value.length > 0) {
     console.log('寮�濮嬪鐞哖PTArr鏁版嵁')
@@ -1536,7 +1567,6 @@
 
         const innerPictureCom = item.innerPicture
         console.log('innerPictureCom:', JSON.stringify(innerPictureCom))
-        console.log(item.pptRemark)
         item.pptRemark = removeHtmlTags(item.pptRemark)
         // item.pptRemark = editorRef.value.getText()
         // item.pptRemark=item.pptRemark.replace(/<[^>]+>/g, '')
@@ -1613,8 +1643,6 @@
       }
     })
   }
-  console.log('pageInfo:', JSON.stringify(pageInfo))
-  console.log('thumbnail:', thumbnail)
 
   try {
     saveSubmitForm.pageInfo = JSON.stringify(pageInfo)
@@ -1627,8 +1655,18 @@
     SaveLoading.value = false
     console.error('淇濆瓨琛ㄥ崟鏁版嵁鏃跺嚭閿�:', error)
   }
-
   if (type == 'save') {
+    //鍙嶆鎬庝箞璧伴兘浼氳蛋save杩欎竴姝ワ紝閭e氨鍙湪杩欎竴姝ヨ繘琛屼竴娆′汉鑴告牎楠岋紝濡傛灉鍚庣画鍚堟垚瑙嗛鎸夐挳涓嶅啀璧颁繚瀛橈紝璇峰皢杩欎竴姝ヤ篃涓�骞惰繘琛屾洿鏀�
+    //涓昏鍥犱负wangEditor杩囦簬鏁忔劅
+    const isHaveFace = await PPtIsHaveFace()
+    if( isHaveFace ){
+      message.warning('褰撳墠ppt涓寘鍚汉鑴稿厓绱�, 涓烘柟渚垮悗缁棰戠敓鎴� ,璇峰幓闄よ鍏冪礌')
+      //鍏抽棴瑙嗛鍚堟垚涓庝繚瀛樻寜閽殑loading鍔ㄧ敾
+      MakeLoading.value = false
+      SaveLoading.value = false
+      return false
+    }
+
     try {
       const res = await pptTemplateApi.coursesSave(stringifySafely(saveSubmitForm))
       if (res) {
@@ -1647,6 +1685,7 @@
       SaveLoading.value = false
       return false
     }
+
   } else {
     // 鍚堟垚瑙嗛鍓嶅厛淇濆瓨
     try {
@@ -1658,12 +1697,10 @@
         SaveLoading.value = false
         return
       }
-
       // 鏍¢獙鍦烘櫙鏁版嵁
       let warningStrArr: any = []
       for (let i = 0; i < PPTArr.value.length; i++) {
         const item = PPTArr.value[i]
-        console.log(item)
         // 鏍¢獙鑳屾櫙瀹介珮
         if (!item.width || !item.height) {
           message.warning('鑳屾櫙灏哄鏃犳晥锛岃妫�鏌ュ楂樿缃紝鎴栬�呴噸鏂伴�夋嫨妯℃澘')
@@ -1690,7 +1727,6 @@
           }
         }
       }
-
       if (warningStrArr.length > 0) {
         warningDialog.value.open(warningStrArr.map((warning) => `<div>${warning}</div>`).join(''))
         //鍏抽棴瑙嗛鍚堟垚涓庝繚瀛樻寜閽殑loading鍔ㄧ敾
@@ -1698,7 +1734,6 @@
         SaveLoading.value = false
         return
       }
-
       // 鍚堟垚瑙嗛
       try {
         const res = await pptTemplateApi.megerMedia(saveSubmitForm)
@@ -1723,7 +1758,9 @@
       message.error('鎿嶄綔澶辫触锛岃閲嶈瘯')
     }
   }
+
 }
+
 function stringifySafely(obj) {
   const seen = new WeakSet()
   return JSON.stringify(obj, (key, value) => {
@@ -1769,6 +1806,7 @@
     }
   }
 }
+
 //瀵屾枃鏈紪杈戝櫒  -start
 // 缂栬緫鍣ㄥ疄渚嬶紝蹇呴』鐢� shallowRef
 const editorRef = shallowRef()

--
Gitblit v1.9.3