<template>
	<view class="main">
		<view class="tour_item" @click="toInfo(item.id)" v-for="(item,index) in list" :key="index">
			<view class="titleStyle">
				{{item.title}}
			</view>
			<view class="tour_time">
				丹棱检察 {{$u.timeFormat(item.created_at, 'yyyy/mm/dd')}}
			</view>
			<view class="content_tour">
				{{item.desc}}
			</view>
		</view>
		<uni-load-more :loadingType="loadingType" :contentText="contentText" />
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				loadingType: 0,
				contentText: {
					contentdown: '上拉显示更多',
					contentrefresh: '正在加载...',
					contentnomore: '没有更多数据了'
				},
				indexPage: 1,
				list: [],
			}
		},
		onLoad() {
			this.getTourList()
		},
		methods: {
			async getTourList() {
				let res = await this.$u.get("/home/notice", {
					page: this.indexPage,
				})
				this.list = this.list.concat(res.data)
				this.indexPage++
				if (res.current_page == res.last_page) {
					this.loadingType = 2;
				} else {
					this.loadingType = 0;
				}
			},
			toInfo(id) {
				uni.navigateTo({
					url: '../news/newsInfo?id=' + id + '&type=4'+'&title=丹棱公告'
				})
			}
		}
	}
</script>

<style>
	.main {
		min-height: 100vh;
		padding: 30rpx 28rpx;
	}

	.tour_item {
		margin-bottom: 20rpx;
		padding: 30rpx;
		background: #fff;
		border-radius: 10rpx;
	}

	.titleStyle {
		font-size: 34rpx;
		font-family: PingFang-SC-Bold, PingFang-SC;
		font-weight: bold;
		color: #333333;
	}

	.tour_time {
		margin-top: 30rpx;
		font-size: 24rpx;
		font-family: PingFang-SC-Bold, PingFang-SC;
		font-weight: 500;
		color: #999;
	}

	.content_tour {
		margin-top: 16rpx;
		font-size: 28rpx;
		font-family: PingFang-SC-Bold, PingFang-SC;
		font-weight: 500;
		color: #555;
	}
</style>
