<template>
	<block>
		<view class="item" v-for="(item,index) in list" :key='index' @tap="toPage" :data-id='item.id' data-url='/pages/article/detail'>
			<image :src="item.image" mode=""></image>
			<view class="">
				{{item.title}}
			</view>
		</view>


	</block>
</template>
<script module="parse" lang="wxs">
	module.exports = {

		filterNum: function(value) {


			var value = value + ''

			console.log(value)


			var card = value.replace(getRegExp('(/^(\d{4})\d+(\d{4})$/)', 'g'), '$1 **** **** $2')

			return card


		}


	}
</script>
<script>
	// pages/tabbar/index/index.js
	var app = getApp();

	export default {
		data() {
			return {
				navIndex: 0,
				list: [
					// {
					// 	account: "hhD",
					// 	bank_name: "农业银行",
					// 	card_no: "6228481561378773113",
					// 	card_no_end: "3113",
					// 	create_time: "1659088920",
					// 	id: "7",
					// 	is_default: "0",
					// 	status: "1",
					// 	uniacid: "3",
					// 	update_time: "1659088920",
					// 	user_id: "1"
					// }
				],
				loaded: false,
				page: 1,
				type: '',
				pageSize: 10
			};
		},
		onLoad: function(options) {

		},

		onShow() {
			this.init()
			this.getlist();
		},
		onPullDownRefresh: function() {},
		onReachBottom: function() {
			this.loaded || this.getlist();
		},
		onShareAppMessage: function() {},
		methods: {
			toPage(e) {
				app.globalData.toPage(e);
			},

			init() {

				this.page = 1
				this.loaded = false
				this.list = []

			},

			async getlist() {
				var that = this;
				let res = await this.$api.request('/article/index', 'GET', {
			 	page: this.page,
				pagesize: this.pageSize
			 });

				console.log(res)
				if (res) {
					if (res.length > 0) {

						this.list = this.list.concat(res);

						this.page++;

					} else {
						this.loaded = true
						this.$api.msg('没有更多数据');
					}
				}
			}
		}
	};
</script>
<style>
	page {
		background: #F5F5F5;
	}


	.item {
		background: #fff;
		border-radius: 12rpx;
		overflow: hidden;
		margin: 30rpx;
	}
	
	.item>view{
		width: 100%;
		padding: 30rpx 30rpx 50rpx 30rpx;
		font-size: 34rpx;
		color: #010101;
	}
	
	.item>image{
		width: 100%;
		height: 400rpx;
	}
	
</style>
