<template>
	<view >
		<view class="content">
			<u-navbar :border-bottom="false" :background="background" :is-back="false"  title-color="#fff" title="活动"></u-navbar>
			<mescroll-body height="650" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
				<card :list="list"></card>
			</mescroll-body>
		</view>
		<u-tabbar 
		 @change="tabChange"
		 v-model="tabbarCurr"
		 :icon-size="tabbar.iconSize" 
		 :active-color="tabbar.activeColor" 
		 :mid-button-size="tabbar.MinButtonSize" 
		 :list="tabbar.list" :mid-button="true">
		 </u-tabbar>
	</view>
</template>

<script>
import {tabbar} from "@/assets/js/party-tarbar.js"
import card from "./comps/card.vue"
import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
export default {
	mixins:[MescrollMixin],
	components:{
		card
	},
	data() {
		return {
			background:{
				backgroundColor:'#DE2910'
			},
			//tabbar
			tabbarCurr:1,
			tabbar:tabbar,
			
			upOption: {
				empty: {
					isSmall:true,
					use: true, // 是否显示空布局
					icon: "http://139.9.103.171:1888/miniofile/xlyq/party-empty.png", // 图标路径 (建议放入static目录, 如 /static/img/mescroll-empty.png )
				}
			},
		};
	},
	onLoad() {
		
	},
	methods:{
		tabChange(index){
			if (index==0) {
				uni.redirectTo({
					url:"/party/pages/home/home"
				})
			}else if (index==2) {
				uni.redirectTo({
					url:"/party/pages/mine/mine"
				})
			}
		},
		upCallback(mescroll){
			let params={
				current:mescroll.num,
				size:mescroll.size,
				branchId:this.vuex_party_person.branchId
			}
			try{
				this.$api.party.activityList(params).then(res=>{
					let data=res.data.records
					let total=res.data.total
					mescroll.endBySize(data.length,total);
					if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
					this.list=this.list.concat(data); //追加新数据
				})
			}catch(e){
				this.mescroll.endErr()
			}
		}
	}
};
</script>

<style lang="scss" >

</style>
