lilei 1 year ago
parent
commit
1b518aabc0
2 changed files with 13 additions and 1 deletions
  1. 12 1
      pages/videos/detail.vue
  2. 1 0
      pages/videos/index.vue

+ 12 - 1
pages/videos/detail.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
 	<view class="content" v-if="content">
 	<view class="content" v-if="content">
 		<view class="acitve-content">
 		<view class="acitve-content">
-			<video autoplay :src="content" controls></video>
+			<video id="myvideo" autoplay direction="0" @fullscreenchange="fullscreenchange" :title="title" :src="content" controls></video>
 		</view>
 		</view>
 		<view class="titles">{{title}}</view>
 		<view class="titles">{{title}}</view>
 	</view>
 	</view>
@@ -21,12 +21,22 @@
 			if(opts.form=='videoList'){
 			if(opts.form=='videoList'){
 				this.title = opts.title
 				this.title = opts.title
 				this.content = opts.content
 				this.content = opts.content
+				this.videoFull()
 			}else{
 			}else{
 				this.id = opts.sn
 				this.id = opts.sn
 				this.getDetail()
 				this.getDetail()
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
+			fullscreenchange(e, direction){
+				if(!e.detail.fullScreen){
+					uni.navigateBack()
+				}
+			},
+			videoFull(){
+				const videos = uni.createVideoContext('myvideo',this)
+				videos.requestFullScreen()
+			},
 			getDetail(){
 			getDetail(){
 				promoTerminalDetail({sn:this.id}).then(res => {
 				promoTerminalDetail({sn:this.id}).then(res => {
 					this.title = res.data.name
 					this.title = res.data.name
@@ -34,6 +44,7 @@
 					uni.setNavigationBarTitle({
 					uni.setNavigationBarTitle({
 						title: res.data.name || '活动内容'
 						title: res.data.name || '活动内容'
 					})
 					})
+					this.videoFull()
 				})
 				})
 			}
 			}
 		}
 		}

+ 1 - 0
pages/videos/index.vue

@@ -159,6 +159,7 @@
 					videoDetail({id: item.id}).then(res => {
 					videoDetail({id: item.id}).then(res => {
 						if(res.data){
 						if(res.data){
 							item.viewNum = res.data.viewNum
 							item.viewNum = res.data.viewNum
+							this.list.splice()
 							uni.navigateTo({
 							uni.navigateTo({
 								url: "/pages/videos/detail?form=videoList&&title="+item.titile+"&&content="+item.content
 								url: "/pages/videos/detail?form=videoList&&title="+item.titile+"&&content="+item.content
 							})
 							})