<template>
	<view class="content">
		<view class="jg" style="height: 1rpx;">
			
		</view>
		<view class="list-box" v-for="(item,index) in science" :key='index' @click="navTo('/pages/applic/info?id='+item.id)">
			<view class="box-left">
				<image :src="item.image" mode="" class="left-img"></image>
			</view>
			<view class="box-right">
				<view class="right-top word1_ellipsis">
					{{item.title}}
				</view>
				<view class="right-center">
					{{item.synopsis}}
				</view>
				<view class="right-foot">
					已阅读人数：{{item.visit || 0}}
				</view>
			</view>
		</view>
		<uni-load-more :status="loadingType"></uni-load-more>
	</view>
</template>

<script>
	import { getArticList} from '@/api/index.js';
	export default {
		data() {
			return {
				science: [],
				loadingType: 'more',
				page: 1,
				limit: 10
			}
		},
		onLoad() {
			this.loadData()
		},
		onReachBottom() {
			this.loadData()
		},
		methods: {
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
			loadData(){
				let obj = this;
				if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
					return
				}
				obj.loadingType = 'loading'
				getArticList({
					paga: obj.page,
					limit: obj.limit,
					ifyid: 1
				}).then(({ data }) => {
					obj.science = obj.science.concat(data);
					console.log(obj.science,1236);
					if(obj.limit == data.length) {
						obj.loadingType = 'more'
					}else {
						obj.loadingType = 'noMore'
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.list-box{
		width: 725rpx;
		height: 200rpx;
		margin: 20rpx auto 0;
		background: #FFFFFF;
		box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
		border-radius: 7rpx;
		padding:0 20rpx;
		display: flex;
		align-items: center;
		&:first-of-type {
			margin-top: 0;
		}
		.box-left{
			width: 230rpx;
			height: 145rpx;
			margin-right: 20rpx;
			.left-img{
				width: 230rpx;
				height: 145rpx;
			}
		}
		.box-right{
			width: 430rpx;
			height: 145rpx;
			position: relative;
			.right-top{
				font-size: 25rpx;
				font-weight: bold;
				color: #333333;
				margin-bottom: 24rpx;
			}
			.right-center{
				width: 362rpx;
				// height: 53rpx;
				font-size: 21rpx;
				font-weight: bold;
				color: #999999;
				line-height: 33rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;//在第几行显示...
				-webkit-box-orient: vertical;
			}
			.right-foot{
				font-size: 21rpx;
				font-weight: bold;
				color: #999999;
				line-height: 31rpx;
				text-align: right;
				// margin-top: 13rpx;
				position: absolute;
				right: 0;
				bottom: 0;
			}
		}
	}
</style>
