From 13889af6b01c60955c4141fd7bbda66fae1d443e Mon Sep 17 00:00:00 2001
From: du <13220750630.163.com>
Date: 星期四, 24 四月 2025 15:22:59 +0800
Subject: [PATCH] 模板一键应用,数字人一键应用

---
 easegen-front/src/views/chooseTemplate/index.vue |  101 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 72 insertions(+), 29 deletions(-)

diff --git a/easegen-front/src/views/chooseTemplate/index.vue b/easegen-front/src/views/chooseTemplate/index.vue
index 27f3fd9..e4764b3 100644
--- a/easegen-front/src/views/chooseTemplate/index.vue
+++ b/easegen-front/src/views/chooseTemplate/index.vue
@@ -541,6 +541,20 @@
         {{ item }}
       </el-tag>
     </el-dialog>
+    <el-dialog v-model="dialogVisible1" title="鎻愮ず" width="500px" style="height: 150px">
+      <p style="margin-bottom: 20px;font-size: 18px">鏄惁瑕佸皢姝ゆā鏉垮簲鐢ㄥ埌鎵�鏈夐〉闈�</p>
+      <span class="dialog-footer">
+        <el-button @click="handleTemplateSelection1(1)">搴旂敤褰撳墠椤�</el-button>
+        <el-button type="primary" @click="handleTemplateSelection1(2)">搴旂敤鎵�鏈夐〉</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog v-model="dialogVisible2" title="鎻愮ず" width="500px" style="height: 150px">
+      <p style="margin-bottom: 20px;font-size: 18px">鏄惁瑕佸皢姝ゆ暟瀛椾汉搴旂敤鍒版墍鏈夐〉闈�</p>
+      <span class="dialog-footer">
+        <el-button @click="chooseHost1(1)">搴旂敤褰撳墠椤�</el-button>
+        <el-button type="primary" @click="chooseHost1(2)">搴旂敤鎵�鏈夐〉</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -598,11 +612,12 @@
 const userStore = useUserStore()
 const userId = computed(() => userStore.user.id)
 const message = useMessage()
-
+const dialogVisible1=ref(false)
+const dialogVisible2=ref(false)
 const isEditing = ref(false)
 const inputRef = ref(null)
 const editName = ref('')
-
+const applyAllHost = ref(false)
 //褰撳墠鏄惁瀛樺湪浜鸿劯
 const IsHaveFace = ref(false)
 //褰撳墠鏄惁瀹屾垚ppt浜鸿劯鏍¢獙
@@ -615,7 +630,34 @@
     inputRef.value.focus()
   })
 }
+const hostValue=ref({})
+const chooseHost = (item) => {
+  dialogVisible2.value = true
+  hostValue.value = item
+}
+const chooseHost1 = (index) => {
+  if (index==1){
+    applyAllHost.value = false
+    applyHostToPages(hostValue.value)
+    dialogVisible2.value = false
+  }else if(index==2){
+    applyAllHost.value = true
+    applyHostToPages(hostValue.value)
+    dialogVisible2.value = false
+  }
+}
+const applyHostToPages = (host) => {
+  hostList.value.forEach((el) => {
+    el.isActive = el.id === host.id
+  })
 
+  const pagesToUpdate = applyAllHost.value ? PPTArr.value : [selectPPT.value]
+
+  pagesToUpdate.forEach(page => {
+    page.digitalHuman.host = host
+    initHumanPositon(host, page.digitalHuman)
+  })
+}
 const saveEdit = () => {
   isEditing.value = false
   courseInfo.value.name = editName.value
@@ -757,25 +799,23 @@
 const showTemplateTool = ref(false)
 const showInnerPictureTool = ref(false)
 const applyAllTemplate = ref(false)
-
+const templateSelection=ref({})
 const handleTemplateSelection = (template) => {
-  ElMessageBox.confirm(
-    '鏄惁瑕佸皢姝ゆā鏉垮簲鐢ㄥ埌鎵�鏈夐〉闈�?',
-    '搴旂敤妯℃澘',
-    {
-      confirmButtonText: '搴旂敤鍒版墍鏈�',
-      cancelButtonText: '浠呭綋鍓嶉〉',
-      type: 'warning',
-    }
-  ).then(() => {
-    // 鐢ㄦ埛鐐瑰嚮"搴旂敤鍒版墍鏈�"
+  dialogVisible1.value=true
+  templateSelection.value=template
+  console.log(templateSelection.value)
+}
+
+const handleTemplateSelection1 = (index) => {
+  if (index==2){
     applyAllTemplate.value = true
-    chooseTemplate(template)
-  }).catch(() => {
-    // 鐢ㄦ埛鐐瑰嚮"浠呭綋鍓嶉〉"鎴栧叧闂璇濇
+    chooseTemplate(templateSelection.value)
+    dialogVisible1.value=false
+  }else if(index==1){
     applyAllTemplate.value = false
-    chooseTemplate(template)
-  })
+    chooseTemplate(templateSelection.value)
+    dialogVisible1.value=false
+  }
 }
 const handleChangeTool = (item) => {
   rightTools.forEach((child) => {
@@ -1188,17 +1228,17 @@
   selectPPT.value = item
 }
 
-const chooseHost = (item) => {
-  hostList.value.forEach((el) => {
-    el.isActive = el.id === item.id
-  })
-
-  // 鍙洿鏂板綋鍓嶉�変腑鐨凱PT椤电殑鏁板瓧浜�
-  if (selectPPT.value) {
-    selectPPT.value.digitalHuman.host = item
-    initHumanPositon(item, selectPPT.value.digitalHuman)
-  }
-}
+// const chooseHost = (item) => {
+//   hostList.value.forEach((el) => {
+//     el.isActive = el.id === item.id
+//   })
+//
+//   // 鍙洿鏂板綋鍓嶉�変腑鐨凱PT椤电殑鏁板瓧浜�
+//   if (selectPPT.value) {
+//     selectPPT.value.digitalHuman.host = item
+//     initHumanPositon(item, selectPPT.value.digitalHuman)
+//   }
+// }
 
 const initHumanPositon = (hostData, digitalHuman) => {
   if (hostData.posture === 1) {
@@ -2352,4 +2392,7 @@
     background-color: #1989fa;
   }
 }
+.dialog-footer{
+  float: right;
+}
 </style>

--
Gitblit v1.9.3