<template>
	<view style="min-height: 100vh;background-color: #f8f8f8;box-sizing: border-box;">
		<view class="content_wrapper">
			<view v-for="(item,index) in dataList" :key="item.id" class="list-item" @click="Detail(item)">
				<image :src="item.img" mode="aspectFill"></image>
				<!-- <view class="text-box">
					<view style="font-size: 14px;line-height: 22px;font-weight: bold;">{{item.title}}</view>
					<view class="text" v-html="item.describe"></view>
					<view class="text">{{item.publish_time}}</view>
				</view> -->
			</view>
			<view class="" v-if="dataList.length==0">
				<loadmore :isMore="true" v-if="dataList.length=='0'" />
			</view>
		</view>
	</view>
</template>

<script>
	import App from '@/common/js/app.js';
	import loadmore from '@/components/template/loadmore.vue'
	export default {
		data() {
			return {
				page: 1,
				dataList: []
			}
		},
		components: {
			loadmore
		},
		onShow() {
			this.getList();
		},
		methods: {
			getList(){
				let _this = this;
				App._post_form('&p=member&do=getRuleCenterList', {page:_this.page, pageSize: 10}, res => {
					if(_this.page===1){
						if(res.data.list.length>0){
							_this.setData({
								dataList: res.data.list
							})
						}
					}else{
						if(res.data.list.length>0){
							let dataList = _this.dataList.concat(res.data.list);
							_this.setData({
								dataList
							})
						}
					}
				}, false, err=>{
					
				});
			},
			Detail(item){
				uni.previewImage({
					urls: [item.img],
					// longPressActions: {
					// 	itemList: ['发送给朋友', '保存图片', '收藏'],
					// 	success: function(data) {
					// 		console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
					// 	},
					// 	fail: function(err) {
					// 		console.log(err.errMsg);
					// 	}
					// }
				});
			}
		},
		onReachBottom(){
			this.page++;
			this.getList();
		}
	}
</script>

<style lang="scss">
.dis-flex{
	display: flex;
	align-items: center;
}
.content_wrapper{
	padding: 10px 15px;
	.list-item{
		display: flex;
		padding: 15px 0px;
		border-bottom: 1px solid #efefef;
	}
	image{
		width: 660upx;
		height: 220upx;
		border-radius: 40upx;
		margin: 0px auto;
	}
	.text-box{
		flex: 1;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.text{
		display: -webkit-box;//将盒子转换为弹性盒子
		-webkit-box-orient: vertical;//文本显示方式，默认水平
		-webkit-line-clamp: 2;//设置显示多少行
		overflow: hidden;
		font-size: 13px;
		color: #999;
	}
}
</style>
