Browse Source

自定义封面页基本操作,文本框配置

cxmo 1 year ago
parent
commit
a4577a20a1

+ 2 - 1
src/views/ppt_manage/mixins/layerMixins.js

@@ -54,9 +54,10 @@ export default {
       }
       //计算图层元素的百分比化的单位:基于.total-wrap而不是基于ppt-item
       const width = $('.total-wrap').width(),height = $('.total-wrap').height()
+      this.activeLayerEl = {...this.activeLayerEl,...options}
       const percentageShape = caclShapePercentage({layerWidth:width,layerHeight:height},this.activeLayerEl)
-      this.activeLayerEl = {...this.activeLayerEl,...percentageShape,...options}
       this.activeLayerEl.id = createRandomCode()
+      this.activeLayerEl = {...this.activeLayerEl,...percentageShape}
       layerEls.push(this.activeLayerEl)
       this.refleshLayerEl(layerEls)
     },

+ 35 - 4
src/views/ppt_manage/newVersion/components/CoverNew.vue

@@ -1,23 +1,54 @@
 <template>
     <!-- 自定义封面页渲染 -->
     <div class="cover-new-wrap">
-
+        <!-- 封面图 -->
+        <img :src="pageInfo.BackgroundImg" class="cover-img" style="object-fit: fill !important;">
+        <TextEl v-for="el in coverList" :key="el.id"
+            :element-info="el"
+            :isCoverEdit="false"
+            :isActive="false"
+        />
     </div>
 </template>
 
 <script>
+import TextEl from './editor/chooseCover/TextEl.vue';
+
 export default {
+    props: {
+        pageInfo: {
+            type: Object
+        },
+        CoverContent: {
+            type: String,
+            default: ''
+        }
+    },
     data() {
         return {
-
+            coverList: [{ "id": 1234, "type": "text", "left": 624, "top": 433, "width": 227, "height": 84, "fontSize": 12, "content": "请输入内容", "richContent": "<p><span style=\"font-size: 48px;\">😔😄😔</span></p>", "realWidth": 227, "realHeight": 84, "percentageLeft": 0.6446280991735537, "percentageTop": 0.6390200708382527, "percentageWidth": 0.23450413223140495, "percentageHeight": 0.12396694214876035 }, { "id": 5678, "type": "text", "left": 571, "top": 313, "width": 352, "height": 96, "fontSize": 12, "content": "请输入内容", "richContent": "<p><span style=\"color: #ecf0f1; font-size: 24px;\">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈</span></p>", "realWidth": 352, "realHeight": 96, "percentageLeft": 0.5898760330578512, "percentageTop": 0.4619244391971665, "percentageWidth": 0.36363636363636365, "percentageHeight": 0.14167650531286896 }],
         };
     },
     methods: {
-
+        setCoverContent() {
+            //this.coverList = JSON.parse(this.CoverContent);
+        }
+    },
+    mounted() {
+        this.setCoverContent();
     },
+    components: { TextEl }
 };
 </script>
 
 <style scoped lang="scss">
-
+.cover-new-wrap{
+    width:100%;
+    height:100%;
+    position:relative;
+    .cover-img{
+        width: 100%;
+        height: 100%;
+    }
+}
 </style>

+ 6 - 2
src/views/ppt_manage/newVersion/components/catalog/pptContent.vue

@@ -4,7 +4,10 @@
     <div class="ppt-scroll">
       <template  v-for="(item,index) in loadArr">
           <div class="ppt-item" id="cover" v-if="index===0" :key="item.id">
-            <Cover :pageInfo="firstPage" v-show="firstPage"></Cover>
+            <!-- <Cover :pageInfo="firstPage" v-show="firstPage"></Cover> -->
+            <CoverNew v-show="firstPage"
+                :pageInfo="firstPage"
+            />
             <!-- <div class="ppt-info">
               <p>作者:{{pptItem.AdminRealName}}</p>
               <p>{{pptItem.PptxUrl?'发布':'保存'}}时间:{{$moment(pptTime).format('YYYY-MM-DD')}}</p>
@@ -54,6 +57,7 @@ import Highcharts from "highcharts/highstock";
 import HighchartszhCN  from '@/utils/highcahrts-zh_CN'
 HighchartszhCN(Highcharts)
 import addMyClassifyDia from '@/views/dataEntry_manage/components/addMyClassifyDia';
+import CoverNew from '../CoverNew.vue';
 export default {
   props:{
     pptItem:{ //ppt信息
@@ -61,7 +65,7 @@ export default {
     }
   },
   mixins:[pptmixin,mixins],
-  components:{Cover,addMyClassifyDia},
+  components:{ Cover, addMyClassifyDia, CoverNew },
   data() {
     return {
         pageList:[],//ppt数组

+ 141 - 18
src/views/ppt_manage/newVersion/components/editor/ChooseCoverNew.vue

@@ -9,17 +9,39 @@
         v-dialogDrag center width="80%" top="5vh"
         @close="$emit('close')"
     >
-        <div class="container">
+        <div class="container" @mousedown.stop="clickOutside">
             <div class="edit-cover-wrap">
                 <div class="cover">
-                    <div class="editor-area">
-
+                    <!-- 封面图 -->
+                    <div class="editor-area" :style="`background-image:url(${pptCoverList[choosedIndex]});`">
+                        <!-- 封面内文本元素 -->
+                        <TextEl v-for="el in coverElList" :key="el.id"
+                            :element-info="el"
+                            :isCoverEdit="true"
+                            :isActive="el.id===activeEl.id"
+                            @click.stop.native="changeActEl(el)"
+                            @deleteEl="deleteEl"
+                            @copyEl="getCopyEl"
+                        />
                     </div>
                 </div>
                 <div class="editor-tool">
+                    <div class="title-box">
+                        <p>PPT标题</p>
+                        <el-input v-model="pageData.Title"
+                            placeholder="请输入PPT标题" style="width:100%;"></el-input>
+                    </div>
+                    <div class="el-box">
+                        <p @click.stop="addTextEl">插入文本<span>icon</span></p>
+                    </div>
+                    <div class="el-tool-box">
+                        <p>文本设置</p>
+                        <div class="cover-text-toolbar"></div>
+                        <!-- <p v-if="!isActiveEl">请选择文本元素</p> -->
+                    </div>
                     <div class="dialog-btn">
-                        <el-button>保存</el-button>
-                        <el-button>换一个模板</el-button>
+                        <el-button @click="saveCover">保存</el-button>
+                        <el-button @click="changeBg">换一个模板</el-button>
                     </div>
                 </div>
             </div>
@@ -30,29 +52,121 @@
 </template>
 
 <script>
+import TextEl from './chooseCover/TextEl.vue';
+import { BaseTextShape } from '@/views/ppt_manage/newVersion/utils/config';
+import {createRandomCode,caclShapePercentage} from "@/views/ppt_manage/newVersion/utils/untils";
+import {pptInterface} from '@/api/api.js';
 export default {
-    props:{
-        isShowChooseCover:{
-            type:Boolean,
-            default:false
+    props: {
+        isShowChooseCover: {
+            type: Boolean,
+            default: false
+        },
+        firstPage: {
+            type: Object,
+            default: {}
         },
-        firstPage:{
-            type:Object,
-            default:{}
+        pptCoverList: {
+            type: Array,
+            default: []
         },
-        pptCoverList:{
-            type:Array,
-            default:[]
+        CoverContent: {
+            type: String,
+            default: ''
         }
     },
     data() {
         return {
-
+            coverElList: [],
+            activeEl:{},
+            copyEl:{},
+            pageData:{Title:''},
+            searchIndex:0,
+            choosedIndex:0
         };
     },
     methods: {
+        setCoverInfo() {
+            this.searchIndex = this.pptCoverList.findIndex(i=>i===this.firstPage.BackgroundImg)
+            if(this.searchIndex===-1){
+                this.pageData.BackgroundImg = this.bgList[0]
+            }
+            this.coverElList = JSON.parse(this.CoverContent);
+        },
+        saveCover() {
+            //校验
+            if(!this.pageData.Title.length){
+                return this.$message.warning("请输入PPT标题")
+            }
+            /* if(!this.coverElList.length){
 
+            } */
+            const coverContent = JSON.stringify(this.coverElList);
+            pptInterface.pptTitleCheck({PptId:this.$route.query.id || this.PptId ||0,Title:this.pageData.Title}).then(res=>{
+                if(res.Ret == 200){
+                    this.$emit('saveCover', {
+                        firstPage:Object.assign(this.firstPage,this.pageData),
+                        content:coverContent
+                    });
+                }
+            })
+            //this.$emit('saveCover', coverContent);
+        },
+        changeActEl(el){
+            this.activeEl = el
+        },
+        clickOutside(){
+            this.changeActEl({})
+        },
+        changeBg(){
+            if(this.choosedIndex<this.pptCoverList.length-1){
+                this.choosedIndex++
+            }else{
+                this.choosedIndex=0
+            }
+            this.pageData.BackgroundImg = this.pptCoverList[this.choosedIndex]
+        },
+        addTextEl(options={}){
+            let el = _.cloneDeep(BaseTextShape)
+            el = {...el,...options}
+            const areaWidth = $(".editor-area").width()||0
+            const areaHeight = areaWidth*0.7
+            const percentageShape = caclShapePercentage({layerWidth:areaWidth,layerHeight:areaHeight},this.activeEl)
+            el = {...el,...percentageShape,...options}
+            el.id = createRandomCode()
+            this.coverElList.push(el)
+            this.changeActEl(el)
+        },
+        deleteEl(el){
+            this.changeActEl({})
+            const index = this.coverElList.findIndex(e=>e.id===el.id)
+            index!==-1&&(this.coverElList.splice(index,1))
+        },
+        getCopyEl(el){
+            this.copyEl = el
+            this.pasteEl("copy")
+        },
+        pasteEl(type="copy"){
+            const {width,height,left,top} = this.copyEl
+            const areaWidth = $(".editor-area").width()||0
+            const areaHeight = areaWidth*0.7
+            //在原先元素右下方渲染新元素
+            const points = {clientX:left+10,clientY:top+10}
+            const supplyValue = type==='copy'?10:0 //补值,防止渲染出边界
+            const new_left = ((points.clientX+width) - areaWidth)>0?(areaWidth - width - supplyValue):points.clientX
+            const new_top =  ((points.clientY+height) - areaHeight)>0?(areaHeight - height - supplyValue):points.clientY
+            const options = {...this.copyEl,...{
+                left:new_left,
+                top:new_top,
+                width,
+                height,
+                realWidth:width,
+                realHeight:height
+            }}
+            this.addTextEl(options)
+        },
     },
+    components: { TextEl }
 };
 </script>
 
@@ -87,21 +201,30 @@ export default {
                 overflow-y: auto;
             }
             .cover{
+                min-width: 640px;
                 flex:1;
-                background-color: rebeccapurple;
+                background-color: #C8CDD9;
                 display: flex;
                 align-items: center;
+                box-sizing: border-box;
+                border:1px solid #C8CDD9;
+                border-radius: 4px;
+                padding:10px;
                 .editor-area{
                     position: relative;
                     width:100%;
                     height: 0;
                     padding-bottom: 70%;
                     background-color:bisque;
+                    background-repeat: no-repeat;
+                    background-position: center;
+                    background-size: 100% 100%;
                 }
             }
             .editor-tool{
                 min-width:320px;
-                background-color: burlywood;
+                padding-left:20px;
+                /* background-color: burlywood; */
             }
         }
         .dialog-btn{

+ 184 - 15
src/views/ppt_manage/newVersion/components/editor/chooseCover/TextEl.vue

@@ -1,23 +1,192 @@
 <template>
-    <!-- 自定义封面-文本编辑框 -->
-    <div class="cover-el el-text">
-
+    <!-- 自定义封面 文本编辑框 -->
+    <div class="cover-el el-text" :id="`cover-el-${elementInfo.id}`" :style="isCoverEdit?{
+        top: elementInfo.top + 'px',
+        left: elementInfo.left + 'px',
+        width: elementInfo.width + 'px',
+        height: elementInfo.height + 'px',
+      }:{
+        top: elementInfo.percentageTop*100 + '%',
+        left: elementInfo.percentageLeft*100 + '%',
+        width: elementInfo.percentageWidth*100 + '%',
+        height: elementInfo.percentageHeight*100 + '%',
+        pointerEvents:'none'
+      }" 
+      @mousedown.stop="(e)=>{handleMoveStart(e,'move')}" @contextmenu.stop="showContentMenu">
+        <!-- 裹一层,方便拖拽和移动 -->
+        <div class="layer-editor-wrap">
+            <div style="width:100%;height:100%;" :id="`${elementInfo.id}-editorDom`" @mousedown.stop>
+                <template v-if="isCoverEdit">
+                    <Editor v-model="elementInfo.richContent" :init="setting" ref="editor"></Editor>
+                </template>
+                <template v-else>
+                    <div class="editor-content" :style="{width:elementInfo.width+'px'}"
+                        v-html="elementInfo.richContent"></div>
+                </template>
+            </div>
+        </div>
+        <div class="borderline" v-if="isActive">
+            <div class="left-1 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'LEFT_TOP')}"></div>
+            <div class="left-2 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'LEFT')}"></div>
+            <div class="left-3 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'LEFT_BOTTOM')}"></div>
+            <div class="line-middle-1 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'TOP')}"></div>
+            <div class="line-middle-2 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'BOTTOM')}"></div>
+            <div class="right-1 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'RIGHT_TOP')}"></div>
+            <div class="right-2 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'RIGHT')}"></div>
+            <div class="right-3 resize-handle" @mousedown.stop="(e)=>{handleScaleStart(e,'RIGHT_BOTTOM')}"></div>
+        </div>
+        <!-- 自定义右键菜单 -->
+        <ContextMenu :menu="contextmenus" :menuId="elementInfo.id" @deleteShape="handleDeleteLayer"
+            @copyShape="handleCopyShape" />
     </div>
 </template>
 
 <script>
-export default {
-    data() {
-        return {
-
-        };
-    },
-    methods: {
-
-    },
-};
+    import {
+        BaseTextShape
+    } from '@/views/ppt_manage/newVersion/utils/config';
+    import elMixin from './elMixin';
+    import Editor from "@tinymce/tinymce-vue";
+    import "tinymce/themes/silver";
+    import "tinymce/plugins/lists"; //列表插件
+    import "tinymce/plugins/quickbars"; //快速栏插件
+    import "tinymce/plugins/fullscreen"; //全屏插件
+    import "tinymce/plugins/paste"; //黏贴插件
+    import "tinymce/icons/default/icons";
+    export default {
+        mixins: [elMixin],
+        props: {
+            elementInfo: {
+                type: Object,
+                default: () => {
+                    return BaseTextShape
+                }
+            },
+            isCoverEdit:{
+                type:Boolean,
+                default:false,
+            },
+            isActive:{
+                type:Boolean,
+                default:false
+            }
+        },
+        components: {
+            Editor
+        },
+        data() {
+            return {
+                setting: {
+                    language: "zh_CN",
+                    language_url: require("../../../utils/zh_CN.js"),
+                    menubar: false,
+                    toolbar: [
+                        "indent outdent alignleft aligncenter alignright alignjustify forecolor",
+                        "bold italic underline strikethrough numlist bullist backcolor",
+                        "fontselect fontsizeselect",
+                    ],
+                    quickbars_selection_toolbar: false,
+                    quickbars_insert_toolbar: false,
+                    plugins: "lists quickbars paste",
+                    height: 350,
+                    inline: true,
+                    selector: `#${this.elementInfo.id}-editorDom`,
+                    paste_as_text: true,
+                    fontsize_formats: '12px 14px 16px 18px 20px 22px 24px 36px 48px',
+                    font_formats: `微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';
+                        楷体='楷体';隶书='隶书';幼圆='幼圆';Andale Mono=andale mono,times;
+                        Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;
+                        Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;
+                        Courier New=courier new,courier;Georgia=georgia,palatino;
+                        Helvetica=helvetica;Impact=impact,chicago;
+                        Webdings=webdings;Wingdings=wingdings`,
+                    fixed_toolbar_container: ".cover-text-toolbar", //将toolbar放到指定div上
+                    skin_url: "/static/css",
+                    content_url: "/static/css",
+                    //加placeholder
+                    placeholder: "点击输入文本内容"
+                }
+            };
+        },
+        methods: {
+            
+        },
+    };
 </script>
+<style lang="scss">
+    .cover-el {
+        .layer-editor-wrap {
+            .editor-content {
+                ul {
+                    margin-left: 1em;
+                    list-style-type: disc;
+                }
 
-<style scoped lang="scss">
-
+                ol {
+                    margin-left: 1em;
+                    list-style-type: decimal;
+                }
+            }
+        }
+    }
 </style>
+<style scoped lang="scss">
+    .cover-el {
+        position: absolute;
+        .layer-editor-wrap {
+            z-index: 2;
+            width: 100%;
+            height: 100%;
+            padding: 10px;
+            box-sizing: border-box;
+            position: relative;
+            >div {
+                cursor: pointer;
+            }
+            .editor-content {
+                padding: 10px;
+                font-size: 16px;
+                position: absolute;
+                transform-origin: 0 0;
+                word-wrap: break-word;
+            }
+            .mce-content-body{
+                padding: 0 !important;
+            }
+            .mce-content-body:not([dir=rtl])[data-mce-placeholder]:not(.mce-visualblocks)::before {
+                left: 0px !important;
+            }
+        }
+        cursor:move;
+        .borderline{
+          z-index: 1;
+          position:absolute;
+          left:0;
+          right:0;
+          top:0;
+          bottom: 0;
+          border: 1px dashed black;
+          &.line{
+            border:none;
+          }
+          .resize-handle{
+            position:absolute;
+            margin: -5px;
+            width:10px;
+            height:10px;
+            border: 1px solid #6324d1;
+            box-sizing: content-box;
+            background-color: #fff;
+            &.left-1,&.left-2,&.left-3{left:0;}
+            &.left-1,&.right-1,&.line-middle-1{top:0;}
+            &.left-2,&.right-2{top:calc(50% + 5px);transform: translateY(-50%);}
+            &.left-3,&.right-3,&.line-middle-2{bottom:0;}
+            &.right-1,&.right-2,&.right-3{right:0;}
+            &.left-1,&.right-3,&.end,&.start{cursor: nwse-resize;}
+            &.left-2,&.right-2{cursor: ew-resize;}
+            &.left-3,&.right-1{cursor: nesw-resize;}
+            &.line-middle-1,&.line-middle-2{left:calc(50% + 5px);transform: translateX(-50%);cursor: ns-resize;}
+          }
+        }
+    }
+</style>

+ 204 - 0
src/views/ppt_manage/newVersion/components/editor/chooseCover/elMixin.js

@@ -0,0 +1,204 @@
+import{getBoundary,getLineScaleInfo,caclShapePercentage} from "@/views/ppt_manage/newVersion/utils/untils";
+import ContextMenu from "@/views/ppt_manage/newVersion/components/layer/Element/ShapeContextMenu.vue";
+export default{
+    components:{ContextMenu},
+    data(){
+        return {
+          movePoint:{ //移动时,记录鼠标的位置
+            startX:null,
+            startY:null,
+            moveX:null,
+            moveY:null,
+          },
+          scalePoint:{//缩放时,记录鼠标的位置
+            startX:null,
+            startY:null,
+            moveX:null,
+            moveY:null,
+          },
+          isMouseDown:false,//鼠标是否按下
+          eventType:'move',//当前进行的事件:move:移动元素,resize:缩放元素
+          contextmenus:[
+            {id:1,text:'删除元素',eventName:'deleteShape'},
+            {id:2,text:'复制元素',eventName:'copyShape'}
+          ],//右键菜单的菜单项
+          isContextMenusShow:false,//右键菜单是否显示
+        }
+    },
+    methods:{
+        //开始移动
+        handleMoveStart(event){
+          if(!this.isActive) return
+          //保存移动前的坐标
+          this.isMouseDown = true
+          this.eventType = 'move'
+          this.movePoint.startX = event.clientX
+          this.movePoint.startY = event.clientY
+          document.onmousemove=(e)=>{
+          //如果显示了右键菜单,隐藏掉
+            if(this.isContextMenusShow){
+              this.hideContextMenu()
+            }
+            this.handleMove(e)
+          }
+          document.onmouseup = ()=>{
+            this.isMouseDown = false
+            document.onmousemove = null
+            document.onmouseup = null
+          }
+        },
+        //移动中
+        handleMove(e){
+          if(!this.isMouseDown) return 
+          const {startX,startY} = this.movePoint
+          this.movePoint.moveX = e.clientX-startX
+          this.movePoint.moveY = e.clientY-startY
+          //设置移动的边界点:不能超出editor-area
+          const areaWidth = $(".editor-area").width()||0
+          const areaHeight = areaWidth*0.7
+          let moveInfo = {}
+          moveInfo.left = Math.min(Math.max(this.elementInfo.left+this.movePoint.moveX,0),areaWidth-this.elementInfo.width)
+          moveInfo.top = Math.min(Math.max(this.elementInfo.top+this.movePoint.moveY,0),areaHeight-this.elementInfo.height)
+          this.changeStyle(moveInfo,{})
+          //改变完后,更新movePoint的位置
+          this.movePoint.startX = e.clientX
+          this.movePoint.startY = e.clientY
+        },
+        //开始缩放
+        handleScaleStart(event,direction){
+          this.isMouseDown = true
+          this.eventType = 'resize'
+          this.scalePoint.startX = event.clientX
+          this.scalePoint.startY = event.clientY
+          document.onmousemove=(e)=>{
+            //如果显示了右键菜单,隐藏掉
+            if(this.isContextMenusShow){
+              this.hideContextMenu()
+            }
+            this.handleScale(e,direction)
+          }
+          document.onmouseup = ()=>{
+            this.isMouseDown = false
+            document.onmousemove = null
+            document.onmouseup = null
+          }
+        },
+        //缩放中
+        handleScale(e,direction){
+          if(!this.isMouseDown) return 
+          const {left,top,width,height} = this.elementInfo
+          let scaleInfo = {left:left,top:top,width:width,height:height}
+          //根据direction和moveX,moveY算出元素应该缩放+移动的参数
+          const {startX,startY} = this.scalePoint
+          this.scalePoint.moveX = e.clientX-startX
+          this.scalePoint.moveY = e.clientY-startY
+          //计算拖拽后位置和宽高
+          const areaWidth = $(".editor-area").width()||0
+          const areaHeight = areaWidth*0.7
+          //常规的八个点
+          //左上角:拖拽会改变left,top,width,height
+          if(direction==='LEFT_TOP'){
+            scaleInfo.left = getBoundary(Math.max(left + this.scalePoint.moveX,0),0,(areaWidth - (scaleInfo.width+5)))
+            scaleInfo.top = getBoundary(Math.max(top + this.scalePoint.moveY,0),0,(areaHeight-(scaleInfo.height+5)))
+            if(scaleInfo.left===0){
+             scaleInfo.width = getBoundary(width - this.scalePoint.moveX,25,width) 
+            }else{
+              scaleInfo.width = getBoundary(width - this.scalePoint.moveX,25,areaWidth)
+            }
+            if(scaleInfo.top===0){
+              scaleInfo.height = getBoundary(height - this.scalePoint.moveY,25,height)
+            }else{
+              scaleInfo.height = getBoundary(height - this.scalePoint.moveY,25,areaHeight)
+            }
+          }
+          //左中:拖拽会改变left,width
+          else if (direction==="LEFT"){
+            scaleInfo.width = getBoundary(width - this.scalePoint.moveX,25,areaWidth)
+            scaleInfo.left = getBoundary(Math.max(left + this.scalePoint.moveX,0),0,(areaWidth - (scaleInfo.width+5)))
+            
+          }
+          //左下:拖拽会改变left,width,height
+          else if(direction==="LEFT_BOTTOM"){
+            scaleInfo.width = getBoundary(width - this.scalePoint.moveX,25,areaWidth)
+            scaleInfo.height = getBoundary(height + this.scalePoint.moveY,25,areaHeight)
+            scaleInfo.left = getBoundary(Math.max(left + this.scalePoint.moveX,0),0,(areaWidth - (scaleInfo.width+5)))
+          }
+          //右上:拖拽会改变top,width,height
+          else if(direction==="RIGHT_TOP"){
+            scaleInfo.width = getBoundary(width + this.scalePoint.moveX,25,areaWidth-left)
+            scaleInfo.height = getBoundary(height - this.scalePoint.moveY,25,areaHeight-top)
+            scaleInfo.top = Math.max(top + this.scalePoint.moveY,0)
+          }
+          //右中:拖拽会改变width
+          else if(direction==="RIGHT"){
+            scaleInfo.width = getBoundary(width + this.scalePoint.moveX,25,areaWidth-left)
+          }
+          //右下:拖拽会改变width,height
+          else if(direction==="RIGHT_BOTTOM"){
+            scaleInfo.width = getBoundary(width + this.scalePoint.moveX,25,areaWidth-left)
+            scaleInfo.height = getBoundary(height + this.scalePoint.moveY,25,areaHeight-top)
+          }
+          //中上:拖拽会改变top,height
+          else if(direction==="TOP"){
+            scaleInfo.height = getBoundary(height - this.scalePoint.moveY,25,areaHeight)
+            scaleInfo.top = Math.max(top + this.scalePoint.moveY,0)
+          }
+          //中下:拖拽会改变height
+          else if(direction==="BOTTOM"){
+            scaleInfo.height = getBoundary(height + this.scalePoint.moveY,25,areaHeight)
+          }
+          this.changeStyle({},scaleInfo)
+          this.scalePoint.startX = e.clientX
+          this.scalePoint.startY = e.clientY
+        },
+        changeStyle(moveInfo,scaleInfo){
+          //const {moveX,moveY} = this.movePoint
+          if(this.eventType==='resize'){
+            const {left,top,width,height} = scaleInfo
+            this.elementInfo.left = left
+            this.elementInfo.top = top
+            this.elementInfo.width = width
+            this.elementInfo.height = height
+          }else if(this.eventType==='move'){
+            const {left,top} = moveInfo
+            this.elementInfo.left = left
+            this.elementInfo.top = top
+          }
+          //更新realWidth,realHeight
+          this.elementInfo.realWidth = this.elementInfo.width
+          this.elementInfo.realHeight = this.elementInfo.height
+          //更新percentage单位
+          const width = $('.editor-area').width(),height = width*0.7
+          const percentageShape = caclShapePercentage({layerWidth:width,layerHeight:height},this.elementInfo)
+          this.elementInfo.percentageLeft = percentageShape.percentageLeft
+          this.elementInfo.percentageTop = percentageShape.percentageTop
+          this.elementInfo.percentageWidth = percentageShape.percentageWidth
+          this.elementInfo.percentageHeight = percentageShape.percentageHeight
+        },
+        //显示右键菜单
+        showContentMenu(e){
+          e.preventDefault();
+          if(!this.isCoverEdit) {
+              this.$emit('chooseThis')
+          }
+          $(`#menu-${this.elementInfo.id}`).css({ "left": document.body.scrollLeft + e.clientX, "top": 
+           document.body.scrollTop + e.clientY}).show();
+           this.isContextMenusShow = true
+        },
+        //隐藏右键菜单
+        hideContextMenu(){
+          $(`#menu-${this.elementInfo.id}`).hide();
+          this.isContextMenuShow = false
+        },
+        //删除当前元素
+        handleDeleteLayer(){
+          this.$emit('deleteEl',this.elementInfo)
+          this.hideContextMenu()
+        },
+        //复制当前元素
+        handleCopyShape(){
+            this.$emit('copyEl',this.elementInfo)
+            this.hideContextMenu()
+        }
+      }
+}

+ 13 - 4
src/views/ppt_manage/newVersion/pptEditor.vue

@@ -235,6 +235,8 @@
         :firstPage="firstPage"
         :pptCoverList="pptCoverList"
         :PptId="pptId"
+        :CoverContent="CoverContent"
+        @saveCover="saveCover2"
         @close="isShowChooseCover=false"
     />
     <!-- 批量删除弹窗 -->
@@ -321,12 +323,13 @@ export default {
         chooseModalId:1,//上一次选择的版式Id
         firstPage:{
             Title:'',
-            ReportType:'',
+            ReportType:'',//ETA1.4.9不用了
             BackgroundImg:'',
-            PptDate:(new Date().getFullYear())+'年'+(new Date().getMonth()+1)+'月',
-            BackIndex:0,
-            TemplateType:1
+            PptDate:(new Date().getFullYear())+'年'+(new Date().getMonth()+1)+'月',//ETA1.4.9不用了
+            BackIndex:0,//ETA基本配置上线后不用了
+            TemplateType:1,//ETA基本配置上线后不用了
         },//封面信息
+        CoverContent:'',//自定义封面内容
         key_word:'',//搜索图表关键字
         chartList:[],//图表数组
         imgUrl:'',//黏贴图片上传后的地址
@@ -484,6 +487,12 @@ export default {
         this.firstPage = info
         this.closeChooseCover()
     },
+    //保存修改的自定义封面页
+    saveCover2(info){
+        const {firstPage={},content=''} = info
+        //this.firstPage = firstPage //这段不变
+        this.CoverContent = content
+    },
     //在指定位置添加一个有版式的空白页
     addPage(modelId,index) {
         let page = {