<template>
	<view class="center">
		<view class="massage" v-for="(item, index) in list" :key="index" @click="nav('/pages/index/messageInfo?id=' + item.id)">
			<view class="title">{{ item.title }}</view>
			<view class="time">{{ item.add_time }}</view>
		</view>
	</view>
</template>

<script>
import { article } from '@/api/index.js';
export default {
	data() {
		return {
			list: [],
			type: ''
		};
	},
	onLoad(opt) {
		let obj = this;
		if (opt.type) {
			this.type = opt.type;
			if(opt.type==1){
				uni.setNavigationBarTitle({
					title: '官方公告' 
				});
			}else
			if(opt.type==2){
				uni.setNavigationBarTitle({
					title: '公司介紹'
				});
			}
		}
		article({ page: 1, limit: 1000 }, this.type).then(({ data }) => {
			this.list = data;
		});
	},
	methods: {
		nav(url) {
			uni.navigateTo({
				url
			});
		}
	}
};
</script>

<style lang="less">
.center {
	background: #f3f3f3;
}
.massage {
	background: #ffffff;
	padding: 30rpx;
	border-bottom: 1px solid #e9e9e9;
	.title {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}
	.time {
		margin-top: 18rpx;
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
	}
}
</style>
