<template>
	<view class="myrelease">
		<navbar ref="navbar" :config="config">
			
		</navbar>
		<myreleaseitem 
		v-if="flowList.length>0"
		class="back" 
		ref="wfp" 
		:colunmNumber="colunmNumber" 
		:flowList="flowList" 
		:columnGap="10"
		:status="status"></myreleaseitem>
		
		<loadMore v-if="flowList.length>0" :status="status"></loadMore>
		 <nodata v-else :config="{ top: 15, content: '暂无点赞~' }"></nodata>
	</view>
	
</template>

<script>
	import {recordList} from "@/api/userInfo.js"
	import myreleaseitem from "../../../components/waterfall/myfabulousItem.vue"
	import loadMore from "../../../components/uni-load-more/uni-load-more.vue"
	export default{
		data(){
			return{
				colunmNumber: 2,
				index: 19,
				flowList: [],
				config: {
					back: true, //false是tolbar页面 是则不写
					title: '我的点赞',
					color: '#1A1A1A',
					//背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
					backgroundColor: [1, "#FFFFFF"],
					statusBarFontColor: '#1A1A1A',
					
				},
				page:1,			//分页
				limit:10,		//数量
				userId:null,								
				status:"more"
			}
		},
		//我的发布
		onLoad(options){
			this.userId = options.user_id
			

		},
		onShow() {
		this.flowList=[]
			this.getList()
		},

		onPullDownRefresh() {
			this.page =1;
			this.flowList = [],
			this.getList()
		},
		onReachBottom() {
			if(this.status=='more'){
				this.page++;
				this.getList()
			}
		},
		methods:{
			getList(){
				this.$http.get(recordList,{
					page:this.page,
					limit:this.limit,
					userId:this.userId
					})
				.then(res=>{
					if(res&&res.code==200){
							uni.stopPullDownRefresh()
						this.flowList = this.flowList.concat(res.page.list);
			
						if(res.page.totalPage<=res.page.currPage){
							this.status = "noMore";
						}else{
							this.status= "more"
						}
					}
				})
			}
	
				
			
		},
		components:{
			myreleaseitem
		}
	}
</script>
<style>
	page{
		background-color: #F3F3F3;
	}
	</style>

<style scoped lang="scss">
	
	.myrelease{
		background-color: #F3F3F3;
	}
</style>
