baiqiu-cms-decoration-dg 0.0.22 → 0.0.24
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/README.md +24 -0
- package/babel.config.js +5 -0
- package/{baiqiu-cms-decoration-dg.common.js → lib/baiqiu-cms-decoration-dg.common.js} +24 -24
- package/{baiqiu-cms-decoration-dg.common.js.map → lib/baiqiu-cms-decoration-dg.common.js.map} +1 -1
- package/{baiqiu-cms-decoration-dg.css → lib/baiqiu-cms-decoration-dg.css} +1 -1
- package/{baiqiu-cms-decoration-dg.umd.js → lib/baiqiu-cms-decoration-dg.umd.js} +24 -24
- package/{baiqiu-cms-decoration-dg.umd.js.map → lib/baiqiu-cms-decoration-dg.umd.js.map} +1 -1
- package/{baiqiu-cms-decoration-dg.umd.min.js → lib/baiqiu-cms-decoration-dg.umd.min.js} +4 -4
- package/lib/baiqiu-cms-decoration-dg.umd.min.js.map +1 -0
- package/package.json +50 -7
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/src/App.vue +594 -0
- package/src/api/com-service.js +26 -0
- package/src/assets/iconfont/demo.css +539 -0
- package/src/assets/iconfont/iconfont.css +158 -0
- package/src/assets/iconfont/iconfont.eot +0 -0
- package/src/assets/iconfont/iconfont.json +254 -0
- package/src/assets/iconfont/iconfont.svg +89 -0
- 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/icon.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 +19 -0
- package/src/components/cms/buttonItem/buttonItem.js +135 -0
- package/src/components/cms/buttonItem/buttonItem.scss +95 -0
- package/src/components/cms/buttonItem/buttonItem.vue +47 -0
- package/src/components/cms/buttonItem/index.js +2 -0
- package/src/components/cms/cms.js +105 -0
- package/src/components/cms/cms.scss +46 -0
- package/src/components/cms/cms.vue +51 -0
- package/src/components/cms/customLayout/customLayout.js +46 -0
- package/src/components/cms/customLayout/customLayout.scss +8 -0
- package/src/components/cms/customLayout/customLayout.vue +15 -0
- package/src/components/cms/customLayout/index.js +2 -0
- package/src/components/cms/hotspot/hotspot.js +200 -0
- package/src/components/cms/hotspot/hotspot.scss +20 -0
- package/src/components/cms/hotspot/hotspot.vue +35 -0
- package/src/components/cms/hotspot/index.js +2 -0
- package/src/components/cms/imgNav/imgNav.js +176 -0
- package/src/components/cms/imgNav/imgNav.scss +113 -0
- package/src/components/cms/imgNav/imgNav.vue +123 -0
- package/src/components/cms/imgNav/index.js +2 -0
- package/src/components/cms/index.js +2 -0
- package/src/components/cms/mixin.js +239 -0
- package/src/components/cms/multipleLayout/index.js +2 -0
- package/src/components/cms/multipleLayout/multipleLayout.js +54 -0
- package/src/components/cms/multipleLayout/multipleLayout.scss +21 -0
- package/src/components/cms/multipleLayout/multipleLayout.vue +25 -0
- package/src/components/cms/productItem/index.js +2 -0
- package/src/components/cms/productItem/productItem.js +290 -0
- package/src/components/cms/productItem/productItem.scss +180 -0
- package/src/components/cms/productItem/productItem.vue +117 -0
- package/src/components/cms/singleLayout/index.js +2 -0
- package/src/components/cms/singleLayout/singleLayout.js +69 -0
- package/src/components/cms/singleLayout/singleLayout.scss +21 -0
- package/src/components/cms/singleLayout/singleLayout.vue +39 -0
- package/src/components/cms/slideLayout/index.js +2 -0
- package/src/components/cms/slideLayout/slideLayout.js +248 -0
- package/src/components/cms/slideLayout/slideLayout.scss +18 -0
- package/src/components/cms/slideLayout/slideLayout.vue +44 -0
- package/src/components/cms/swiperItem/index.js +2 -0
- package/src/components/cms/swiperItem/swiperItem.js +228 -0
- package/src/components/cms/swiperItem/swiperItem.scss +204 -0
- package/src/components/cms/swiperItem/swiperItem.vue +123 -0
- package/src/components/cms/tabLayout/index.js +2 -0
- package/src/components/cms/tabLayout/navItem/index.js +2 -0
- package/src/components/cms/tabLayout/navItem/navItem.js +47 -0
- package/src/components/cms/tabLayout/navItem/navItem.scss +23 -0
- package/src/components/cms/tabLayout/navItem/navItem.vue +13 -0
- package/src/components/cms/tabLayout/tabLayout.js +158 -0
- package/src/components/cms/tabLayout/tabLayout.scss +26 -0
- package/src/components/cms/tabLayout/tabLayout.vue +43 -0
- package/src/components/cms/textItem/index.js +2 -0
- package/src/components/cms/textItem/textItem.js +65 -0
- package/src/components/cms/textItem/textItem.scss +19 -0
- package/src/components/cms/textItem/textItem.vue +26 -0
- package/src/components/cms/utils.js +101 -0
- package/src/components/cms/videoItem/index.js +2 -0
- package/src/components/cms/videoItem/videoItem.js +96 -0
- package/src/components/cms/videoItem/videoItem.scss +27 -0
- package/src/components/cms/videoItem/videoItem.vue +56 -0
- package/src/components/cms/videoPlayer/index.js +2 -0
- package/src/components/cms/videoPlayer/videoPlayer.js +68 -0
- package/src/components/cms/videoPlayer/videoPlayer.scss +37 -0
- package/src/components/cms/videoPlayer/videoPlayer.vue +34 -0
- package/src/index.js +19 -0
- package/src/index.scss +221 -0
- package/src/main.js +8 -0
- package/src/utils/common.js +23 -0
- package/src/utils/http-client.js +101 -0
- package/src/utils/utils.js +63 -0
- package/baiqiu-cms-decoration-dg.umd.min.js.map +0 -1
- /package/{demo.html → lib/demo.html} +0 -0
- /package/{fonts → lib/fonts}/iconfont.529b3ed0.ttf +0 -0
- /package/{fonts → lib/fonts}/iconfont.580c918e.eot +0 -0
- /package/{fonts → lib/fonts}/iconfont.ea5b1aa2.woff +0 -0
- /package/{img → lib/img}/iconfont.654cc65b.svg +0 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
import { cmsMixin } from "../mixin";
|
2
|
+
import { dataSaveDecorationPageComponentEventFn } from "../../../utils/utils";
|
3
|
+
export default {
|
4
|
+
name: "textItem",
|
5
|
+
mixins: [cmsMixin],
|
6
|
+
components: {},
|
7
|
+
props: {},
|
8
|
+
data() {
|
9
|
+
return {};
|
10
|
+
},
|
11
|
+
watch: {},
|
12
|
+
methods: {
|
13
|
+
pageClick() {
|
14
|
+
if (this.attributeJson.linkObj.jumpLinkType) {
|
15
|
+
try {
|
16
|
+
dataSaveDecorationPageComponentEventFn(
|
17
|
+
{
|
18
|
+
uniqueId: this.recordId + "_" + this.sortId, // 组件_id
|
19
|
+
uniqueName: this.attributeJson.uniqueName, // 组件_名称
|
20
|
+
componentType: 12,
|
21
|
+
popData: {},
|
22
|
+
materialId: this.recordId + "_" + this.sortId, //素材id
|
23
|
+
materialName: this.attributeJson.uniqueName, //素材名称
|
24
|
+
refererPagePath: this.refererPagePath,
|
25
|
+
brand: this.brand,
|
26
|
+
path: this.path,
|
27
|
+
position: 1,
|
28
|
+
event: "bannerClick",
|
29
|
+
},
|
30
|
+
this.envUrl
|
31
|
+
);
|
32
|
+
} catch (err) {
|
33
|
+
console.log(err)
|
34
|
+
}
|
35
|
+
}
|
36
|
+
this.$emit("jumpLink", this.attributeJson.linkObj);
|
37
|
+
},
|
38
|
+
// 上报数据
|
39
|
+
reportData(h) {
|
40
|
+
if (this.isReport) return;
|
41
|
+
let ref = this.$refs[`text${this.attributeJson.sort}`];
|
42
|
+
if (!ref || ref.style.display == "none") return;
|
43
|
+
let el = ref.getBoundingClientRect();
|
44
|
+
if (el.top <= h) {
|
45
|
+
this.isReport = true;
|
46
|
+
dataSaveDecorationPageComponentEventFn(
|
47
|
+
{
|
48
|
+
uniqueId: this.recordId + "_" + this.sortId, // 组件_id
|
49
|
+
uniqueName: this.attributeJson.uniqueName, // 组件_名称
|
50
|
+
componentType: 12,
|
51
|
+
popData: {},
|
52
|
+
materialId: this.recordId + "_" + this.sortId, //素材id
|
53
|
+
materialName: this.attributeJson.uniqueName, //素材名称
|
54
|
+
refererPagePath: this.refererPagePath,
|
55
|
+
brand: this.brand,
|
56
|
+
path: this.path,
|
57
|
+
position: 1,
|
58
|
+
event: "bannerShow",
|
59
|
+
},
|
60
|
+
this.envUrl
|
61
|
+
);
|
62
|
+
}
|
63
|
+
},
|
64
|
+
},
|
65
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.text-wrap {
|
2
|
+
position: absolute;
|
3
|
+
border: none;
|
4
|
+
touch-action: auto;
|
5
|
+
overflow: hidden;
|
6
|
+
.entrance-con {
|
7
|
+
position: relative;
|
8
|
+
width: 100%;
|
9
|
+
height: 100%;
|
10
|
+
}
|
11
|
+
|
12
|
+
.text-con {
|
13
|
+
position: relative;
|
14
|
+
width: 100%;
|
15
|
+
height: 100%;
|
16
|
+
font-size: 14px;
|
17
|
+
overflow: hidden;
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
:style="{
|
4
|
+
width: Math.round(attributeJson.baseStyle.w * ratio) + 'px',
|
5
|
+
height: Math.round(attributeJson.baseStyle.h * ratio) + 'px',
|
6
|
+
left: Math.round(attributeJson.baseStyle.l * ratio) + 'px',
|
7
|
+
top: Math.round(attributeJson.baseStyle.t * ratio) + 'px'
|
8
|
+
}"
|
9
|
+
class="text-wrap"
|
10
|
+
>
|
11
|
+
<div v-if="attributeJson.label">
|
12
|
+
<div class="entrance-con editor-richTextWrap" @click="pageClick">
|
13
|
+
<div :ref="`text${attributeJson.sort}`" :class="['text-con', `text-con-${sortId}`, animationInObj.type ? enterClass : '']" v-show="entranceShow" v-html="attributeJson.label" :style="{ animationDuration: `${animationInObj.duration}s` }"></div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</template>
|
18
|
+
|
19
|
+
<script>
|
20
|
+
import textItemJs from './textItem.js'
|
21
|
+
export default textItemJs
|
22
|
+
</script>
|
23
|
+
|
24
|
+
<style lang="scss" scoped>
|
25
|
+
@import 'textItem';
|
26
|
+
</style>
|
@@ -0,0 +1,101 @@
|
|
1
|
+
//防抖
|
2
|
+
export function debounce(fn, wait=500, immediate=false) {
|
3
|
+
let timer, startTimeStamp=0;
|
4
|
+
let context, args;
|
5
|
+
|
6
|
+
let run = (timerInterval)=>{
|
7
|
+
timer= setTimeout(()=>{
|
8
|
+
let now = (new Date()).getTime();
|
9
|
+
let interval=now-startTimeStamp
|
10
|
+
if(interval<timerInterval){ // the timer start time has been reset,so the interval is less than timerInterval
|
11
|
+
// console.log('debounce reset',timerInterval-interval);
|
12
|
+
startTimeStamp=now;
|
13
|
+
run(wait-interval); // reset timer for left time
|
14
|
+
}else{
|
15
|
+
if(!immediate){
|
16
|
+
fn.apply(context,args);
|
17
|
+
}
|
18
|
+
clearTimeout(timer);
|
19
|
+
timer=null;
|
20
|
+
}
|
21
|
+
|
22
|
+
},timerInterval);
|
23
|
+
}
|
24
|
+
|
25
|
+
return function() {
|
26
|
+
context = this;
|
27
|
+
args = arguments;
|
28
|
+
let now = (new Date()).getTime();
|
29
|
+
startTimeStamp = now; // set timer start time
|
30
|
+
|
31
|
+
if (!timer) {
|
32
|
+
// console.log('debounce set', wait);
|
33
|
+
if (immediate) {
|
34
|
+
fn.apply(context, args);
|
35
|
+
}
|
36
|
+
run(wait); // last timer alreay executed, set a new timer
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
export function throttle(func, wait) {
|
42
|
+
|
43
|
+
var timer = null;
|
44
|
+
var startTime = Date.now();
|
45
|
+
|
46
|
+
return function(){
|
47
|
+
var curTime = Date.now();
|
48
|
+
var remaining = wait-(curTime-startTime);
|
49
|
+
var context = this;
|
50
|
+
var args = arguments;
|
51
|
+
|
52
|
+
clearTimeout(timer);
|
53
|
+
|
54
|
+
if(remaining<=0){
|
55
|
+
func.apply(context, args);
|
56
|
+
|
57
|
+
startTime = Date.now();
|
58
|
+
|
59
|
+
}else{
|
60
|
+
timer = setTimeout(func, remaining); // 如果小于wait 保证在差值时间后执行
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
export function navigateJump(params) {
|
67
|
+
let path = ''
|
68
|
+
let jumpLinkDic = {
|
69
|
+
defaultPath: {
|
70
|
+
1: '/productDetail/', //商品详情
|
71
|
+
2: '/productList', //商品列表
|
72
|
+
9: '/articleList/', //文章列表
|
73
|
+
10: '/articleDetail/' //文章详情
|
74
|
+
}
|
75
|
+
}
|
76
|
+
switch (params.brand) {
|
77
|
+
case 'defaultPath':
|
78
|
+
path = `${jumpLinkDic[params.brand][params.jumpLinkType]}${defaultPathParams(params)}`
|
79
|
+
break
|
80
|
+
}
|
81
|
+
return path
|
82
|
+
}
|
83
|
+
|
84
|
+
function defaultPathParams(params) {
|
85
|
+
let code = ''
|
86
|
+
switch (params.jumpLinkType) {
|
87
|
+
case 1:
|
88
|
+
code = `${params.productCode}?colorCode=${params.colorCode}`
|
89
|
+
break
|
90
|
+
case 2:
|
91
|
+
code = `?categoryId=${params.categoryCode}`
|
92
|
+
break
|
93
|
+
case 9:
|
94
|
+
code = ''
|
95
|
+
break
|
96
|
+
case 10:
|
97
|
+
code = `${params.articleCode}`
|
98
|
+
break
|
99
|
+
}
|
100
|
+
return code
|
101
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { cmsMixin } from "../mixin";
|
2
|
+
import hotspot from "../hotspot/";
|
3
|
+
import videoPlayer from '../videoPlayer/'
|
4
|
+
import { dataSaveDecorationPageComponentEventFn } from '../../../utils/utils';
|
5
|
+
|
6
|
+
export default {
|
7
|
+
name: 'videoItem',
|
8
|
+
mixins: [cmsMixin],
|
9
|
+
components: {
|
10
|
+
hotspot,
|
11
|
+
myVideoPlayer: videoPlayer
|
12
|
+
},
|
13
|
+
props:{
|
14
|
+
attributeJson: {
|
15
|
+
type: Object,
|
16
|
+
default: function() {}
|
17
|
+
},
|
18
|
+
ratio: {
|
19
|
+
type: Number,
|
20
|
+
default: 1,
|
21
|
+
positionList: []
|
22
|
+
}
|
23
|
+
},
|
24
|
+
data() {
|
25
|
+
return {
|
26
|
+
autoPlay: false
|
27
|
+
}
|
28
|
+
},
|
29
|
+
watch: {
|
30
|
+
'videoInfo.checkedAttr': {
|
31
|
+
handler(val) {
|
32
|
+
this.autoPlay = val.indexOf('autoPlay') > -1
|
33
|
+
},
|
34
|
+
immediate: true,
|
35
|
+
deep: true
|
36
|
+
},
|
37
|
+
},
|
38
|
+
computed: {
|
39
|
+
videoItem() {
|
40
|
+
return this.attributeJson.videoInfo.list
|
41
|
+
},
|
42
|
+
videoHotPic() {
|
43
|
+
return this.attributeJson.videoHotInfo.picList
|
44
|
+
},
|
45
|
+
videoHotPop() {
|
46
|
+
return this.attributeJson.videoHotInfo.popList
|
47
|
+
},
|
48
|
+
videoInfo() {
|
49
|
+
return this.attributeJson.videoInfo
|
50
|
+
},
|
51
|
+
hotData() {
|
52
|
+
let {attributeJson} = this
|
53
|
+
return {
|
54
|
+
popList: attributeJson.videoHotInfo.popList,
|
55
|
+
width: attributeJson.videoHotInfo.picList[0].width,
|
56
|
+
height: attributeJson.videoHotInfo.picList[0].height,
|
57
|
+
realWidth: attributeJson.baseStyle.w,
|
58
|
+
realHeight: attributeJson.baseStyle.h,
|
59
|
+
top: 0,
|
60
|
+
left: 0
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
methods: {
|
65
|
+
// 上报数据
|
66
|
+
reportData(h) {
|
67
|
+
if(this.attributeJson.isVideoHasHot == 1) {
|
68
|
+
this.$refs.hotspot&&this.$refs.hotspot.reportData(h, 0)
|
69
|
+
return
|
70
|
+
}
|
71
|
+
if(this.isReport) return
|
72
|
+
let ref = this.$refs[`video${this.attributeJson.sort}`]
|
73
|
+
if( !ref || ref.style.display == 'none') return
|
74
|
+
let el = ref.getBoundingClientRect()
|
75
|
+
if(el.top <= h) {
|
76
|
+
this.isReport = true
|
77
|
+
dataSaveDecorationPageComponentEventFn(
|
78
|
+
{
|
79
|
+
uniqueId: this.recordId + '_' + this.sortId, // 组件_id
|
80
|
+
uniqueName: this.attributeJson.uniqueName, // 组件_名称
|
81
|
+
componentType: 3,
|
82
|
+
popData: {},
|
83
|
+
materialId: this.recordId + '_' + this.sortId, //素材id
|
84
|
+
materialName: this.attributeJson.uniqueName, //素材名称
|
85
|
+
refererPagePath: this.refererPagePath,
|
86
|
+
brand: this.brand,
|
87
|
+
path: this.path,
|
88
|
+
event: 'bannerShow',
|
89
|
+
position: 1
|
90
|
+
},
|
91
|
+
this.envUrl
|
92
|
+
)
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.video-wrap {
|
2
|
+
border: none;
|
3
|
+
touch-action: auto;
|
4
|
+
position: absolute;
|
5
|
+
.entrance-con {
|
6
|
+
position: relative;
|
7
|
+
width: 100%;
|
8
|
+
height: 100%;
|
9
|
+
overflow: hidden;
|
10
|
+
}
|
11
|
+
|
12
|
+
.video-con {
|
13
|
+
position: relative;
|
14
|
+
|
15
|
+
.hot-image {
|
16
|
+
position: absolute;
|
17
|
+
left: 0;
|
18
|
+
top: 0;
|
19
|
+
width: 100%;
|
20
|
+
height: 100%;
|
21
|
+
img {
|
22
|
+
width: 100%;
|
23
|
+
height: 100%;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
:style="{
|
4
|
+
width: Math.round(attributeJson.baseStyle.w * ratio) + 'px',
|
5
|
+
height: Math.round(attributeJson.baseStyle.h * ratio) + 'px',
|
6
|
+
left: Math.round(attributeJson.baseStyle.l * ratio) + 'px',
|
7
|
+
top: Math.round(attributeJson.baseStyle.t * ratio) + 'px'
|
8
|
+
}"
|
9
|
+
class="video-wrap"
|
10
|
+
>
|
11
|
+
|
12
|
+
<div v-if="videoItem.length !== 0">
|
13
|
+
<div class="entrance-con">
|
14
|
+
<div
|
15
|
+
:class="['video-con', `video-con-${sortId}`, animationInObj.type ? enterClass : '']"
|
16
|
+
:ref="`video${attributeJson.sort}`"
|
17
|
+
v-show="entranceShow"
|
18
|
+
:style="{
|
19
|
+
width: Math.round(attributeJson.baseStyle.w * ratio) + 'px',
|
20
|
+
height: Math.round(attributeJson.baseStyle.h * ratio) + 'px',
|
21
|
+
animationDuration: `${animationInObj.duration}s`
|
22
|
+
}">
|
23
|
+
|
24
|
+
<myVideoPlayer :sort="new Date().getTime()" :videoInfo="videoInfo" :autoPlay="autoPlay"></myVideoPlayer>
|
25
|
+
<!-- 热区图片 -->
|
26
|
+
<div class="hot-image" v-if="attributeJson.isVideoHasHot === 1 && videoHotPic.length != 0">
|
27
|
+
<img :src="videoHotPic[0].resourcePath" alt="" />
|
28
|
+
<hotspot
|
29
|
+
ref="hotspot"
|
30
|
+
v-bind="$attrs"
|
31
|
+
v-on="$listeners"
|
32
|
+
:componentType="3"
|
33
|
+
:item="hotData"
|
34
|
+
:ratio="ratio"
|
35
|
+
:envUrl="envUrl"
|
36
|
+
:language="language"
|
37
|
+
:recordId="recordId"
|
38
|
+
:sortId="sortId"
|
39
|
+
:path="path"
|
40
|
+
:brand="brand"
|
41
|
+
:uniqueName="attributeJson.uniqueName"></hotspot>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
</template>
|
48
|
+
|
49
|
+
<script>
|
50
|
+
import videoItemJs from "./videoItem.js";
|
51
|
+
export default videoItemJs;
|
52
|
+
</script>
|
53
|
+
|
54
|
+
<style lang="scss" scoped>
|
55
|
+
@import "videoItem";
|
56
|
+
</style>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import videojs from "video.js"
|
2
|
+
export default {
|
3
|
+
name: 'videoPlayer',
|
4
|
+
props: {
|
5
|
+
videoInfo: {
|
6
|
+
type: Object,
|
7
|
+
default: () => {}
|
8
|
+
},
|
9
|
+
autoPlay: {
|
10
|
+
type: Boolean,
|
11
|
+
default: false
|
12
|
+
},
|
13
|
+
sort: {
|
14
|
+
type: Number,
|
15
|
+
default: 0
|
16
|
+
}
|
17
|
+
},
|
18
|
+
data() {
|
19
|
+
return {
|
20
|
+
isPlay: false, // 是否正在播放
|
21
|
+
}
|
22
|
+
},
|
23
|
+
watch: {
|
24
|
+
autoPlay: {
|
25
|
+
handler(n) {
|
26
|
+
if(this.player) {
|
27
|
+
if(n) {
|
28
|
+
this.player.play()
|
29
|
+
} else {
|
30
|
+
this.player.pause()
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
immediate: true
|
35
|
+
}
|
36
|
+
},
|
37
|
+
mounted() {
|
38
|
+
let that = this
|
39
|
+
setTimeout(()=>{
|
40
|
+
this.player = videojs(this.$refs[`myVideo-${this.sort}`], {}, function() {
|
41
|
+
this.on("play", () => {
|
42
|
+
that.isPlay = true
|
43
|
+
});
|
44
|
+
this.on("pause", () => {
|
45
|
+
that.isPlay = false
|
46
|
+
});
|
47
|
+
})
|
48
|
+
this.$nextTick(()=>{
|
49
|
+
this.play()
|
50
|
+
});
|
51
|
+
}, 50)
|
52
|
+
|
53
|
+
},
|
54
|
+
methods: {
|
55
|
+
play() {
|
56
|
+
if(this.videoInfo.list.length!=0 && this.autoPlay) {
|
57
|
+
this.player.play()
|
58
|
+
}
|
59
|
+
},
|
60
|
+
clickVideo() {
|
61
|
+
if (this.isPlay) {
|
62
|
+
this.player.pause();
|
63
|
+
} else {
|
64
|
+
this.player.play()
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
.video-item{
|
2
|
+
width: 100%!important;
|
3
|
+
height: 100%!important;
|
4
|
+
object-fit: cover;
|
5
|
+
}
|
6
|
+
|
7
|
+
.video-cover {
|
8
|
+
position: absolute;
|
9
|
+
width: 100%;
|
10
|
+
height: 100%;
|
11
|
+
top: 0;
|
12
|
+
left: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.cover-btn {
|
16
|
+
position: absolute;
|
17
|
+
width: 80px;
|
18
|
+
height: 80px;
|
19
|
+
border-radius: 50%;
|
20
|
+
top: 50%;
|
21
|
+
left: 50%;
|
22
|
+
transform: translate(-50%, -50%);
|
23
|
+
background-color: rgba(0,0,0,0.6);
|
24
|
+
display: flex;
|
25
|
+
align-items: center;
|
26
|
+
justify-content: center;
|
27
|
+
}
|
28
|
+
|
29
|
+
.cover-btn .cms2iconfont{
|
30
|
+
color: #fff;
|
31
|
+
font-size: 32px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.cover-btn .iconbofang {
|
35
|
+
position: relative;
|
36
|
+
left: 2px;
|
37
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<template>
|
2
|
+
<div style="height: 100%;position: relative;">
|
3
|
+
<video
|
4
|
+
:ref="`myVideo-${sort}`"
|
5
|
+
preload="auto"
|
6
|
+
data-setup="{}"
|
7
|
+
x5-playsinline
|
8
|
+
x5-video-orientation="landscape|portrait"
|
9
|
+
x5-video-player-type="h5"
|
10
|
+
webkit-playsinline="true"
|
11
|
+
playsinline="true"
|
12
|
+
:controls="videoInfo.checkedAttr.indexOf('controls') > -1"
|
13
|
+
:autoplay="autoPlay"
|
14
|
+
:loop="videoInfo.checkedAttr.indexOf('loop') > -1"
|
15
|
+
muted
|
16
|
+
:poster="videoInfo.list.length != 0 ? videoInfo.list[0].imgUrl : ''"
|
17
|
+
class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9 video-item"
|
18
|
+
>
|
19
|
+
<source
|
20
|
+
:src="videoInfo.list.length != 0 ? videoInfo.list[0].resourcePath : ''"
|
21
|
+
/>
|
22
|
+
</video>
|
23
|
+
<div @click="clickVideo" class="video-cover" v-if="videoInfo.checkedAttr.indexOf('controls') < 0"></div>
|
24
|
+
</div>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<script>
|
28
|
+
import videoPlayerJs from "./videoPlayer.js";
|
29
|
+
export default videoPlayerJs;
|
30
|
+
</script>
|
31
|
+
|
32
|
+
<style lang="scss" scoped>
|
33
|
+
@import "videoPlayer";
|
34
|
+
</style>
|
package/src/index.js
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
import cms from './components/cms/'
|
2
|
+
const components = [
|
3
|
+
cms
|
4
|
+
]
|
5
|
+
const install = function (Vue) {
|
6
|
+
// 判断是否安装
|
7
|
+
if (install.installed) return
|
8
|
+
// 遍历注册全局组件
|
9
|
+
components.map(component => Vue.component(component.name, component));
|
10
|
+
}
|
11
|
+
|
12
|
+
export default {
|
13
|
+
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
|
14
|
+
install
|
15
|
+
}
|
16
|
+
|
17
|
+
export {
|
18
|
+
cms
|
19
|
+
}
|