<template>
	<view class="pageBgImg">
		<topNavbar title="行业资讯"></topNavbar>
		<view class="pad">
			<view class="card" v-for="(item,index) in listData" :key="index">
				<view class="borderTop flex-b">
					<view class="tit">{{item.title}}</view>
					<!-- <moreRight text="更多"></moreRight> -->
				</view>
				<view class="li" v-for="(item2,index2) in item.articleManagementDO" :key="index2"  @click="$goPage('/pages/indexEntry/iIndustryInfo/detail/detail?id='+ item2.id)">
					<view class="cover">
						<image :src="item2.picture" mode="widthFix"></image>
					</view>
					<view class="rightCon">
						<view class="h2">{{ item2.title }}</view>
						<view class="date">{{ $u.timeFormat(item2.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 { getarticleList } from '@/config/api.js'
	export default {
		data() {
			return {
				params: {
					pageNo: 1,
					pageSize: 20,
					type: 1
				},
				listData: [],
				total: 20,
				status: 'loading'
			}
		},
		onLoad() {
			this.getarticleListFn()
		},
		onPullDownRefresh() {
			this.listInit()
		},
		onReachBottom() {
			if(this.total>this.listData.length) {
				this.getarticleListFn()
			}
		},
		methods: {
			async listInit() {
				this.listData = []
				this.params.pageNo = 1
				await this.getarticleListFn()
				uni.stopPullDownRefresh()
			},
			async getarticleListFn() {
				const {data: res} = await getarticleList(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>