<template>
	<view class="bg">
		<image :src="showImg(headImg)" mode="aspectFill" class="topImg"></image>
		
		<view class="box">
			<view v-for="(item,index) in list" :key="index" class="item" @click="gotoVideo(item)">
				<view style="display: flex;align-items: center;">
					<image :src="showImg(item.author_img)" mode="aspectFill" class="profile"></image>
					<view class="name">{{item.author}}</view>
				</view>
				<view class="title">
					{{item.title}}
				</view>
				<view class="video-box" :style="{backgroundImage: 'url('+showImg(item.image)+')'}">
					<image src="https://static.ticket.sz-trip.com/cgc/images/index/plays.png" mode="" class="play"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				headImg: '',
			}
		},
		onReady() {
			this.getHeadImg(10213).then(res => {this.headImg = res})
			this.Post({
				type_id: 2,
				offset: 0,
				limit: 100
			}, '/api/article/getArticleByType').then(res => {
				if(res.data) {
					this.list = res.data
				}
			})
		},
		methods: {
			gotoVideo(item) {
				uni.navigateTo({
					url: '/subPackages/video/video?item=' + encodeURIComponent(JSON.stringify(item))
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		min-height: 100vh;
		background: #FFFFFF;
		padding-bottom: 100rpx;
	}
	
	.topImg {
		width: 750rpx;
		height: 380rpx;
	}
	
	.box {
		margin-top: -24rpx;
		border-radius: 24rpx 24rpx 0 0;
		padding: 0 32rpx;
		
		.item {
			padding: 32rpx 0;
			
			.profile {
				width: 48rpx;
				height: 48rpx;
				border-radius: 50%;
				margin-right: 16rpx;
			}
			.name {
				font-weight: 500;
				font-size: 28rpx;
				color: #000000;
			}
			
			.title {
				font-weight: 400;
				font-size: 28rpx;
				color: #000000;
				margin-top: 24rpx;
			}
			
			.video-box {
				width: 686rpx;
				height: 372rpx;
				border-radius: 32rpx;
				margin-top: 20rpx;
				background-size: 100% 100%;
				position: relative;
				
				.play {
					position: absolute;
					top: 0;
					bottom: 0;
					left: 0;
					right: 0;
					margin: auto;
					width: 56rpx;
					height: 56rpx;
				}
			}
		}
		.item:nth-child(n+2) {
			border-top: 2rpx solid rgba(0,0,0,0.05);
		}
	}
</style>