ppt导入-解析过程中增加关闭功能

This commit is contained in:
zdg 2025-02-11 14:30:22 +08:00
parent 6f3ffc45cf
commit 3032e2fb3a
2 changed files with 30 additions and 10 deletions

View File

@ -288,14 +288,17 @@ const createAIPPT = () => {
})
})
}
const isPgDialogClose = ref(false) // --
const pgDialog = ref({ // -
visible: false,
title: 'PPT解析中...',
width: 300,
showClose: false,
showClose: true,
draggable: true,
beforeClose: done => {}, // -
beforeClose: done => { //
isPgDialogClose.value = true
done()
},
pg: { // -
percentage: 0, //
color: [
@ -316,20 +319,26 @@ const openFilePicker = () =>{
const handleFileChange = ()=> {
const file = event.target.files[0];
fileInput.value.value = ''
if (file) {
console.log(file);
createAIPPTByFile(file)
}
}
// pptPPT线
const createAIPPTByFile = async (file)=> {
isPgDialogClose.value = false //
pgDialog.value.visible = true
pgDialog.value.pg.percentage = 0
const closePgDialog = () => {
pgDialog.value.pg.percentage = 0
pgDialog.value.visible = false
}
pptMedia = {} //
const resPptJson = await PPTXFileToJson(file).catch(() => {
ElMessageBox.alert('PPT文件转换失败请点击素材右侧...下载文件后打开另存为PPTX文件格式再进行导入')
pgDialog.value.visible = false
})
if(isPgDialogClose.value) return closePgDialog() // ,
const { def, slides, ...content } = resPptJson
//
const thumbnails = await slidesToImg(slides, content.width)
@ -337,13 +346,13 @@ const createAIPPTByFile = async (file)=> {
let completed = 0
const total = slides.length
for( let o of slides ) {
if(isPgDialogClose.value) return closePgDialog() // ,
completed++
await toRousrceUrl(o)
//
pgDialog.value.pg.percentage = Math.floor(completed / total * 100)
}
pgDialog.value.pg.percentage = 0
pgDialog.value.visible = false
closePgDialog() //
listEntpcourse({
evalid: currentNode.value.id,
edituserid: userStore.userId,

View File

@ -274,13 +274,17 @@ export default {
treelogRef:null,
// Entpcourse
entp: null,
isPgDialogClose: false, //
pgDialog: { // -
visible: false,
title: 'PPT解析中...',
width: 300,
showClose: false,
showClose: true,
draggable: true,
beforeClose: done => {}, // -
beforeClose: done => { //
this.isPgDialogClose = true
done()
},
pg: { // -
percentage: 0, //
color: [
@ -612,6 +616,7 @@ export default {
},
handleFileChange(){
const file = event.target.files[0];
this.$refs.fileInput.value = ''
if (file) {
console.log(file);
console.log('文件名:', file.name);
@ -687,14 +692,20 @@ export default {
}
},
async createAIPPTByFile(file,fileShowName) {
this.isPgDialogClose = false //
this.pgDialog.visible = true
this.pgDialog.pg.percentage = 0
const closePgDialog = () => {
this.pgDialog.pg.percentage = 0
this.pgDialog.visible = false
}
this.pptMedia = {} //
const resPptJson = await PPTXFileToJson(file).catch(() => {
ElMessageBox.alert('PPT文件转换失败请点击素材右侧...下载文件后打开另存为PPTX文件格式再进行导入')
this.pgDialog.visible = false
})
if (!resPptJson) return
if(this.isPgDialogClose) return closePgDialog() // ,
const { def, slides, ...content } = resPptJson
//
const thumbnails = await slidesToImg(slides, content.width)
@ -702,13 +713,13 @@ export default {
let completed = 0
const total = slides.length
for( let o of slides ) {
if(this.isPgDialogClose) return closePgDialog() // ,
completed++
await this.toRousrceUrl(o)
//
this.pgDialog.pg.percentage = Math.floor(completed / total * 100)
}
this.pgDialog.pg.percentage = 0
this.pgDialog.visible = false
closePgDialog() //
listEntpcourse({
evalid: this.currentNode.id,
edituserid: this.userStore.userId,