Jelajahi Sumber

Merge branch 'need-0118'

cxmo 9 bulan lalu
induk
melakukan
ac6b450381

+ 22 - 3
src/views/ppt_manage/newVersion/pptEnPublish.vue

@@ -5,7 +5,9 @@
           <el-radio v-model="transChartType" :label="1">传服务器</el-radio>
           <el-radio v-model="transChartType" :label="2">本地转</el-radio>
         </div> -->
-        <el-dropdown split-button type="primary" @click="transHandle" @command="handleCommand" :disabled="isPublish">
+        <el-button  type="primary" plain style="width:182px;height:40px;" @click="$router.push({path:'/pptenlist'})">返回列表</el-button>
+        <el-button  type="primary" style="width:182px;height:40px;margin-left: 0;" @click="downloadPPT" :disabled="isPublish">下载</el-button>
+        <el-dropdown split-button style="width:182px;height:40px;" type="primary" @click="transHandle" @command="handleCommand" :disabled="isPublish">
           {{layoutStr}}
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item :command="1">10:7</el-dropdown-item>
@@ -13,7 +15,6 @@
             <el-dropdown-item :command="3">4:3</el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
-				<el-button  type="primary" plain style="width:120px;height:40px;" @click="$router.push({path:'/pptenlist'})">返回列表</el-button>
       </div>
       <!--全加载-->
       <template v-if="loadingAll">
@@ -131,6 +132,16 @@ export default {
       } 
       this.isPublish = false
     },
+    async downloadPPT(){
+        this.loadingInstance = this.$loading({
+            lock:true,
+            fullscreen: true,
+            text: "生成ppt中...",
+        });
+        this.isPublish = true
+        await this.pageToPptx('dowload') 
+        this.isPublish = false
+    },
     //计算ppt的版式名称
     getComponentName(modelId){
         return countComponentName(modelId);
@@ -226,7 +237,7 @@ export default {
       this.checkImg(base64Url,'svg')
     },
     //生成pptx
-    async pageToPptx(){
+    async pageToPptx(type){
       //开始计时
       const start = Date.now()
       const SlideMaster = _.cloneDeep(pptSlideMasterEn) 
@@ -441,6 +452,11 @@ export default {
       const end = Date.now()
       console.log("转换ppt用时:",Math.floor((end-start)/1000),' s')
       //pptx2.writeFile({ fileName: "test.pptx" });//本地测试用
+      //直接下载
+      if(type==='dowload'){
+        pptx2.writeFile({ fileName: `${this.coverInfo.page.Title||'unname'}.pptx` });
+        return
+      }
       this.publishLoading = this.$loading({
         fullscreen:true,
         text:"发布中..."
@@ -743,6 +759,9 @@ $titleColor:#333333;
     top:20px;
     right:3%;
     z-index:10;
+    display: flex;
+    flex-direction: column;
+    gap:20px;
   }
   .fixed-wrap{
     position:fixed;

+ 22 - 3
src/views/ppt_manage/newVersion/pptPublish.vue

@@ -6,7 +6,9 @@
           <el-radio v-model="transChartType" :label="1">传服务器</el-radio>
           <el-radio v-model="transChartType" :label="2">本地转</el-radio>
         </div> -->
-        <el-dropdown split-button type="primary" @click="transHandle" @command="handleCommand" :disabled="isPublish">
+        <el-button  type="primary" plain style="width:182px;height:40px;" @click="$router.push({path:'/pptlist'})">返回列表</el-button>
+        <el-button  type="primary" style="width:182px;height:40px;margin-left: 0;" @click="downloadPPT" :disabled="isPublish">下载</el-button>
+        <el-dropdown split-button style="width:182px;height:40px;" type="primary" @click="transHandle" @command="handleCommand" :disabled="isPublish">
           {{layoutStr}}
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item :command="1">10:7</el-dropdown-item>
@@ -14,7 +16,6 @@
             <el-dropdown-item :command="3">4:3</el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
-				<el-button  type="primary" plain style="width:120px;height:40px;" @click="$router.push({path:'/pptlist'})">返回列表</el-button>
       </div>
       <!--全加载-->
       <template v-if="loadingAll">
@@ -153,6 +154,16 @@ export default {
       }
       this.isPublish = false
     },
+    async downloadPPT(){
+        this.loadingInstance = this.$loading({
+            lock:true,
+            fullscreen: true,
+            text: "生成ppt中...",
+        });
+        this.isPublish = true
+        await this.pageToPptx('dowload') 
+        this.isPublish = false
+    },
     //计算ppt的版式名称
     getComponentName(modelId){
         return countComponentName(modelId);
@@ -252,7 +263,7 @@ export default {
       this.checkImg(base64Url,'svg')
     },
     //生成pptx
-    async pageToPptx(){
+    async pageToPptx(type){
       //开始计时
       const start = Date.now()
       const SlideMaster = _.cloneDeep(pptSlideMaster) 
@@ -470,6 +481,11 @@ export default {
       const end = Date.now()
       console.log("转换ppt用时:",Math.floor((end-start)/1000),' s')
       //pptx2.writeFile({ fileName: "test.pptx" });//本地测试用
+      //直接下载
+      if(type==='dowload'){
+        pptx2.writeFile({ fileName: `${this.coverInfo.page.Title||'unname'}.pptx` });
+        return
+      }
       this.publishLoading = this.$loading({
         fullscreen:true,
         text:"发布中..."
@@ -797,6 +813,9 @@ $titleColor:#333333;
     top:20px;
     right:3%;
     z-index:10;
+    display: flex;
+    flex-direction: column;
+    gap:20px;
   }
   .fixed-wrap{
     position:fixed;