<template>
	<view class="pageBgImg">
		<topNavbar title="行业政策"></topNavbar>
		<view class="pad">
			<view class="card" >
				<view class="li" v-for="(item,index) in listData" :key="index" @click="$goPage('/pages/indexEntry/iIndustryInfo/detail/detail?id='+item.id)">
					<view class="cover">
						<image :src="item.picture" mode="widthFix"></image>
					</view>
					<view class="rightCon">
						<view class="h2 towRowText">{{ item.title }}</view>
						<view class="date">{{ $u.timeFormat(item.createTime, 'yyyy/mm/dd')  }}</view>
					</view>
				</view>
			</view>
			<view style="padding-bottom: 20rpx;" v-if="listData.length>10">
				<u-loadmore :status="status" />
			</view>
		</view>
	</view>
</template>

<script>
	import { getarticlezcList } from '@/config/api.js'
	export default {
		data() {
			return {
				params: {
					pageNo: 1,
					pageSize: 20,
					type: 2
				},
				listData: [],
				total: 20,
				status: 'loading'
			}
		},
		onLoad() {
			this.getarticlezcListFn()
		},
		onPullDownRefresh() {
			this.listInit()
		},
		onReachBottom() {
			if(this.total>this.listData.length) {
				this.getarticlezcListFn()
			}
		},
		methods: {
			async listInit() {
				this.listData = []
				this.params.pageNo = 1
				await this.getarticlezcListFn()
				uni.stopPullDownRefresh()
			},
			async getarticlezcListFn() {
				const {data: res} = await getarticlezcList(this.params)
				this.listData.push(...res.list)
				this.total = res.total
				if(this.listData.length>=this.total) this.status = 'nomore'
				console.log(res)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pageBgImg {
		min-height: 100vh;
	  .card {
		  width: 100%;
		  padding: 0 24rpx 10rpx 24rpx;
	    .borderTop {
			border-bottom: 1px dashed #E8E9EC;
			height: 88rpx;
			display: flex;
			align-items: center;
	      .tit {
			font-size: 28rpx;
			font-weight: 600;
	      }
	    }
	
	    .li {
			display: flex;
			align-items: center;
			padding:20rpx 0;
	      .cover {
	        width: 184rpx;
	        height: 148rpx;
	        border-radius: 6rpx;
			overflow: hidden;
	      }
	
	      .rightCon {
			  padding: 0 0 0 30rpx;
			  display: flex;
			  height: 148rpx;
			  flex-direction: column;
			  justify-content: space-between;
			  flex: 1;
	        .h2 {
				font-size: 24rpx;
				margin-top: 4rpx;
	        }
	
	        .date {
				font-size: 20rpx;
				color: #686B73;
				text-align: right;
	        }
	      }
	    }
	  }
	}
</style>