<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 {myRelease} from "@/api/userInfo.js"
	import myreleaseitem from "../../../components/waterfall/myreleaseitem.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,		//数量
				status:"more"
			}
		},
		onLoad() {
			
		},
		//我的发布
		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(myRelease,{
					page:this.page,
					limit:this.limit,
					})
				.then(res=>{
					if(res&&res.code==200){
							uni.stopPullDownRefresh()
						this.flowList = this.flowList.concat(res.page.list);
						console.log(this.flowList)
						if(res.page.totalPage<=res.page.currPage){
							this.status = "noMore";
						}else{
							this.status= "more"
						}
					}
				})
			}
	
				
			
		},
		components:{
			myreleaseitem
		}
	}
</script>
<style>
	page{
		background-color: #F5F5F5;
	}
	</style>

<style scoped lang="scss">

</style>
