<template>
	<view class="container">
		<view v-if="list.length > 0" class="list-box flex_item" v-for="(ls,index) in list" :key='index' @click="nav(index)">
			<image :src="ls.image_input[0]"></image>
			<view class="list-item">
				<view class="title ellipsis">{{ls.title}}</view>
				<!-- <view class="time">{{ls.add_time}}</view> -->
			</view>
		</view>
		<view class="empty-box" v-show="list.length === 0"><empty></empty></view>
	</view>
</template>
<script>
import { article } from '@/api/index.js';
import empty from '@/components/empty';
export default {
	components: {
		empty
	},
	data() {
		return {
			list:'',
			cid: '',
		};
	},
	onLoad(option){
		if(option.id) {
			this.cid = option.id
		}
		if(option.id == '1') {
			uni.setNavigationBarTitle({
				title: '加盟信息列表'
			});
		}
		if(option.id == '2') {
			uni.setNavigationBarTitle({
				title: '消息列表'
			});
		}
		this.loadData();
	},
	onShow() {
		
	},
	methods: {
		// 请求载入数据
		async loadData() {
			let obj = this;
			article({
				page:1,
				limit:10000
			},obj.cid).then(({ data }) => {
				console.log(data)
				obj.list = data;
			});
		},
		nav(index){
			uni.navigateTo({
				url: '/pages/user/addmenDetail?id=' + this.list[index].id
			})
		},
	}
};
</script>

<style lang="scss">
page {
	min-height: 100%;
	background-color: #ffffff;
	.container {
		width: 100%;
		padding: 25rpx 27rpx;
		
	}
}
.empty-box{
	margin-top: 100rpx;
	width: 100%;
	height: 500rpx;
}
.list-box{
	border-bottom: 1rpx solid #E3E3E3;
	margin-bottom: 25rpx;
	padding-bottom: 25rpx;
	image{
		width: 200rpx;
		height: 160rpx;
		border-radius: 15rpx;
	}
	.list-item{
		padding-left: 16rpx;
		width: 80%;
		.title{
			height: 80rpx;
			color: #333333;
			font-size: 30rpx;
			font-weight: 500;
		}
		.time{
			padding-top: 40rpx;
			color: #999999;
			font-size: 24rpx;
		}
	}
}
</style>
