<template>
	<view v-if="pageloading">
		<view class="bg-white" style="min-height: 100vh;">


			<view class="cu-card case vitembox">
				<view class="cu-item shadow">
					<view class="image">
						
						<video v-if="video!==null" id="myVideo" class="myVideo" :src="video.videourl" @error="videoErrorCallback" enable-danmu controls></video>
						
						<!-- <image :src="video.imageurl" mode="widthFix"></image> -->
					</view>
					<view class="text-content padding-lr padding-top-xs text-lg">{{video.title}}</view>
					<view class="cu-list menu-avatar">
						<view class="cu-item" style="border-bottom: 0rpx;">
							<view class="cu-avatar round lg" :style="'background-image:url('+video.worker.tilpic+');'"></view>
							<view class="content flex-sub">
								<view class="text-grey">{{video.worker.title}}</view> 
								<view class="text-gray text-sm flex justify-between">
									<view>{{video.createtime}}</view>
									
									<view class="text-gray text-right basis-xs text-sm" @tap="goShop(video.workerid)">
										<text class="cuIcon-shop margin-right-xs text-lg"></text>
										进店
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>


			
			
		</view>
	</view>
</template>

<script>
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
	var _this;
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				pageloading: false,
				video: null
			}
		},
		onLoad: function(option) {
			_this = this;
			var videoid = option.videoid || 0;
			_this.$req.ajax({
				path: "video/getvideo",
				title: "加载中...",
				data: {
					videoid: videoid
				}
			}).then((data) => {
				_this.video = data.video;
				_this.pageloading = true;
			}).catch((err) => {
				uni.showModal({
					title: '信息提示',
					content: err,
					showCancel: false
				});
			});
		},
		onShareAppMessage: function(res) {
			return {
				title: _this.video.title,
				path: "/pages/video/detail?videoid=" + _this.video.id
			}
		},
		methods: {
			
			goShop: function(workerid) {
				uni.navigateTo({
					url: '/pages/worker/shop?workerid=' + workerid
				});
			},
			
			videoErrorCallback: function(e) {
				uni.showModal({
					content: e.target.errMsg,
					showCancel: false
				})
			}
			
		}
	} 
</script>


<style lang="scss">
	
	.myVideo{ width: 750rpx; height: calc(100vh - 130px); }
	
	.cu-card>.cu-item{ margin: 0rpx; border-radius: 0rpx; }
	
	.cu-list.menu-avatar>.cu-item:after{ border-bottom: 0rpx; }
	
</style>
