<template>
	<view>
		<view class="" style="padding: 20rpx 30rpx;">
			<u--input
			    placeholder="输入关键词查询"
			    border="surround"
			    v-model="value"
				@confirm="confirm"
				confirm-type="search"
				clearable
				shape="circle"
				prefixIcon="search"
					    prefixIconStyle="font-size: 22px;color: #909399"
			  ></u--input>
		</view>
		<view class="videoContent">
			<view class="videoItem u-flex" v-for="(item,index) in video" :key="index" @click="toinfo(item)">
				<view class="time">{{item.video_time}}</view>
				<image :src="item.show_image" mode=""></image>
				<view class="">
					<view class="name">
						{{item.title}}
					</view>
					<view class="" style="font-size: 20rpx;color: #999999;margin-top: 40rpx;">
						{{item.create_at}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad() {
				this.getList()
		},
		onReachBottom() {
			this.page++
			this.getList()
		},
		data() {
			return {
				title:'',
				value: '',
				page:1,
				video:[]
			}
		},
		methods: {
			toinfo(item){
					uni.navigateTo({
						url:'./videoInfo?item='+JSON.stringify(item)
					})
			},
			getList(){
				uni.$u.http.post('/api/Index/videolist',{page:this.page,title:this.title}).then(res => {
				if(this.page==1){
					this.video=res.data.data
				}else{
					this.video=[...this.video,...res.data.data]
				}
				})
			},
			confirm(e){
				this.page=1
				this.title=e
				this.getList()
			},
			 
		}
	}
</script>

<style lang="scss">
.videoContent{
		padding: 0 30rpx;
			margin-top: 22rpx;
			.videoItem{
				position: relative;
				padding-bottom: 24rpx;
				border-bottom: 2rpx solid #F3F3F3;
				// height: 280rpx;
				background: #FFFFFF;
				border-radius: 16rpx;
				image{
					border-radius: 16rpx;
					width: 304rpx;
					height: 172rpx;
					margin-right: 20rpx;
				}
				.name{
					box-sizing: border-box;
					font-size: 30rpx;
					color: #222222;
					font-weight: 400;
					
				}
				.time{
					position: absolute;
					top: 124rpx;
					left: 220rpx;
					color: #fff;
					width: 64rpx;
					height: 28rpx;
					line-height: 28rpx;
					text-align: center;
					font-size: 20rpx;
					background: rgba(0,0,0,0.4000);
					border-radius: 16rpx;
					z-index: 1;
				}
			}
		}
</style>
