<template>
	<view class="home-pages">
		<view style="color: #707070;
			font-size: 28rpx;">
		</view>
		<view class="home-content">
			<scroll-view scroll-y="true" class="scroll-y" 
				<card v-for="(item,i) in list" :item="item" :key="i" :i="i"  @seeDetail="seeDetail"></card>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import card from '@/components/active-card/address-list.vue'
	export default{
		components:{
			card,
		},
		data(){
			return{
				params:{
					pageNo:1,
					pageSize:10,
					total: null,
					isLock: true
				},
				list:[
					{
						name:"语文学习报+试卷",
						text:"【人教版】每学期20期彩色周报及4张单元试卷"
					},
					{
						name:"数学学习报+试卷",
						text:"【湘教版】每学期20期彩色周报及4张单元试卷"
					},{
						name:"英语学习报+试卷",
						text:"【北大师版】每学期26期彩色周报及14张单元试卷"
					}
				]
			}
		},
		onLoad() {
			this.params.pageNo = 1;
			this.params.total = null;
			this.params.isLock = true;
			
		},
		onReady() {
			this.$com.displayNav()
		},
		onPullDownRefresh() {
			this.list = [];
			this.params.pageNo = 1;
			this.params.total = null;
			this.params.isLock = true;
			
		},
		onReachBottom() {
			if(this.params.isLock){
				this.params.isLock = false;
				if(this.params.total !== null && this.params.pageNo * this.params.pageSize >= this.params.total){
					this.$Toast('没有更多数据了哦！');
					setTimeout(()=>{
						this.params.isLock = true;
					},3000)
					return
				}
				this.params.pageNo+=1;
				this.$Toast('数据加载成功！');
				
			}
		},
		methods:{
			seeDetail(item){
				uni.navigateTo({
					url:`/pages/my/kanwudetails`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.home-pages {
		padding: 28rpx 29rpx 0;
		min-height: 80vh;
		background-color: #F7F7F7;
		
		.swiper{
			position: relative;
			height: calc(100% -7vh);
			width: 100%;
			height: 1800px;
		}
		.scroll-Y {
			height: calc(300vh - 660rpx);
			padding-top: 20rpx;
		}
		
		.home-content {
			.active-card{
				margin-top: 20rpx;;
				border-radius: 0;
				border: none;
				border-style: none;
				box-shadow: none;
			}
		}
		
	}
	
</style>