<template>
	<view class="article-list">
		<view class="article-item" v-for="(item,index) in list" :key="index" @click="toArticleDetail(item.id)">
			<image :src="item.imageInput"  mode="aspectFill"></image>
			<view class="article-content">
				<view class="article-title line1">{{item.title}}</view>
				<view class="article-desc line1">{{item.synopsis}}</view>
				<view class="author-box acea-row row-between">
					<view class="acea-row">
						<view class="author">{{item.author}}</view>
						<view class="time">{{item.addTime.split(' ')[0]}}</view>
						<view>{{item.visit}}人阅读</view>
					</view>
					<view class="tips" 
						:class="item.chargeType == 0 ? 'free-bg' : item.chargeType == 1 ? '' : 'jifen'">
						{{item.chargeType == 0 ? '免费' : item.chargeType == 1 ? '收费' : '积分'}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			list: {
				type: Array,
				default: []
			}
		},
		methods:{
			toArticleDetail(id){
				this.$yrouter.push({
				  path: '/pages/knowledge/detail',
				  query: {
				    id:id,
				  },
				})
			},
		}
	}
</script>

<style lang="less">
.article-list{
	width: 100%;
	margin-top: 20rpx;
	.article-item{
		width: 100%;
		background: #fff;
		box-sizing: border-box;
		margin-bottom: 52rpx;
		box-shadow: 0px 2rpx 8rpx rgba(0, 0, 0, 0.16);
		image{
			width: 100%;
			height: 266rpx;
			border-radius: 10rpx;
			margin-bottom: 20rpx;
		}
		.article-content{
			padding: 28rpx 32rpx;
		}
		.article-title{
			font-size: 36rpx;
			font-weight: 500;
			color: #333333;
			line-height: 50rpx;
			margin-bottom: 8rpx;
		}
		.article-desc{
			font-size: 24rpx;
			font-weight: 400;
			color: #999999;
			line-height: 40rpx;
			margin-bottom: 30rpx;
		}
		.author-box{
			font-size: 24rpx;
			color: #999;
			.author{
				color: #EA533E;
			}
			.time{
				margin: 0 12rpx;
			}
			.tips{
				width: 100rpx;
				font-size: 20rpx;
				color: #FFAD3A;
				height: 34rpx;
				text-align: center;
				line-height: 34rpx;
				background: #fcd391;
				border-radius: 44rpx;
			}
			.free-bg{
				background: #8FB85B;
				color: #D7FFA4;
			}
			.jifen{
				background: #AAC8FA;
				color: #5693F9;
			}
		}
	}
}
</style>
