<template>
	<view class="content">
		<view class="main">
			<view v-for="(item, index) in list">
				<view class="item" @click="navToList(item.id)">
						<view class="item-font clamp">{{item.title}}</view>
						<view class="item-time">更新时间:{{item.add_time}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { articleList } from '@/api/user.js';
export default {
	data() {
		return {
			list: [],
			id:''
		};
	},
	onLoad(opt) {
		this.id = opt.id
		uni.setNavigationBarTitle({ title: this.id ==3?'系统通知': '平台公告' });
		this.loadData();
	},
	methods: {
		// 载入数据
		async loadData() {
			let obj = this;
			articleList({ page: 1, limit: 1000 }, this.id).then(({ data }) => {
				this.list = data;
			});
		},
		navToList(id) {
			uni.navigateTo({
				url: '/pages/info/detail?id=' + id
			});
		}
	}
};
</script>

<style lang="scss">
page,
.content {
	height: auto;
	min-height: 100%;
}
.main {
	margin-top: 20rpx;
	.item {
		padding: 26rpx 0 18rpx;
		margin: 0 22rpx;
		justify-content: flex-start;
		align-items: flex-start;
		border-bottom: 1px solid #e0e0e0;
		.item-font {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: bold;
		}
		.item-time {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #999999;
		}
	}
}
</style>
