Browse Source

app 视频播放

shish 4 years ago
parent
commit
ff2a457561
1 changed files with 8 additions and 5 deletions
  1. 8 5
      ghsApp/src/admin/book/detail.vue

+ 8 - 5
ghsApp/src/admin/book/detail.vue

@@ -16,7 +16,7 @@
 			</view>
 
 			<view v-if="item.style == 'video'">
-				<view class="video"><video id="myVideo" :src="`${getLoginInfo.apiHost}${item.value}`" object-fit="contain" style="width:700upx;height:1100upx;"></video></view>
+				<view class="video" @click="playVide"><video id="myVideo" :src="item.value" object-fit="contain" style="width:700upx;height:1100upx;"></video></view>
 			</view>
 
 			<view v-if="item.style == 'image'">
@@ -46,10 +46,9 @@ export default {
 		};
 	},
 	onLoad() {
-		this.videoContext = uni.createVideoContext('myVideo')
+
 	},
 	computed:{
-		...mapGetters(["getLoginInfo"]),
 	},
 	onShow() {
 	},
@@ -65,17 +64,21 @@ export default {
 		goTo(item){
 			this.$util.pageTo({ url: item.page})
 		},
+		playVide(){
+			this.videoContext = uni.createVideoContext('myVideo',this)
+			this.videoContext.play()
+		},
 		init(){
 			let that = this
             getBookDetail({id:this.option.id}).then(res => {
                 that.bookList = res.data.list
-                that.bookList.forEach((item,key) => {
+                that.bookList.forEach((item) => {
                 if(item.style == 'title'){
 						this.pageTitle = item.value
                     	uni.setNavigationBarTitle({title: item.value})
                 }
               })
-
+				
             });
 		}
 	},