|
@@ -5,16 +5,20 @@
|
|
class="add_ico"
|
|
class="add_ico"
|
|
@click="addPage(chooseModalId)"
|
|
@click="addPage(chooseModalId)"
|
|
/>
|
|
/>
|
|
|
|
+ <el-button type="text" icon="el-icon-arrow-left" :disabled="clickLeftTime===0" @click="scrollPrev"></el-button>
|
|
<div class="format-wrap">
|
|
<div class="format-wrap">
|
|
- <div class="format-item" :class="{'last-choose':chooseModalId===item.modelId}"
|
|
|
|
- v-for="item in formatArr" :key="item.modelId">
|
|
|
|
- <component
|
|
|
|
- :is="previewComponentName(item.modelId)"
|
|
|
|
- @click.native="addPage(item.modelId)"
|
|
|
|
- />
|
|
|
|
- <!-- <p>{{ item.text }}</p> -->
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="format-trans-wrap" :style="`transform:translateX(${scrollOffset}px);`">
|
|
|
|
+ <div class="format-item" :class="{'last-choose':chooseModalId===item.modelId}"
|
|
|
|
+ :style="`margin:0 ${itemOccupyMargin}px;`"
|
|
|
|
+ v-for="item in formatArr" :key="item.modelId">
|
|
|
|
+ <component
|
|
|
|
+ :is="previewComponentName(item.modelId)"
|
|
|
|
+ @click.native="addPage(item.modelId)"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <el-button type="text" icon="el-icon-arrow-right" :disabled="clickRightTime===0" @click="scrollNext"></el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -32,6 +36,7 @@ import FormatPreNine from "@/views/ppt_manage/newVersion/components/formatPrevie
|
|
import FormatPreTen from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreTen";
|
|
import FormatPreTen from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreTen";
|
|
import FormatPreEle from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreEle";
|
|
import FormatPreEle from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreEle";
|
|
import FormatPreTwelve from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreTwelve";
|
|
import FormatPreTwelve from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreTwelve";
|
|
|
|
+import FormatPreThirteen from "@/views/ppt_manage/newVersion/components/formatPreview/FormatPreThirteen";
|
|
import {countComponentName} from '@/views/ppt_manage/newVersion/utils/untils';
|
|
import {countComponentName} from '@/views/ppt_manage/newVersion/utils/untils';
|
|
export default {
|
|
export default {
|
|
name: "AddFormat",
|
|
name: "AddFormat",
|
|
@@ -53,15 +58,44 @@ export default {
|
|
FormatPreNine,
|
|
FormatPreNine,
|
|
FormatPreTen,
|
|
FormatPreTen,
|
|
FormatPreEle,
|
|
FormatPreEle,
|
|
- FormatPreTwelve
|
|
|
|
|
|
+ FormatPreTwelve,
|
|
|
|
+ FormatPreThirteen
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
formatArr: formatPre,
|
|
formatArr: formatPre,
|
|
-
|
|
|
|
|
|
+ lineShowNum:9,//一行最多能展示几个
|
|
|
|
+ clickLeftTime:0,//可以按下左按钮的次数,为0时该按钮禁用
|
|
|
|
+ clickRightTime:0,//可以按下右按钮的次数,为0时该按钮禁用
|
|
|
|
+ scrollOffset:0,//当前滚动偏移量
|
|
|
|
+ itemOccupyMargin:0,//当前一个format占用间距
|
|
|
|
+ itemWidth:92,//当前一个format所占宽度(固定)
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ init(){
|
|
|
|
+ //初始化按钮次数
|
|
|
|
+ this.clickLeftTime = 0
|
|
|
|
+ this.clickRightTime = this.formatArr.length - this.lineShowNum
|
|
|
|
+ //获取容器宽度,以确定一个format应占宽度
|
|
|
|
+ const parentWidth = $('.format-wrap').width()
|
|
|
|
+ this.itemOccupyMargin = ((parentWidth/this.lineShowNum - this.itemWidth - 0.5)/2).toFixed(2)
|
|
|
|
+ },
|
|
|
|
+ scrollPrev(){
|
|
|
|
+ if(this.clickLeftTime<=0) return
|
|
|
|
+ this.clickLeftTime--
|
|
|
|
+ this.clickRightTime++
|
|
|
|
+ this.scrollFormat(this.clickLeftTime)
|
|
|
|
+ },
|
|
|
|
+ scrollNext(){
|
|
|
|
+ if(this.clickRightTime===0) return
|
|
|
|
+ this.clickRightTime--
|
|
|
|
+ this.clickLeftTime++
|
|
|
|
+ this.scrollFormat(this.clickLeftTime)
|
|
|
|
+ },
|
|
|
|
+ scrollFormat(multiple){
|
|
|
|
+ this.scrollOffset = -(multiple*this.itemWidth+Number(this.itemOccupyMargin))
|
|
|
|
+ },
|
|
previewComponentName(modelId) {
|
|
previewComponentName(modelId) {
|
|
return countComponentName(modelId,'pre')
|
|
return countComponentName(modelId,'pre')
|
|
//return `formatPre${modelMap[modelId]}`;
|
|
//return `formatPre${modelMap[modelId]}`;
|
|
@@ -70,10 +104,20 @@ export default {
|
|
this.$emit("addPage", modelId);
|
|
this.$emit("addPage", modelId);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ mounted(){
|
|
|
|
+ this.init()
|
|
|
|
+ },
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@import "~@/views/ppt_manage/newVersion/css/formatPre.scss";
|
|
@import "~@/views/ppt_manage/newVersion/css/formatPre.scss";
|
|
|
|
+.add-icon-wrap{
|
|
|
|
+ .el-button{
|
|
|
|
+ i{
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
.add-icon-wrap {
|
|
.add-icon-wrap {
|
|
@@ -81,6 +125,8 @@ export default {
|
|
min-height: 64px;
|
|
min-height: 64px;
|
|
position: relative;
|
|
position: relative;
|
|
padding: 10px 20px;
|
|
padding: 10px 20px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
.add_ico {
|
|
.add_ico {
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
position: absolute;
|
|
position: absolute;
|
|
@@ -91,15 +137,25 @@ export default {
|
|
height: 28px;
|
|
height: 28px;
|
|
display: inline-block;
|
|
display: inline-block;
|
|
}
|
|
}
|
|
|
|
+ .el-button{
|
|
|
|
+ font-size: 22px;
|
|
|
|
+ padding:0;
|
|
|
|
+ &:first-of-type{
|
|
|
|
+ margin-left: 40px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.format-wrap {
|
|
.format-wrap {
|
|
- margin-left: 40px;
|
|
|
|
- /* background-color: #eef0f3; */
|
|
|
|
- width: calc(100% - 40px);
|
|
|
|
- /* height: 120px; */
|
|
|
|
- display: flex;
|
|
|
|
- /* flex-wrap: wrap; */
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
|
+ width: calc(100% - 80px);
|
|
|
|
+ height:68px;
|
|
|
|
+ overflow-x: hidden;
|
|
|
|
+ .format-trans-wrap{
|
|
|
|
+ width:100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-wrap: nowrap;
|
|
|
|
+ }
|
|
.format-item {
|
|
.format-item {
|
|
|
|
+ flex:0 0 auto;
|
|
width: 80px;
|
|
width: 80px;
|
|
height: 56px;
|
|
height: 56px;
|
|
padding: 5px;
|
|
padding: 5px;
|