<style>
	.koraNews{
		width: 100%;
		height: 100vh;
		background: #F6F6F6;
		overflow: hidden;
	}
	.koraNewsList{
		
		width:100%;
		padding:0 15px;
		margin-top: 20px;
	}
	.koraNews-time{
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 12px;
		color: #B9BCCA;
		font-family: aa;
	}
	.koraNews-box{
		width: 100%;
		border-radius: 6px;
		
		background: #FFF;
		overflow: hidden;
		margin-top: 10px;
	}
	.newsimgs{
		width: 100%;
		border-top-left-radius: 6px;
		border-top-right-radius: 6px;
		height: 145px;
	}
	.n-img{
		width: 100%;
		height: 100%;
		border-top-left-radius: 6px;
		border-top-right-radius: 6px;
	}
	.box-conet{
		width: 100%;
		padding: 10px 15px;
	}
	.koraRName{
		color:#111111;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		font-size: 28rpx;
		line-height: 30rpx;
		font-weight: 600;
	}
	.koraRName-f{
		font-size: 12px;
		color:#999999;
		margin-top: 5px;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
.koraNewsSearch{
	padding: 0px 10px 10px;
}
</style>
<template>
	<view class="koraNews">
		<view class="koraNewsSearch">
			<u-search action-text="搜索"  :clearabled="true" style="width:95%" :show-action="false" radius="40" v-model="msg.Title"
			 @search="getList(1)" @custom="getList(1)"></u-search>
		</view>
		<view style="display: flex;align-items: center;margin-bottom: 30rpx;padding: 0px 15px;">
			<image @click="goNewFirstShop" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1616490607000_36.png" style="flex:1;width:1px;margin-right: 15rpx;" mode="widthFix"></image>
			<image @click="goMyFirstShop" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1616490607000_108.png" style="flex:1;width:1px;margin-left: 15rpx;" mode="widthFix"></image>
		</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(100vh - 189px);">
			<view style="font-size: 30rpx;font-weight: 700;color: #111;padding: 0 15px;">资讯信息</view>
			<view>
				<view class="koraNewsList" v-for="(item,index) in dataList" :key="index" @click="goNewsDetail(item)">
					<view class="koraNews-time">{{item.CreateDate?item.CreateDate.replace('T',' '):''}}</view>
					<view class="koraNews-box">
						<view class="newsimgs" style="position: relative;">
							<image :src="item.CoverImg" mode="aspectFill" class='n-img'/>
							<view style="top:10px;left:10px;position: absolute;" v-if="item.Industry&&item.Industry.length>0">
								<u-tag :text="item.Industry" mode="dark" bg-color="rgba(0,0,0,.4)" color="#FFF" size="mini"></u-tag>
							</view>
						</view>
						<view class="box-conet">
							<view class="koraRName">{{item.Title}}</view>
							<view class="koraRName-f">{{item.Subtitle}}</view>
						</view>
					</view>
				
				</view>
			</view>
			
			
			<u-loadmore
			  :status="status"
			  :load-text="loadText"
			  :font-size="24"
			  :margin-top="20"
			  :margin-bottom="20"
			  bg-color="#F6F6F6"
			/>
		</scroll-view>
		<tabbars></tabbars>
	</view>
</template>

<script>
	import tabbars from '@/components/tabbar/index';
	export default {
		components:{
			tabbars
		},
		data() {
			return {
				pageTitle: "首店经济",
				msg:{
					pageIndex: 1,
					pageSize: 10,
					Title:'',
					// Type:1
				},
				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) {
							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";
				}
			},
			//跳转至新闻详情
			goNewsDetail(item){
				uni.navigateTo({
					url: '/pages/kotra/newsInDetail?Id=' + item.Id
				});
			},
			goNewFirstShop(){
				uni.navigateTo({
					url: '/pages/kotra/firstShop/firstShop'
				});
			},
			goMyFirstShop(){
				uni.navigateTo({
					url: '/pages/kotra/firstShop/list'
				});
			},
		}
	}
</script>
