<style>
	.koraNewsList{
		display: flex;
		width:100%;
		height:100px;
		padding:10px;
		border-bottom: 1px solid #F4F4F4;
		flex:1;
	}
	.newsLeft{
		width:140px;
		height:80px;
		flex-shrink:0;
	}
	.newsLeft img{
		width:100%;
		height:100%;
	}
	.koranewRight{
		position: relative;
		width:100%;
		margin-left:15px;
	}
	.koraDate{
		position: absolute;
		color:#B9B9B9;
		bottom:0;
		font-size:12px;
	}
	.koraRName{
		color:#404040;
		font-size:15px;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}
	.koraNewsSearch {
		display: flex;
		margin: 10px 10px 0 10px;
		width: 100%;
		justify-content: space-between;
	}
	
	.koraNews_Btn {
		width: 60px;
		height: 34px;
		background-color: #000450;
		color: #fff;
		text-align: center;
		line-height: 34px;
		border-radius: 2px;
		margin-right: 20px;
		display: inline-block;
	}
	
</style>
<template>
	<view class="koraNews">
		<view class="koraNewsSearch">
			<u-search placeholder="输入关键字搜索" style="width:81%;" :show-action="false" v-model="msg.Title"></u-search>
			<view class="koraNews_Btn" @click="getList(1)">搜索</view>
		</view>
		<u-empty v-if="dataList.length==0" text="暂无数据" mode="data"></u-empty>
		<scroll-view v-else :scroll-y="true" :enable-back-to-top="true" :enable-flex="true"
		 @scrolltolower="lower" :style="{ 'height': `calc(100%)`}">
			<view>
				<view class="koraNewsList" v-for="(item,index) in dataList" :key="index">
					<view class="newsLeft">
						<img :src="item.CoverImg" alt=""/>
					</view>
					<view class="koranewRight">
						<view class="koraRName">{{item.Title}}</view>
						<view class="koraDate">{{item.PublishTimeStr}}</view>
					</view>
				</view>
			</view>
			<view style="padding:10px 0;">
				<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="0" :margin-bottom="0" />
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: "采购需求",
				msg:{
					pageIndex: 1,
					pageSize: 10,
					Title:''
				},
				pageCount: 1,
				dataList:[],
				loadText: {
					loadmore: "轻轻上拉，加载更多",
					loading: "努力加载中",
					nomore: "没有更多了",
				},
				status:'',
			}
		},
		mounted(){
			uni.setNavigationBarTitle({
				title: this.pageTitle,
			});
			this.getList(1);
		},
		methods: {
			//获取数据
			getList(num) {
				if (num == 1) {
					this.dataList = [];
				}
				uni.showLoading({
					title: '加载中'
				});
				this.request2({
						url: "/api/AppletTrade/GetNewsPage",
						data: this.msg,
					},
					(res) => {
						uni.hideLoading();
						if (res.resultCode == 1) {
							console.log(res,'数据类了');
							this.dataList = this.dataList.concat(res.data.pageData);
							this.pageCount = res.data.pageCount;
						}
					}
				);
			},
			//滚动加载
			lower(e) {
				if (this.msg.pageIndex < this.pageCount) {
					this.msg.pageIndex++;
					this.status = "loading";
					this.getList();
				} else {
					this.status = "nomore";
				}
			},
		}
	}
</script>
