<template>
	<view class="page5 u-flex u-row-between">
		<view class="item" v-for="(item,index) in videolist" :key="index" @click="tovideoinfo(item.id)">
			<image :src="item.image" style="width: 334rpx;height: 204rpx;" mode=""></image>
			<view class="title u-line-1">{{item.title}}</view>
			<view class="write">{{item.lecturer}}</view>
			<view class="money">¥{{item.price}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "ty-video",
		data() {
			return {
				page: 1,
				total: 0,
				videolist: [],
				keywords: '',
			};
		},
		onPullDownRefresh() {
			if (this.videolist.length < this.total) {
				this.page++
				this.getVideoList()
			}
		},
		created() {
			this.getVideoList()
		},
		methods: {
			//获取视频列表
			getVideoList() {
				this.$u.post('api/video/getVideoList', {
					page: this.page,
					limit: 10,
					keywords: this.keywords,
				}).then(res => {
					console.log('video', res);
					if (this.page == 1) {
						this.videolist = res.data.data
					} else {
						this.videolist.concat(res.data.data)
					}
				})
			},
			tovideoinfo(id){
				uni.navigateTo({
					url:'/pages/index/video?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		margin-top: 24rpx;
	}

	.page5 {
		width: 750rpx;
		// min-height: 70vh;
		background: #FFFFFF;
		border-radius: 28rpx 28rpx 0rpx 0rpx;
		padding: 8rpx 28rpx 34rpx;
		flex-wrap: wrap;
		align-content: flex-start;
	}

	.title {
		font-size: 28rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		color: #333333;
		width: 330rpx;
		height: 40rpx;
		margin-top: 20rpx;
	}

	.write {
		font-size: 24rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		color: #444444;
		margin-top: 8rpx;
	}

	.money {
		font-size: 28rpx;
		font-family: SFPro, SFPro;
		font-weight: 500;
		color: #CC3300;
		margin-top: 12rpx;
	}
</style>