baiqiu-cms-decoration-dg 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/baiqiu-cms-decoration-dg.common.js +90075 -0
- package/lib/baiqiu-cms-decoration-dg.css +7 -0
- package/lib/baiqiu-cms-decoration-dg.umd.js +90085 -0
- package/lib/baiqiu-cms-decoration-dg.umd.min.js +48 -0
- package/lib/demo.html +10 -0
- package/{dist/img/iconfont.654cc65b.svg → lib/img/iconfont.210a3a86.svg} +89 -89
- package/package.json +5 -10
- package/babel.config.js +0 -5
- package/dist/css/app.d43615c0.css +0 -1
- package/dist/css/chunk-vendors.ef1800aa.css +0 -7
- package/dist/favicon.ico +0 -0
- package/dist/index.html +0 -1
- package/dist/js/app.453dd14c.js +0 -2
- package/dist/js/app.453dd14c.js.map +0 -1
- package/dist/js/chunk-vendors.cfd53f93.js +0 -37
- package/dist/js/chunk-vendors.cfd53f93.js.map +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -594
- package/src/api/com-service.js +0 -26
- package/src/assets/iconfont/demo.css +0 -539
- package/src/assets/iconfont/iconfont.css +0 -158
- package/src/assets/iconfont/iconfont.eot +0 -0
- package/src/assets/iconfont/iconfont.json +0 -254
- package/src/assets/iconfont/iconfont.svg +0 -89
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/assets/img/pc-cms-v2/creation.png +0 -0
- package/src/assets/img/pc-cms-v2/icon.png +0 -0
- package/src/assets/img/pc-cms-v2/mobileNav.png +0 -0
- package/src/assets/img/pc-cms-v2/next1.png +0 -0
- package/src/assets/img/pc-cms-v2/next2.png +0 -0
- package/src/assets/img/pc-cms-v2/prev1.png +0 -0
- package/src/assets/img/pc-cms-v2/prev2.png +0 -0
- package/src/assets/img/pc-cms-v2/text.png +0 -0
- package/src/components/cms/animate.scss +0 -19
- package/src/components/cms/buttonItem/buttonItem.js +0 -135
- package/src/components/cms/buttonItem/buttonItem.scss +0 -95
- package/src/components/cms/buttonItem/buttonItem.vue +0 -47
- package/src/components/cms/buttonItem/index.js +0 -2
- package/src/components/cms/cms.js +0 -104
- package/src/components/cms/cms.scss +0 -46
- package/src/components/cms/cms.vue +0 -51
- package/src/components/cms/customLayout/customLayout.js +0 -46
- package/src/components/cms/customLayout/customLayout.scss +0 -8
- package/src/components/cms/customLayout/customLayout.vue +0 -15
- package/src/components/cms/customLayout/index.js +0 -2
- package/src/components/cms/hotspot/hotspot.js +0 -200
- package/src/components/cms/hotspot/hotspot.scss +0 -20
- package/src/components/cms/hotspot/hotspot.vue +0 -35
- package/src/components/cms/hotspot/index.js +0 -2
- package/src/components/cms/imgNav/imgNav.js +0 -176
- package/src/components/cms/imgNav/imgNav.scss +0 -113
- package/src/components/cms/imgNav/imgNav.vue +0 -123
- package/src/components/cms/imgNav/index.js +0 -2
- package/src/components/cms/index.js +0 -2
- package/src/components/cms/mixin.js +0 -239
- package/src/components/cms/multipleLayout/index.js +0 -2
- package/src/components/cms/multipleLayout/multipleLayout.js +0 -54
- package/src/components/cms/multipleLayout/multipleLayout.scss +0 -21
- package/src/components/cms/multipleLayout/multipleLayout.vue +0 -25
- package/src/components/cms/productItem/index.js +0 -2
- package/src/components/cms/productItem/productItem.js +0 -290
- package/src/components/cms/productItem/productItem.scss +0 -180
- package/src/components/cms/productItem/productItem.vue +0 -117
- package/src/components/cms/singleLayout/index.js +0 -2
- package/src/components/cms/singleLayout/singleLayout.js +0 -63
- package/src/components/cms/singleLayout/singleLayout.scss +0 -21
- package/src/components/cms/singleLayout/singleLayout.vue +0 -42
- package/src/components/cms/slideLayout/index.js +0 -2
- package/src/components/cms/slideLayout/slideLayout.js +0 -248
- package/src/components/cms/slideLayout/slideLayout.scss +0 -18
- package/src/components/cms/slideLayout/slideLayout.vue +0 -44
- package/src/components/cms/swiperItem/index.js +0 -2
- package/src/components/cms/swiperItem/swiperItem.js +0 -228
- package/src/components/cms/swiperItem/swiperItem.scss +0 -204
- package/src/components/cms/swiperItem/swiperItem.vue +0 -123
- package/src/components/cms/tabLayout/index.js +0 -2
- package/src/components/cms/tabLayout/navItem/index.js +0 -2
- package/src/components/cms/tabLayout/navItem/navItem.js +0 -47
- package/src/components/cms/tabLayout/navItem/navItem.scss +0 -23
- package/src/components/cms/tabLayout/navItem/navItem.vue +0 -13
- package/src/components/cms/tabLayout/tabLayout.js +0 -158
- package/src/components/cms/tabLayout/tabLayout.scss +0 -26
- package/src/components/cms/tabLayout/tabLayout.vue +0 -43
- package/src/components/cms/textItem/index.js +0 -2
- package/src/components/cms/textItem/textItem.js +0 -65
- package/src/components/cms/textItem/textItem.scss +0 -41
- package/src/components/cms/textItem/textItem.vue +0 -26
- package/src/components/cms/utils.js +0 -101
- package/src/components/cms/videoItem/index.js +0 -2
- package/src/components/cms/videoItem/videoItem.js +0 -96
- package/src/components/cms/videoItem/videoItem.scss +0 -27
- package/src/components/cms/videoItem/videoItem.vue +0 -56
- package/src/components/cms/videoPlayer/index.js +0 -2
- package/src/components/cms/videoPlayer/videoPlayer.js +0 -68
- package/src/components/cms/videoPlayer/videoPlayer.scss +0 -37
- package/src/components/cms/videoPlayer/videoPlayer.vue +0 -34
- package/src/index.js +0 -23
- package/src/index.scss +0 -221
- package/src/main.js +0 -8
- package/src/utils/common.js +0 -23
- package/src/utils/http-client.js +0 -101
- package/src/utils/utils.js +0 -63
- package/webpack.config.js +0 -109
- /package/{dist → lib}/fonts/iconfont.529b3ed0.ttf +0 -0
- /package/{dist → lib}/fonts/iconfont.580c918e.eot +0 -0
- /package/{dist → lib}/fonts/iconfont.ea5b1aa2.woff +0 -0
@@ -1,63 +0,0 @@
|
|
1
|
-
// import draggable from "vuedraggable";
|
2
|
-
import textItem from "../textItem";
|
3
|
-
import imgNav from "../imgNav/";
|
4
|
-
import videoItem from '../videoItem/';
|
5
|
-
import swiperItem from '../swiperItem/';
|
6
|
-
import buttonItem from '../buttonItem/';
|
7
|
-
import productItem from "../productItem/";
|
8
|
-
|
9
|
-
export default {
|
10
|
-
name: "singleLayout",
|
11
|
-
inheritAttrs: false,
|
12
|
-
components: {
|
13
|
-
textItem,
|
14
|
-
imgNav,
|
15
|
-
videoItem,
|
16
|
-
swiperItem,
|
17
|
-
buttonItem,
|
18
|
-
productItem,
|
19
|
-
},
|
20
|
-
props: {
|
21
|
-
layOutData: {
|
22
|
-
type: Object,
|
23
|
-
default: () => { }
|
24
|
-
},
|
25
|
-
ratio: {
|
26
|
-
type: Number,
|
27
|
-
default: 1
|
28
|
-
},
|
29
|
-
// 是否可拖拽进入
|
30
|
-
canDragInc: {
|
31
|
-
type: Boolean,
|
32
|
-
default: true
|
33
|
-
}
|
34
|
-
},
|
35
|
-
data() {
|
36
|
-
return {
|
37
|
-
vLine: [],
|
38
|
-
hLine: [],
|
39
|
-
componentName:''
|
40
|
-
};
|
41
|
-
},
|
42
|
-
computed: {
|
43
|
-
layoutStyle:function () {
|
44
|
-
if(this.layOutData.layoutStyle){
|
45
|
-
return {
|
46
|
-
backgroundImage:this.layOutData.layoutStyle.bgStyle.type === 2 && this.layOutData.layoutStyle.bgStyle.picList.length != 0 && `url(${this.layOutData.layoutStyle.bgStyle.picList[0].resourcePath})`,
|
47
|
-
backgroundColor:this.layOutData.layoutStyle.bgStyle.type === 1 && this.layOutData.layoutStyle.bgStyle.backgroundColor
|
48
|
-
}
|
49
|
-
}else{
|
50
|
-
return {}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
},
|
54
|
-
methods: {
|
55
|
-
reportData(h) {
|
56
|
-
let refs = this.$refs.singleComponent
|
57
|
-
refs&&refs.forEach(item => {
|
58
|
-
item.reportData(h)
|
59
|
-
});
|
60
|
-
}
|
61
|
-
}
|
62
|
-
};
|
63
|
-
1
|
@@ -1,21 +0,0 @@
|
|
1
|
-
.single-layout {
|
2
|
-
width: 100%;
|
3
|
-
height: 100%;
|
4
|
-
position: relative;
|
5
|
-
overflow: hidden;
|
6
|
-
background-size: cover;
|
7
|
-
background-repeat: no-repeat;
|
8
|
-
|
9
|
-
.lay-tip {
|
10
|
-
position: absolute;
|
11
|
-
left: 50%;
|
12
|
-
top: 50%;
|
13
|
-
transform: translate(-50%, -50%);
|
14
|
-
color: #1890FF;
|
15
|
-
font-size: 18px;
|
16
|
-
|
17
|
-
.el-icon-plus {
|
18
|
-
margin-right: 13px;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div
|
3
|
-
class="single-layout"
|
4
|
-
:style="layoutStyle"
|
5
|
-
>
|
6
|
-
<div
|
7
|
-
style="width: 100%; height: 100%"
|
8
|
-
>
|
9
|
-
<div v-for="(item, index) in layOutData.componentList" :key="index">
|
10
|
-
<template v-if="item.type > 100">
|
11
|
-
{{item.sort}}
|
12
|
-
<slot :name="`dgCustomComponent${item.sort}`" :attributeJson="JSON.parse(JSON.stringify(item.attributeJson))"></slot>
|
13
|
-
</template>
|
14
|
-
<template v-if="item.type <= 100">
|
15
|
-
<component
|
16
|
-
ref="singleComponent"
|
17
|
-
:is="item.component"
|
18
|
-
:ratio="ratio"
|
19
|
-
:attributeJson="item.attributeJson"
|
20
|
-
:sortId="item.sort"
|
21
|
-
:key="item.sort"
|
22
|
-
v-bind="$attrs"
|
23
|
-
v-on="$listeners"
|
24
|
-
v-if="item.displayType == 1"
|
25
|
-
:style="{zIndex: index + 1}"
|
26
|
-
>
|
27
|
-
</component>
|
28
|
-
</template>
|
29
|
-
</div>
|
30
|
-
<!--辅助线END-->
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
</template>
|
34
|
-
|
35
|
-
<script>
|
36
|
-
import singleLayoutJs from "./singleLayout.js";
|
37
|
-
export default singleLayoutJs;
|
38
|
-
</script>
|
39
|
-
|
40
|
-
<style lang="scss" scoped>
|
41
|
-
@import "singleLayout";
|
42
|
-
</style>
|
@@ -1,248 +0,0 @@
|
|
1
|
-
import Swiper from 'swiper/js/swiper.js'
|
2
|
-
import singleLayout from '../singleLayout/'
|
3
|
-
export default {
|
4
|
-
name: 'slideLayout',
|
5
|
-
components: {
|
6
|
-
singleLayout
|
7
|
-
},
|
8
|
-
props: {
|
9
|
-
layOutData: {
|
10
|
-
type: Object,
|
11
|
-
default: () => {},
|
12
|
-
},
|
13
|
-
ratio: {
|
14
|
-
type: Number,
|
15
|
-
default: 1,
|
16
|
-
},
|
17
|
-
mode: {
|
18
|
-
type: String,
|
19
|
-
default: 'pc',
|
20
|
-
},
|
21
|
-
recordId: {
|
22
|
-
type: Number,
|
23
|
-
default: 0,
|
24
|
-
},
|
25
|
-
},
|
26
|
-
data() {
|
27
|
-
return {
|
28
|
-
swiper: '',
|
29
|
-
slideIndex: 0, // 当前轮播项
|
30
|
-
layWidth: 1920,
|
31
|
-
isInit: false, // 是否已初始化轮播图
|
32
|
-
slideList:[]
|
33
|
-
}
|
34
|
-
},
|
35
|
-
watch: {
|
36
|
-
layoutStyle: {
|
37
|
-
handler(val) {
|
38
|
-
this.layWidth = (this.mode == 'pc' ? 1920 : 750) * (val.widthStyle.width / 100)
|
39
|
-
},
|
40
|
-
deep: true,
|
41
|
-
immediate: true,
|
42
|
-
},
|
43
|
-
slideLen: {
|
44
|
-
handler() {
|
45
|
-
this.calculateWidth()
|
46
|
-
},
|
47
|
-
immediate: true,
|
48
|
-
},
|
49
|
-
},
|
50
|
-
computed: {
|
51
|
-
layoutStyle() {
|
52
|
-
return this.layOutData.layoutStyle
|
53
|
-
},
|
54
|
-
// 分页器,导航按钮样式
|
55
|
-
paginationStyle() {
|
56
|
-
return this.layOutData.paginationStyle
|
57
|
-
},
|
58
|
-
// 背景设置
|
59
|
-
bgStyle() {
|
60
|
-
return this.layOutData.bgStyle
|
61
|
-
},
|
62
|
-
// 轮播列表
|
63
|
-
list() {
|
64
|
-
return this.layOutData.list
|
65
|
-
},
|
66
|
-
// 样式type
|
67
|
-
styleType() {
|
68
|
-
return this.layOutData.styleType
|
69
|
-
},
|
70
|
-
// 指示器type
|
71
|
-
indicatorType() {
|
72
|
-
return this.layOutData.indicatorType
|
73
|
-
},
|
74
|
-
// 宽度设置 1:自适应宽度 2:等宽设置
|
75
|
-
widthStyle() {
|
76
|
-
return this.layOutData.widthStyle
|
77
|
-
},
|
78
|
-
// 是否有左右轮播箭头
|
79
|
-
hasSwiperButton() {
|
80
|
-
return this.indicatorType == 2
|
81
|
-
},
|
82
|
-
// 分页器样式
|
83
|
-
pageStyle() {
|
84
|
-
return {
|
85
|
-
color: this.layOutData.paginationStyle.color,
|
86
|
-
}
|
87
|
-
},
|
88
|
-
// 背景样式
|
89
|
-
backStyle() {
|
90
|
-
let {bgStyle, layoutStyle, styleType, mode } = this
|
91
|
-
return function(index){
|
92
|
-
let item = this.list[index]
|
93
|
-
let backgroundColor = ''
|
94
|
-
let backgroundImage = ''
|
95
|
-
if(bgStyle.status == 1){
|
96
|
-
//整体
|
97
|
-
if(bgStyle.type == 1){
|
98
|
-
backgroundColor = bgStyle.backgroundColor || ''
|
99
|
-
}else{
|
100
|
-
backgroundImage = bgStyle.picList.length != 0? `url(${bgStyle.picList[0].resourcePath})`:''
|
101
|
-
}
|
102
|
-
}else{
|
103
|
-
//单个
|
104
|
-
if(item.bgStyle.type == 1){
|
105
|
-
backgroundColor = item.bgStyle.backgroundColor || ''
|
106
|
-
}else{
|
107
|
-
backgroundImage = item.bgStyle.picList.length != 0? `url(${item.bgStyle.picList[0].resourcePath})`:''
|
108
|
-
}
|
109
|
-
}
|
110
|
-
let hasCenteredSlides = mode == 'mobile' || (mode == 'pc' && styleType == 2)
|
111
|
-
|
112
|
-
let allWidth = hasCenteredSlides ? this.layWidth - (this.layOutData.lineSlideNum + 1) * 0 - (mode=='mobile' ? 20 : 556) : this.layWidth
|
113
|
-
// 样式二 原始宽度 - slide间隙 - 两边露出的间距
|
114
|
-
return {
|
115
|
-
width: allWidth / this.layOutData.lineSlideNum * this.ratio + 'px',
|
116
|
-
height: `${Math.ceil(layoutStyle.height * this.ratio)}px`, // 向上取整,避免部分机型白线
|
117
|
-
backgroundColor: backgroundColor,
|
118
|
-
backgroundImage: backgroundImage,
|
119
|
-
}
|
120
|
-
}
|
121
|
-
},
|
122
|
-
slideLen() {
|
123
|
-
return this.layOutData.list.length
|
124
|
-
},
|
125
|
-
centeredSlides() {
|
126
|
-
return this.mode == 'mobile' || (this.mode == 'pc' && this.styleType == 2)
|
127
|
-
}
|
128
|
-
},
|
129
|
-
methods: {
|
130
|
-
calculateWidth:function () {
|
131
|
-
let {list} = this
|
132
|
-
list.forEach((item, index)=>{
|
133
|
-
item.i = index
|
134
|
-
})
|
135
|
-
// 前后各增加相同数目的滑动容器,为了自行实现loop
|
136
|
-
let item = JSON.parse(JSON.stringify(list))
|
137
|
-
// 增加判断是否为复制出来的元素,防止影响数据上报
|
138
|
-
item.forEach(ele=>{
|
139
|
-
ele.isCopy = true
|
140
|
-
})
|
141
|
-
this.slideList = list.concat(JSON.parse(JSON.stringify(item)))
|
142
|
-
this.slideList = item.concat(this.slideList)
|
143
|
-
this.$nextTick(()=> {
|
144
|
-
// type: 1 自适应宽度 计算每个模块的宽度
|
145
|
-
if (this.layOutData.widthStyle.type == 2 ) {
|
146
|
-
this.initSwiper()
|
147
|
-
return
|
148
|
-
}
|
149
|
-
let { layWidth } = this
|
150
|
-
this.slideList.forEach((item) => {
|
151
|
-
let ele = item.componentList[0]
|
152
|
-
let slideWidth = 0
|
153
|
-
if (ele) {
|
154
|
-
let attr = ele.attributeJson
|
155
|
-
if (ele.type == 2) {
|
156
|
-
// 图片
|
157
|
-
let hasPic = attr.list.some((item) => {
|
158
|
-
return item.picList.length != 0
|
159
|
-
})
|
160
|
-
slideWidth = !hasPic ? layWidth : attr.baseStyle.w + attr.baseStyle.l
|
161
|
-
} else if (ele.type == 3) {
|
162
|
-
// 视频
|
163
|
-
let hasPic = attr.videoInfo.list.length != 0
|
164
|
-
slideWidth = !hasPic ? layWidth : attr.baseStyle.w + attr.baseStyle.l
|
165
|
-
} else {
|
166
|
-
slideWidth = attr.baseStyle.w + attr.baseStyle.l
|
167
|
-
}
|
168
|
-
} else {
|
169
|
-
// 若slide内暂无元素,默认使用父级slide的宽
|
170
|
-
slideWidth = layWidth
|
171
|
-
}
|
172
|
-
this.$set(item, 'slideWidth', slideWidth)
|
173
|
-
})
|
174
|
-
this.$nextTick(()=> {
|
175
|
-
this.initSwiper()
|
176
|
-
})
|
177
|
-
})
|
178
|
-
},
|
179
|
-
// 初始化轮播图
|
180
|
-
initSwiper() {
|
181
|
-
this.$nextTick(() => {
|
182
|
-
if (this.swiper) {
|
183
|
-
this.swiper.destroy(true, true)
|
184
|
-
this.swiper = null
|
185
|
-
}
|
186
|
-
let { layOutData, widthStyle, ratio, slideLen } = this
|
187
|
-
this.options = {
|
188
|
-
effect: 'slide',
|
189
|
-
observer: true, //开启动态检查器,监测swiper和slide
|
190
|
-
observeParents: true,
|
191
|
-
slidesPerView: (this.centeredSlides || widthStyle.type == 1) ? 'auto' : layOutData.lineSlideNum,
|
192
|
-
preventInteractionOnTransition: true,
|
193
|
-
slidesPerGroup: 1,
|
194
|
-
slidesPerGroupAuto: true,
|
195
|
-
centeredSlides: (this.centeredSlides || widthStyle.type == 1),
|
196
|
-
// loop: layOutData.lineSlideNum < layOutData.slideNum ,
|
197
|
-
spaceBetween: this.centeredSlides ? 0 * ratio : 0,
|
198
|
-
autoplay:
|
199
|
-
layOutData.autoPlay && this.list.length > 1
|
200
|
-
? {
|
201
|
-
delay: layOutData.interval * 1000,
|
202
|
-
disableOnInteraction: true,
|
203
|
-
stopOnLastSlide: false,
|
204
|
-
}
|
205
|
-
: false,
|
206
|
-
}
|
207
|
-
|
208
|
-
if(widthStyle.type == 1) {
|
209
|
-
this.options.loopedSlides = 4
|
210
|
-
this.options.loopAdditionalSlides = 2
|
211
|
-
}
|
212
|
-
|
213
|
-
let that = this
|
214
|
-
this.options.on = {
|
215
|
-
slideNextTransitionEnd: function () {
|
216
|
-
if(this.activeIndex == slideLen *2 ) {
|
217
|
-
this.slideTo(slideLen, 0)
|
218
|
-
}
|
219
|
-
that.slideIndex = this.activeIndex
|
220
|
-
},
|
221
|
-
slidePrevTransitionEnd: function() {
|
222
|
-
if(this.activeIndex == slideLen - 1 ) {
|
223
|
-
this.slideTo(slideLen *2 - 1, 0)
|
224
|
-
}
|
225
|
-
}
|
226
|
-
}
|
227
|
-
|
228
|
-
// 导航按钮定义
|
229
|
-
if (this.hasSwiperButton) {
|
230
|
-
this.options.navigation = {
|
231
|
-
nextEl: `.swiper-button-next-${this.recordId}`,
|
232
|
-
prevEl: `.swiper-button-prev-${this.recordId}`,
|
233
|
-
}
|
234
|
-
}
|
235
|
-
|
236
|
-
this.swiper = new Swiper(`.swiper-container-${this.recordId}`, this.options)
|
237
|
-
this.swiper.slideTo(slideLen, 0)
|
238
|
-
console.log('\x1B[32m%s\x1B[0m', '初始化轮播图', this.swiper)
|
239
|
-
})
|
240
|
-
},
|
241
|
-
reportData(h) {
|
242
|
-
let refs = this.$refs.slideSingle
|
243
|
-
refs&&refs.forEach(item=>{
|
244
|
-
item.reportData(h)
|
245
|
-
})
|
246
|
-
}
|
247
|
-
},
|
248
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
.slide-wrap {
|
2
|
-
overflow: hidden;
|
3
|
-
height: 100%;
|
4
|
-
.swiper-container {
|
5
|
-
height: 100%;
|
6
|
-
.swiper-slide {
|
7
|
-
&.slide-auto {
|
8
|
-
width: auto!important;
|
9
|
-
}
|
10
|
-
.slide-con {
|
11
|
-
position: relative;
|
12
|
-
width: 100%;
|
13
|
-
height: 100%;
|
14
|
-
background-size: cover;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div
|
3
|
-
class="slide-wrap"
|
4
|
-
:style="{ '--hoverColor': paginationStyle.hoverColor || paginationStyle.color, '--activeColor': paginationStyle.activeColor, '--color': paginationStyle.color }">
|
5
|
-
<div
|
6
|
-
:class="[`swiper-container swiper-container-${recordId} swiper-container-${indicatorType}`]"
|
7
|
-
:id="`mySwiper-${recordId}`"
|
8
|
-
:key="indicatorType">
|
9
|
-
<div class="swiper-wrapper">
|
10
|
-
<div
|
11
|
-
:class="['swiper-slide', {'slide-auto': widthStyle.type == 1 || centeredSlides}]"
|
12
|
-
v-for="(carousel, index) in slideList"
|
13
|
-
:key="index">
|
14
|
-
<div
|
15
|
-
class="slide-con"
|
16
|
-
:style="[backStyle(carousel.i), {
|
17
|
-
width: widthStyle.type == 1 ? `${carousel.slideWidth * ratio}px` : backStyle(carousel.i).width
|
18
|
-
}]">
|
19
|
-
<singleLayout :ref="carousel.isCopy ? '':'slideSingle'" v-bind="$attrs" v-on="$listeners" :layOutData="carousel" :ratio="ratio" :recordId="recordId" :mode="mode"></singleLayout>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
|
24
|
-
<!-- 如果需要导航按钮 -->
|
25
|
-
<div :class="['swiper-button-prev', `swiper-button-prev-${recordId}`]" v-if="hasSwiperButton">
|
26
|
-
<slot name="swiper-button-prev">
|
27
|
-
<div class="arrow"><span :style="pageStyle" class="cms2iconfont iconarrow-left"></span></div>
|
28
|
-
</slot>
|
29
|
-
</div>
|
30
|
-
<div :class="['swiper-button-next', `swiper-button-next-${recordId}`]" v-if="hasSwiperButton">
|
31
|
-
<slot name="swiper-button-next">
|
32
|
-
<div class="arrow"><span :style="pageStyle" class="cms2iconfont iconarrow-right"></span></div>
|
33
|
-
</slot>
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
</template>
|
38
|
-
<script>
|
39
|
-
import slideLayoutJs from './slideLayout.js';
|
40
|
-
export default slideLayoutJs;
|
41
|
-
</script>
|
42
|
-
<style lang="scss" scoped>
|
43
|
-
@import 'slideLayout';
|
44
|
-
</style>
|
@@ -1,228 +0,0 @@
|
|
1
|
-
import Swiper from 'swiper/js/swiper.js'
|
2
|
-
import 'swiper/css/swiper.css'
|
3
|
-
import hotspot from '../hotspot/'
|
4
|
-
import { cmsMixin } from '../mixin'
|
5
|
-
import videoPlayer from '../videoPlayer/'
|
6
|
-
import { dataSaveDecorationPageComponentEventFn } from '../../../utils/utils'
|
7
|
-
|
8
|
-
export default {
|
9
|
-
name: 'swiperItem',
|
10
|
-
mixins: [cmsMixin],
|
11
|
-
components: {
|
12
|
-
hotspot,
|
13
|
-
myVideoPlayer: videoPlayer
|
14
|
-
},
|
15
|
-
props: {
|
16
|
-
sortId: {
|
17
|
-
type: Number
|
18
|
-
}
|
19
|
-
},
|
20
|
-
data() {
|
21
|
-
return {
|
22
|
-
hasSwiperItem: false,
|
23
|
-
swiper: '',
|
24
|
-
activeIndex: 0,
|
25
|
-
slideIndex: 0,
|
26
|
-
hasInitSwiper: false,
|
27
|
-
positionList: [],
|
28
|
-
positionTotal: [], // 当前组件之前的坑位和
|
29
|
-
}
|
30
|
-
},
|
31
|
-
computed: {
|
32
|
-
bgStyle() {
|
33
|
-
return this.attributeJson.bgStyle
|
34
|
-
},
|
35
|
-
list() {
|
36
|
-
return this.attributeJson.list
|
37
|
-
},
|
38
|
-
styleType() {
|
39
|
-
return this.attributeJson.styleType
|
40
|
-
},
|
41
|
-
indicatorType() {
|
42
|
-
return this.attributeJson.indicatorType
|
43
|
-
},
|
44
|
-
// 分页器颜色
|
45
|
-
paginationStyle() {
|
46
|
-
return this.attributeJson.paginationStyle
|
47
|
-
},
|
48
|
-
pageStyle() {
|
49
|
-
return {
|
50
|
-
color: this.attributeJson.paginationStyle.color
|
51
|
-
}
|
52
|
-
},
|
53
|
-
hasSwiperPagination() {
|
54
|
-
return this.indicatorType == 3
|
55
|
-
},
|
56
|
-
// 是否有导航指示器
|
57
|
-
hasSwiperButton() {
|
58
|
-
return this.indicatorType !=1
|
59
|
-
},
|
60
|
-
// 是否有导航条
|
61
|
-
hasScrollBar() {
|
62
|
-
return this.mode == 'pc' && this.indicatorType == 2
|
63
|
-
},
|
64
|
-
// 是否为两边露出的样式
|
65
|
-
isSpaceSwiper() {
|
66
|
-
return this.mode == 'mobile' && this.styleType == 2
|
67
|
-
}
|
68
|
-
},
|
69
|
-
mounted() {
|
70
|
-
this.$nextTick(()=>{
|
71
|
-
let positionList = []
|
72
|
-
let positionTotal = []
|
73
|
-
this.list.forEach(item=>{
|
74
|
-
if((item.type == 1 && item.popList.length!=0)||(item.videoHotInfo.popList.length!=0)) {
|
75
|
-
positionList.push(item.type == 1?item.popList.length:item.videoHotInfo.popList.length)
|
76
|
-
} else {
|
77
|
-
positionList.push(1)
|
78
|
-
}
|
79
|
-
})
|
80
|
-
|
81
|
-
positionList.forEach((item, index)=>{
|
82
|
-
let preList = positionList.slice(0, index)
|
83
|
-
let preTotal = preList.reduce((pre, cur)=>{
|
84
|
-
return pre + cur
|
85
|
-
}, 0)
|
86
|
-
positionTotal.push(preTotal)
|
87
|
-
})
|
88
|
-
|
89
|
-
this.positionList = positionList
|
90
|
-
this.positionTotal = positionTotal
|
91
|
-
this.judgeSwiper()
|
92
|
-
})
|
93
|
-
},
|
94
|
-
methods: {
|
95
|
-
judgeSwiper() {
|
96
|
-
let list = this.attributeJson.list
|
97
|
-
let index = list.findIndex(item => {
|
98
|
-
return item.picList.length != 0 || item.videoInfo.list.length != 0
|
99
|
-
})
|
100
|
-
this.hasSwiperItem = index > -1
|
101
|
-
if (this.hasSwiperItem) {
|
102
|
-
list.forEach((item, index)=>{
|
103
|
-
item.i = index
|
104
|
-
})
|
105
|
-
let item = JSON.parse(JSON.stringify(list))
|
106
|
-
this.swiperList = list.concat(JSON.parse(JSON.stringify(item)))
|
107
|
-
this.swiperList = item.concat(this.swiperList)
|
108
|
-
// 初始化轮播
|
109
|
-
this.initSwiper(true)
|
110
|
-
}
|
111
|
-
},
|
112
|
-
initSwiper: function(flag) {
|
113
|
-
if (this.hasSwiperItem || (this.bgStyle.status === 1 && this.bgStyle.picList.length != 0)) {
|
114
|
-
this.$nextTick(() => {
|
115
|
-
if (this.swiper) {
|
116
|
-
this.swiper.destroy(true, true)
|
117
|
-
this.swiper = null
|
118
|
-
}
|
119
|
-
let { attributeJson } = this
|
120
|
-
this.options = {
|
121
|
-
effect: 'slide',
|
122
|
-
// loop: true,
|
123
|
-
observer: true,
|
124
|
-
observeParents: true,
|
125
|
-
preventInteractionOnTransition: true,
|
126
|
-
autoplay: attributeJson.autoPlay
|
127
|
-
? {
|
128
|
-
delay: attributeJson.interval * 1000,
|
129
|
-
disableOnInteraction: true,
|
130
|
-
stopOnLastSlide: false
|
131
|
-
}
|
132
|
-
: false
|
133
|
-
}
|
134
|
-
if(this.mode == 'mobile' && this.styleType == 2) {
|
135
|
-
this.options.spaceBetween = 10
|
136
|
-
this.options.loop = false
|
137
|
-
this.options.slidesPerView = 'auto'
|
138
|
-
this.options.centeredSlides = true
|
139
|
-
}
|
140
|
-
|
141
|
-
// 导航按钮定义
|
142
|
-
if (this.hasSwiperButton) {
|
143
|
-
this.options.navigation = {
|
144
|
-
nextEl: `.swiper-button-next-${this.sortId}`,
|
145
|
-
prevEl: `.swiper-button-prev-${this.sortId}`
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
let that = this
|
150
|
-
let slideLen = this.list.length
|
151
|
-
this.options.on = {
|
152
|
-
slideChangeTransitionEnd: function(){
|
153
|
-
//切换结束时,告诉我现在是第几个slide
|
154
|
-
that.activeIndex = this.activeIndex
|
155
|
-
that.slideIndex = that.swiperList[this.activeIndex].i
|
156
|
-
|
157
|
-
},
|
158
|
-
slideNextTransitionEnd: function () {
|
159
|
-
if(this.activeIndex == slideLen *2 ) {
|
160
|
-
this.slideTo(slideLen, 0)
|
161
|
-
}
|
162
|
-
},
|
163
|
-
slidePrevTransitionEnd: function() {
|
164
|
-
if(this.activeIndex == slideLen - 1 ) {
|
165
|
-
this.slideTo(slideLen *2 - 1, 0)
|
166
|
-
}
|
167
|
-
}
|
168
|
-
}
|
169
|
-
this.swiper = new Swiper(`.swiper-container-${this.sortId}`, this.options)
|
170
|
-
if(this.swiper instanceof Array) {
|
171
|
-
this.swiper.forEach(item=>{
|
172
|
-
item.slideTo(slideLen, 0)
|
173
|
-
})
|
174
|
-
} else {
|
175
|
-
this.swiper.slideTo(slideLen, 0)
|
176
|
-
}
|
177
|
-
if(flag) {
|
178
|
-
this.reportData(this.windowHeight)
|
179
|
-
}
|
180
|
-
})
|
181
|
-
}
|
182
|
-
},
|
183
|
-
swiperSlide(i) {
|
184
|
-
this.swiper.slideTo(i)
|
185
|
-
this.slideIndex = i
|
186
|
-
},
|
187
|
-
// 上报数据
|
188
|
-
reportData(h) {
|
189
|
-
this.windowHeight = h
|
190
|
-
let ref = this.$refs[`swiper${this.attributeJson.sort}`]
|
191
|
-
if(!ref || ref.style.display == 'none') return
|
192
|
-
if(!this.hasInitSwiper && this.enterClass) {
|
193
|
-
this.hasInitSwiper = true
|
194
|
-
this.initSwiper()
|
195
|
-
}
|
196
|
-
let el = ref.getBoundingClientRect()
|
197
|
-
if(el.top <= h) {
|
198
|
-
this.list.forEach((item, i) => {
|
199
|
-
if(item.isReport) return
|
200
|
-
if ((item.type == 1 && item.popList.length!=0)||(item.videoHotInfo.popList.length!=0)) {
|
201
|
-
this.$refs[`hotspot${this.sortId}${i}`][0].reportData(h, this.positionTotal[i])
|
202
|
-
return
|
203
|
-
}
|
204
|
-
item.isReport = true
|
205
|
-
this.dataSend(item, this.positionTotal[i])
|
206
|
-
})
|
207
|
-
}
|
208
|
-
},
|
209
|
-
dataSend(item, preTotal) {
|
210
|
-
dataSaveDecorationPageComponentEventFn(
|
211
|
-
{
|
212
|
-
uniqueId: this.recordId + '_' + this.sortId, // 组件_id
|
213
|
-
uniqueName: this.attributeJson.uniqueName, // 组件_名称
|
214
|
-
componentType: 1,
|
215
|
-
popData: {},
|
216
|
-
materialId: this.recordId+ '_' + this.sortId + '_' + item.sort, //素材id
|
217
|
-
materialName: item.uniqueName, //素材名称
|
218
|
-
refererPagePath: this.refererPagePath,
|
219
|
-
brand: this.brand,
|
220
|
-
path: this.path,
|
221
|
-
position: preTotal + 1,
|
222
|
-
event: 'bannerShow'
|
223
|
-
},
|
224
|
-
this.envUrl
|
225
|
-
)
|
226
|
-
}
|
227
|
-
}
|
228
|
-
}
|