cxmo 10 ماه پیش
والد
کامیت
bfe568f026

+ 46 - 0
src/views/ppt_manage/mixins/pptEditorMixins.js

@@ -97,6 +97,52 @@ export default{
         }
         this.$set(this.pageList,this.currentIndex,this.currentItem) 
     },
+    //全局改变标题位置
+    changePositionAll({left,top}){
+        //遍历所有PPT页
+        //替换每一页titleDetail的left top
+        //若width,height没有值,则使用默认的,若有值,则不变
+        const defaultWidth = 900
+        const defaultHeight = 630
+        const defaultWidthPercent = 68
+        const defaultHeightPercent = 7
+        this.pageList.forEach(page=>{
+            const {width='',height='',baseWidth='',baseHeight=''} = page.titleDetail||{}
+            page.titleDetail = {
+                top,left,
+                width:width||defaultWidthPercent,
+                height:height||defaultHeightPercent,
+                baseTop:defaultHeight*top/100,//px单位,基准为编辑页的ppt大小
+                baseLeft:defaultWidth*left/100,
+                baseWidth:baseWidth||defaultWidth*width/100,
+                baseHeight:baseHeight||defaultHeight*height/100
+            }
+        })
+        this.$message.success('全局设置成功')
+    },
+    //全局改变标题宽高
+    changeSizeAll({width,height}){
+        //遍历所有PPT页
+        //替换每一页titleDetail的width height
+        //若left,top没有值,则使用默认的,若有值,则不变
+        const defaultWidth = 900
+        const defaultHeight = 630
+        const defaultLeftPercent = 10
+        const defaultTopPercent = 5.5
+        this.pageList.forEach(page=>{
+            const {top='',left='',baseTop='',baseLeft=''} = page.titleDetail||{}
+            page.titleDetail = {
+                width,height,
+                top:top||defaultTopPercent,
+                left:left||defaultLeftPercent,
+                baseWidth:defaultWidth*width/100,
+                baseHeight:defaultHeight*height/100,
+                baseTop:baseTop||defaultHeight*top/100,
+                baseLeft:baseLeft||defaultWidth*left/100,
+            }
+        })
+        this.$message.success('全局设置成功')
+    },
     //显示切换模板弹窗
     handleChangeFormat(item){
       this.choosedItem = item

+ 1 - 0
src/views/ppt_manage/mixins/virtualScrollMixins.js

@@ -1,3 +1,4 @@
+//已停用 可删除
 /** 图库9.0(智能PPT) 虚拟列表 */
 import Highcharts from "highcharts/highstock"
 export default {

+ 13 - 3
src/views/ppt_manage/newVersion/components/editor/titleEditorTool.vue

@@ -4,12 +4,13 @@
             <el-collapse-item title="位置设置" name="position">
                 <div>
                     <span class="demonstration">上下(%)</span>
-                    <el-slider v-model="detail.top" :max="14"></el-slider>
+                    <el-slider v-model="detail.top" :max="12"></el-slider>
                 </div>
                 <div>
                     <span class="demonstration">左右(%)</span>
                     <el-slider v-model="detail.left"></el-slider>
                 </div>
+                <el-button type="text" @click="changePosition">应用至整个PPT</el-button>
             </el-collapse-item>
             <el-collapse-item title="大小设置" name="size">
                 <div>
@@ -20,6 +21,7 @@
                     <span class="demonstration">高度(%)</span>
                     <el-slider v-model="detail.height" :max="14-detail.top"></el-slider>
                 </div>
+                <el-button type="text" @click="changeSize">应用至整个PPT</el-button>
             </el-collapse-item>
             <el-collapse-item title="内容设置" name="content">
                 <div class="editor-tool"></div>
@@ -52,8 +54,8 @@ export default {
     },
     data() {
         return {
-            activeNames:'',
-            content:'&*^%',
+            activeNames:'content',
+            content:'&*^%', //若设置为空,则init时没有标题就不会触发watch,随便设置几个字符即可
             detail:{
                 left:0,top:0,width:0,height:0,
             },
@@ -95,6 +97,14 @@ export default {
             this.detail = {left,top,width,height}
             this.content = this.currentItem.titleContent
         },
+        changePosition(){
+            const {left,top} = this.detail
+            this.$emit('changePositionAll',{top,left})
+        },
+        changeSize(){
+            const {width,height} = this.detail
+            this.$emit('changeSizeAll',{width,height})
+        }
     },
 };
 </script>

+ 10 - 1
src/views/ppt_manage/newVersion/pptEditor.vue

@@ -251,6 +251,8 @@
                 <TitleEditorTool 
                     ref="titleEditor"
                     :currentItem="currentItem"
+                    @changeSizeAll="changeSizeAll"
+                    @changePositionAll="changePositionAll"
                     @styleChange="handleTitelStyleChange"
                     @textChange="handleTextChange"/>
             </div>
@@ -338,7 +340,7 @@ import InsertCharts from './components/editor/InsertCharts.vue';
 import ContextMenu from './components/ContextMenu.vue';
 import InsertSemantics from './components/editor/InsertSemantics.vue';
 import ChooseCoverNew from './components/editor/ChooseCoverNew.vue';
-import TitleEditorTool from './components/editor/titleEditorTool.vue';
+import TitleEditorTool from './components/editor/TitleEditorTool';
 export default {
   mixins:[pptmixin,//ppt页面共同逻辑
           mixins,//图表加载逻辑
@@ -1629,6 +1631,13 @@ $titleColor:#333333;
                 }
               }
             }
+            .title-edit-box{
+                p{
+                    font-size: 16px;
+                    font-weight: bold;
+                    margin-top:16px;
+                }
+            }
        }
     }
 }

+ 2 - 2
src/views/ppt_manage/newVersion/pptEnPublish.vue

@@ -263,7 +263,7 @@ export default {
       let pptx = pptConfigInit(new pptxgen(),this.LayoutType,'en',SlideMaster,this.pptBgImage)
       //添加封面
       let cover = pptx.addSlide()
-      let coverId = this.loadingAll?'cover':'changecover'
+      let coverId = 'cover'
       //let coverImg = await this.htmlToCanvans(coverId)
       let coverImg = $(`#${coverId} .cover img`)[0].src
       cover.addImage({
@@ -401,7 +401,7 @@ export default {
       //添加封底 如果有
       if(this.pptBackImage.length){
         let back = pptx.addSlide()
-        let backId = this.loadingAll?'back':'changeback'
+        let backId = 'back'
         let backImg = $(`#${backId} img`)[0].src
         back.addImage({
             path: backImg,

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

@@ -91,7 +91,6 @@ import {countComponentName,pptConfigInit,toTextProps,toJson,svg2Base64,svgData2B
 import {marginTop,modelConfig,pptSlideMaster} from './utils/config';
 import pptmixin from '../mixins/pptMixins';
 import mixins from '../mixins/mixins';
-import virtualScroll from '../mixins/virtualScrollMixins'
 import html2canvas from 'html2canvas';
 import pptxgen from "pptxgenjs";
 import moment from 'moment';
@@ -105,7 +104,7 @@ HightchartsExport(Highcharts)
 HighchartszhCN(Highcharts)
 export default {
   components: {Cover,TransReport,CustomCover},
-  mixins:[pptmixin,mixins,virtualScroll],
+  mixins:[pptmixin,mixins],
   data() {
     return {
         coverInfo:{
@@ -228,11 +227,7 @@ export default {
 
         this.dataLoading.close();
         $('.ppt-item').css('background-image',`url(${this.pptBgImage})`);
-      }else{
-        await this.getpptData();
-        this.initVirtualScroll()
       }
-      //console.log($('#back img')[0].src)
     },
     async getpptData(){
       const {id} = this.$route.query
@@ -302,7 +297,7 @@ export default {
       let pptx = pptConfigInit(new pptxgen(),this.LayoutType,'ch',SlideMaster,this.pptBgImage)
       //添加封面
       let cover = pptx.addSlide()
-      let coverId = this.loadingAll?'cover':'changecover'
+      let coverId = 'cover'
       let coverImg = $(`#${coverId} .cover img`)[0].src
       cover.addImage({
         path: coverImg,
@@ -446,7 +441,7 @@ export default {
       //添加封底 如果有
       if(this.pptBackImage.length){
         let back = pptx.addSlide()
-        let backId = this.loadingAll?'back':'changeback'
+        let backId = 'back'
         let backImg = $(`#${backId} img`)[0].src
         back.addImage({
             path: backImg,