瀏覽代碼

调整发布PPT时loading出现是时间,确保在转换HTML之前

cxmo 7 月之前
父節點
當前提交
e1fa386f8a
共有 2 個文件被更改,包括 29 次插入35 次删除
  1. 14 17
      src/views/ppt_manage/newVersion/pptEnPublish.vue
  2. 15 18
      src/views/ppt_manage/newVersion/pptPublish.vue

+ 14 - 17
src/views/ppt_manage/newVersion/pptEnPublish.vue

@@ -143,10 +143,11 @@ export default {
         text: this.$t('Slides.generating_powerPoint_msg'),
       });
       this.isPublish = true
-      if(this.loadingAll){
-        await this.pageToPptx()       
-      } 
-      this.isPublish = false
+      this.$nextTick(()=>{
+            setTimeout(async ()=>{
+                await this.pageToPptx() 
+            },50)
+        })
     },
     async downloadPPT(){
         this.loadingInstance = this.$loading({
@@ -155,8 +156,11 @@ export default {
             text: "生成ppt中...",
         });
         this.isPublish = true
-        await this.pageToPptx('dowload') 
-        this.isPublish = false
+        this.$nextTick(()=>{
+            setTimeout(async ()=>{
+                await this.pageToPptx('dowload') 
+            },50)
+        })
     },
     //计算ppt的版式名称
     getComponentName(modelId){
@@ -294,18 +298,10 @@ export default {
             console.log("img/chart...");
             let svgData = this.optionMap[this.pageList[i].elements[j].chartId] instanceof Object
             if(svgData){
-              if(this.transChartType===1){
-                //将svg传至服务端,返回一个线上图片地址
-                const params = new FormData();
-			          params.append('Img',svgData)
-                const { Data } = await dataBaseInterface.uploadImgSvg(params);
-                imgData = Data.ResourceUrl
-              }else if(this.transChartType===2){
                 //将svgDom转为base64 png,返回一个base64字符串
-                //imgData = await this.changeUrl(`chart_${i}_${elements[j].position}`)
-                //imgData = svg2Base64($(`#chart_${i}_${elements[j].position} svg`)[0])//生成的svg背景色是黑色不是透明
-                imgData = this.setCompression2?svgData2Base64(this.chartSVGDataMap[elements[j].chartId]):await this.changeUrl(`chart_${i}_${elements[j].position}`)
-              }
+                imgData = this.setCompression2
+                         ?svgData2Base64(this.chartSVGDataMap[elements[j].chartId])
+                         :await this.changeUrl(`chart_${i}_${elements[j].position}`)
             }
           } else if (elements[j].type === 'text'){
             console.log('text...')
@@ -431,6 +427,7 @@ export default {
         })
       }
       this.loadingInstance.close();
+      this.isPublish = false
       //结束计时
       const end = Date.now()
       console.log("转换ppt用时:",Math.floor((end-start)/1000),' s')

+ 15 - 18
src/views/ppt_manage/newVersion/pptPublish.vue

@@ -166,20 +166,24 @@ export default {
         text: this.$t('Slides.generating_powerPoint_msg'),
       });
       this.isPublish = true
-      if(this.loadingAll){
-        await this.pageToPptx() 
-      }
-      this.isPublish = false
+      this.$nextTick(()=>{
+            setTimeout(async ()=>{
+                await this.pageToPptx() 
+            },50)
+        })
     },
     async downloadPPT(){
         this.loadingInstance = this.$loading({
             lock:true,
             fullscreen: true,
-            text: "生成ppt中...",
+            text: this.$t('Slides.generating_powerPoint_msg'),
         });
         this.isPublish = true
-        await this.pageToPptx('dowload') 
-        this.isPublish = false
+        this.$nextTick(()=>{
+            setTimeout(async ()=>{
+                await this.pageToPptx('dowload') 
+            },50)
+        })
     },
     //计算ppt的版式名称
     getComponentName(modelId){
@@ -320,18 +324,10 @@ export default {
             console.log("img/chart...");
             let svgData = this.optionMap[this.pageList[i].elements[j].chartId] instanceof Object
             if(svgData){
-              if(this.transChartType===1){
-                //将svg传至服务端,返回一个线上图片地址
-                const params = new FormData();
-			          params.append('Img',svgData)
-                const { Data } = await dataBaseInterface.uploadImgSvg(params);
-                imgData = Data.ResourceUrl
-              }else if(this.transChartType===2){
                 //将svgDom转为base64 png,返回一个base64字符串
-                //imgData = await this.changeUrl(`chart_${i}_${elements[j].position}`)
-                //imgData = svg2Base64($(`#chart_${i}_${elements[j].position} svg`)[0])//生成的svg背景色是黑色不是透明
-                imgData = this.setCompression2?svgData2Base64(this.chartSVGDataMap[elements[j].chartId]):await this.changeUrl(`chart_${i}_${elements[j].position}`)
-              }
+                imgData = this.setCompression2
+                         ?svgData2Base64(this.chartSVGDataMap[elements[j].chartId])
+                         :await this.changeUrl(`chart_${i}_${elements[j].position}`)
             }
           } else if (elements[j].type === 'text'){
             console.log('text...')
@@ -459,6 +455,7 @@ export default {
       }
      
       this.loadingInstance.close();
+      this.isPublish = false
       //结束计时
       const end = Date.now()
       console.log("转换ppt用时:",Math.floor((end-start)/1000),' s')