dever 3 years ago
parent
commit
c46f2f761d
2 changed files with 225 additions and 222 deletions
  1. 184 184
      lib/dever/components/video.nvue
  2. 41 38
      pages/dream/view/vodShort.vue

+ 184 - 184
lib/dever/components/video.nvue

@@ -5,7 +5,7 @@
 				:src="src"
 				preload="auto"
 				:initial-time="initial_time"
-				:autoplay="false"
+				:autoplay="false"
 				:show-mute-btn="true"
 				:muted="muted"
 				:show-play-btn="true"
@@ -18,16 +18,16 @@
 				play-btn-position="center"
 				class="video"
 				:playsinline="true"
-				:webkit-playsinline="true"
-				:x5-video-player-fullscreen="true"
+				:webkit-playsinline="true"
+				:x5-video-player-fullscreen="true"
 				:x5-playsinline="true"
 				x-webkit-airplay="allow"
 				x5-video-player-type="h5-page"
-				:page-gesture="false"
-				:poster="pic"
-				@timeupdate="timeUpdate"
-				@play="onPlay"
-				@pause="onPause"
+				:page-gesture="false"
+				:poster="pic"
+				@timeupdate="timeUpdate"
+				@play="onPlay"
+				@pause="onPause"
 				@ended="onPause"
 				>
 			</video>
@@ -96,10 +96,10 @@ export default {
 		control : {
 			type    : Boolean,
 			value	: false
-		},
-		disabled : {
-			type    : Boolean,
-			value	: false
+		},
+		disabled : {
+			type    : Boolean,
+			value	: false
 		},
 		position_item : {
 			type    : Array,
@@ -108,10 +108,10 @@ export default {
 		position_save : {
 			type    : String,
 			value	: null
-		},
-		type : {
-			type    : String,
-			value	: 1
+		},
+		type : {
+			type    : String,
+			value	: 1
 		},
 	},
 	data() {
@@ -123,14 +123,14 @@ export default {
 			poster : true,
 			video : false,
 			showInfo : false,
-			initial_time : 0,
-			time : {},
+			initial_time : 0,
+			time : {},
 			control_style : '',
 		};
 	},
-	mounted() {
-		if (this.type == 2) {
-			this.objectFit = '';
+	mounted() {
+		if (this.type == 2) {
+			this.objectFit = '';
 		}
 		var time = this.Dever.data('video_' + this.vid);
 		if (time) {
@@ -146,41 +146,41 @@ export default {
 		//获取video_id
 		id : function()  {
 			return 'video_' + this.vid + '_' + this.index;
-		},
-		onPlay : function() {
-			if (this.control) {
-				this.control_style = 'height:0%;width:0%';
-				this.setStart();
-			}
-		},
-		onPause : function() {
-			if (this.control) {
-				this.control_style = 'height:100%;width:100%';
-				this.stop(true);
-			}
-		},
-		setStart : function() {
-			this.$emit('update:load', true);
-			this.$emit('play', 'start');
-			this.poster = false;
-			this.play = true;
-			this.playButton = true;
-			this.muted = false;
-		},
-		autoStart : function() {
-			//h5下无法自动播放,这里考虑使用先静音播放
-			this.muted = true;
-			this.video.play();
-			this.video.currentTime = 0;
-			this.video.pause();
 		},
-		start : function()  {
-			if (this.disabled) {
-				this.Dever.alert('无权限播放,请先购买座位');
-				return;
-			}
-			this.setStart();
-			this.Dever.bgm().stop();
+		onPlay : function() {
+			if (this.control) {
+				this.control_style = 'height:0%;width:0%';
+				this.setStart();
+			}
+		},
+		onPause : function() {
+			if (this.control) {
+				this.control_style = 'height:100%;width:100%';
+				this.stop(true);
+			}
+		},
+		setStart : function() {
+			this.$emit('update:load', true);
+			this.$emit('play', 'start');
+			this.poster = false;
+			this.play = true;
+			this.playButton = true;
+			this.muted = false;
+		},
+		autoStart : function() {
+			//h5下无法自动播放,这里考虑使用先静音播放
+			this.muted = true;
+			this.video.play();
+			this.video.currentTime = 0;
+			this.video.pause();
+		},
+		start : function()  {
+			if (this.disabled) {
+				this.Dever.alert('无权限播放,请先购买座位');
+				return;
+			}
+			this.setStart();
+			this.Dever.bgm().stop();
 			this.video.play();
 		},
 		stop : function(state) {
@@ -199,7 +199,7 @@ export default {
 				*/
 			}
 			this.muted = true;
-			this.play = false;
+			this.play = false;
 			this.$emit('play', 'stop');
 		},
 		open : function()  {
@@ -208,29 +208,29 @@ export default {
 			} else {
 				this.stop(true);
 			}
-		},
-		tapMsg : function(e)  {
-			console.log(5, e);
-		},
-		tapShare : function(e) {
-			console.log(6, e);
-		},
-		tapLove : function(e)  {
-			// item.is_dianzan
-			this.item[this.current_index].is_dianzan = !this.item[this.current_index].is_dianzan;
-			console.log(7, e);
-		},
-		timeUpdate : function(e) {
-			if (this.play == true) {
-				var currentTime = e.detail.currentTime;
-				currentTime = parseInt(currentTime);
-				if (!this.time[currentTime]) {
-					this.time[currentTime] = currentTime;
-					this.$emit('play', 'time', [this, currentTime]);
-					//记录播放进度
-					this.Dever.data('video_' + this.vid, this.currentTime);
-				}
-			}
+		},
+		tapMsg : function(e)  {
+			console.log(5, e);
+		},
+		tapShare : function(e) {
+			console.log(6, e);
+		},
+		tapLove : function(e)  {
+			// item.is_dianzan
+			this.item[this.current_index].is_dianzan = !this.item[this.current_index].is_dianzan;
+			console.log(7, e);
+		},
+		timeUpdate : function(e) {
+			if (this.play == true) {
+				var currentTime = e.detail.currentTime;
+				currentTime = parseInt(currentTime);
+				if (!this.time[currentTime]) {
+					this.time[currentTime] = currentTime;
+					this.$emit('play', 'time', [this, currentTime]);
+					//记录播放进度
+					this.Dever.data('video_' + this.vid, this.currentTime);
+				}
+			}
 		}
 	},
 	components:{
@@ -259,31 +259,31 @@ export default {
 	left: 0;
 	top: 0;
 	overflow: hidden;
-}
+}
 .video {
-	/*
-	width: 101%;
+	/*
+	width: 101%;
 	height: 101%;
 	margin-left: -5rpx;
 	margin-top: -5rpx;
 	*/
 	width:100%;
-	height:100%;
+	height:100%;
 	position: relative;
 	background-color: transparent;
-	z-index: 1;
-}
-.uni-video-bar {
-	z-index:10;
-}
-.poster{
-	background-size: cover;
-	position: absolute;
-	left: 0;
-	top: 0;
-	width: 100%;
-	height: 100%;
-}
+	z-index: 1;
+}
+.uni-video-bar {
+	z-index:10;
+}
+.poster{
+	background-size: cover;
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+	height: 100%;
+}
 .ico-video-play{
   background: url(@/static/icon/ico-video-play.png) no-repeat;
   background-size: cover;
@@ -293,93 +293,93 @@ export default {
   left: 50%;
   top: 50%;
   transform: translate3d(-50%,-50%,0);
-}
-.cover-view-left {
-	position: absolute;
-	margin-left: 20upx;
-	width: 580upx;
-	bottom: 110upx;
-	z-index: 9999;
-	font-size: 14px;
-	color: #ffffff;
-}
-.left-text {
-	font-size: 14px;
-	color: #ffffff;
-}
-
-.cover-view-right {
-	position: absolute;
-	bottom: 40px;
-	right: 30upx;
-	z-index: 9999;
-	text-align: center;
-}
-
-.avater {
-	border-radius: 50%;
-	border-width: 2px;
-	border-style: solid;
-	border-color: #ffffff;
-}
-
-.img {
-	height: 90upx;
-	width: 90upx;
-	margin-bottom: 110upx;
-}
-
-.img-left {
-	width: 80upx;
-	height: 66upx;
-	padding-left: 4px;
-}
-.right-follow {
-	position: absolute;
-	z-index: 100;
-	top: 75upx;
-	left: 28upx;
-	color: #ffffff;
-	font-size: 16px;
-	width: 34upx;
-	height: 34upx;
-	background-color: #f12f5b;
-	text-align: center;
-	line-height: 34upx;
-	border-radius: 17upx;
-}
-
-.right-text {
-	color: #ffffff;
-	font-size: 11px;
-	text-align: center;
-	margin-bottom: 40upx;
-}
-.musicIcon {
-	margin-top: 40upx;
-}
-@keyframes rotating {
-	from {
-		transform: rotate(0);
-	}
-	to {
-		transform: rotate(360deg);
-	}
-}
-.view-left-text-content {
-	flex: 1;
-}
-.view-left-text {
-	color: #ffffff;
-	font-size: 18px;
-	margin-bottom: 10upx;
-	font-weight: bold;
-}
-.text-content-text {
-	color: #ffffff;
-	font-size: 16px;
-	line-height: 50upx;
-	height: 100upx;
-	overflow: hidden;
+}
+.cover-view-left {
+	position: absolute;
+	margin-left: 20upx;
+	width: 580upx;
+	bottom: 110upx;
+	z-index: 9999;
+	font-size: 14px;
+	color: #ffffff;
+}
+.left-text {
+	font-size: 14px;
+	color: #ffffff;
+}
+
+.cover-view-right {
+	position: absolute;
+	bottom: 40px;
+	right: 30upx;
+	z-index: 9999;
+	text-align: center;
+}
+
+.avater {
+	border-radius: 50%;
+	border-width: 2px;
+	border-style: solid;
+	border-color: #ffffff;
+}
+
+.img {
+	height: 90upx;
+	width: 90upx;
+	margin-bottom: 110upx;
+}
+
+.img-left {
+	width: 80upx;
+	height: 66upx;
+	padding-left: 4px;
+}
+.right-follow {
+	position: absolute;
+	z-index: 100;
+	top: 75upx;
+	left: 28upx;
+	color: #ffffff;
+	font-size: 16px;
+	width: 34upx;
+	height: 34upx;
+	background-color: #f12f5b;
+	text-align: center;
+	line-height: 34upx;
+	border-radius: 17upx;
+}
+
+.right-text {
+	color: #ffffff;
+	font-size: 11px;
+	text-align: center;
+	margin-bottom: 40upx;
+}
+.musicIcon {
+	margin-top: 40upx;
+}
+@keyframes rotating {
+	from {
+		transform: rotate(0);
+	}
+	to {
+		transform: rotate(360deg);
+	}
+}
+.view-left-text-content {
+	flex: 1;
+}
+.view-left-text {
+	color: #ffffff;
+	font-size: 18px;
+	margin-bottom: 10upx;
+	font-weight: bold;
+}
+.text-content-text {
+	color: #ffffff;
+	font-size: 16px;
+	line-height: 50upx;
+	height: 100upx;
+	overflow: hidden;
 }
 </style>

+ 41 - 38
pages/dream/view/vodShort.vue

@@ -2,73 +2,76 @@
 	<view>
 		<swiper class="swiper" autoplay="false" vertical="true" interval="990000" @change="changeVod" circular="true">
 			<swiper-item v-for="(v, k) in item" :key="k">
-				<dever-video
-				:src="v.video" 
-				:pic="v.pic" 
-				:index="k" 
+				<dever-video
+				:src="v.video" 
+				:pic="v.pic" 
+				:index="k" 
 				:vid="v.id"
 				:type="v.type"
-				:disabled="false"
-				:position_item="v.text"
+				:disabled="false"
+				:position_item="v.text"
 				:position_save="v.is_button"
-				:load.sync="load"
-				ref="video"
-				>
+				:load.sync="load"
+				ref="video"
+				>
 				</dever-video>
 			</swiper-item>
 		</swiper>
-	</view>
-</template>
-
-<script>
+	</view>
+</template>
+
+<script>
 import deverVideo from '@/lib/dever/components/video.nvue';
 var play = true;
 export default {
 	name: "vodShort",
 	props: {
-		control : {
-			type : Object,
-			value : null
+		control : {
+			type : Object,
+			value : null
 		},
 		item : {
 			type    : Array,
 			value	: null
-		},
+		},
 		index : 0
 	},
 	data() {
-		return {
+		return {
 			load : false,
 			current_index: 0,
 		};
 	},
 	created() {
 		
-	},
-	mounted() {
+	},
+	mounted() {
 		this.control[this.index] = this;
 		for(var i in this.$refs.video) {
 			this.$refs.video[i].autoStart();
-		}
+		}
 	},
-	methods:{
+	methods:{
 		start : function() {
+			if (this.Dever.source_id == 3) {
+				return;
+			}
 			for(var i in this.$refs.video) {
 				if (this.current_index == i) {
 					this.$refs.video[this.current_index].start();
 				}
-			}
-		},
-		stop : function() {
-			this.$refs.video[this.current_index].stop(true);
+			}
+		},
+		stop : function() {
+			this.$refs.video[this.current_index].stop(true);
 		},
-		changeVod : function(e)  {
-			var self = this;
-			self.$nextTick(()=>{
-				this.$refs.video[this.current_index].stop(false);
-				this.current_index = e.detail.current;
-				self.start();
-			});
+		changeVod : function(e)  {
+			var self = this;
+			self.$nextTick(()=>{
+				this.$refs.video[this.current_index].stop(false);
+				this.current_index = e.detail.current;
+				self.start();
+			});
 					
 		},
 	},
@@ -77,8 +80,8 @@ export default {
 		deverVideo
 	}
 }
-</script>
-
+</script>
+
 <style>
 .swiper{
 	width: 100vw;
@@ -87,6 +90,6 @@ export default {
 	position: relative;
 	top: 0;
 	left: 0;
-}
-
-</style>
+}
+
+</style>