du
2025-04-24 13889af6b01c60955c4141fd7bbda66fae1d443e
模板一键应用,数字人一键应用
已修改1个文件
101 ■■■■ 文件已修改
easegen-front/src/views/chooseTemplate/index.vue 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
  })
  // 只更新当前选中的PPT页的数字人
  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
//   })
//
//   // 只更新当前选中的PPT页的数字人
//   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>