<template>
	<view>
		<view class="training-camp">
			<view class="training-camp-btn" @click="choose">请选择训练营</view>
		</view>
		<u-picker :show="show" :columns="columns" title="训练营选择" @confirm="confirm" @cancel="cancel"></u-picker>
		<view class="container-body x-start" :style="{height: contentH}">
			<view class="container-left">
				<view class="classification active">全部</view>
				<view class="classification">测试</view>
			</view>
			<view class="container-right">
				<!-- <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit"    :down="downOption" :up="upOption" @down="downCallback" @up="upCallback"> -->
					<view class="list">
						<courseItem :from="'course'" :activeTab="0" v-for="i in 9" />
					</view>
				<!-- </mescroll-body> -->
			</view>
		</view>
	</view>
</template>

<script>
	import courseItem from "../components/courseItem.vue"
	export default {
		components: {
			courseItem
		},
		data() {
			return {
				contentH: 0,
				show: false,
				columns: [
					['中国', '美国', '日本']
				],
				mescroll:null,
				downOption: {
					auto:false//不要自动加载
				},
				upOption: {
					onScroll:false,
					use: true, // 是否启用上拉加载; 默认true
					page: {
						num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
						size: 10 // 每页数据的数量,默认10
					},
					noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
					textNoMore:"已经到底了",
					empty: {
						icon:'/static/images/empty.png',
						tip: '暂无数据'
					}
				},
				dataList: []
			}
		},
		mounted() {
			const windowHeight = uni.getSystemInfoSync().windowHeight
			this.contentH = `calc(${windowHeight}px - 52px - 56px)`
		},
		methods: {
			choose() {
				this.show = true
			},
			cancel() {
				this.show = false
			},
			confirm(e) {
				console.log('confirm', e)
				this.show = false
			},
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},
			/*下拉刷新的回调 */
			downCallback(mescroll) {
				mescroll.resetUpScroll()
			},
			upCallback(page) {
				// //联网加载数据
				// var that = this;
				// var data={
				// 	customerName:this.searchKey,
				// 	pageNum: page.num,
				// 	pageSize: page.size
				// };
				// uni.showLoading({
				// 	title:"加载中..."
				// })
				// getMyCustomerList(data).then(res => {
				// 	uni.hideLoading()
				// 	if(res.code==200){
				// 		//设置列表数据
				// 		if (page.num == 1) {
				// 			that.dataList = res.data.list; 
							
				// 		} else {
				// 			that.dataList = that.dataList.concat(res.data.list);
							 
				// 		}
				// 		that.mescroll.endBySize(res.data.list.length, res.data.total);
						
				// 	}else{
				// 		uni.showToast({
				// 			icon:'none',
				// 			title: "请求失败",
				// 		});
				// 		that.dataList = null;
				// 		that.mescroll.endErr();
				// 	}
				// });
			},
		}
	}
</script>

<style>
	page {
		background-color: #f5f4f5;
	}
</style>
<style lang="scss" scoped>
	.training-camp {
		padding: 10px;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 14px;
		color: #222222;
		&-btn {
			font-size: 15px;
			width: 100%;
			height: 32px;
			line-height: 32px;
			text-align: center;
			background-color: #fff;
			border-radius: 50px;
			border: 1px solid #ccc;
		}
	}
	.container-left {
		flex-shrink: 0;
		background-color: #fff;
		width: 80px;
		height: 100%;
		overflow-y: auto;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 14px;
		color: #222222;
		.active {
			background-color: #f5f4f5;
			font-weight: bold;
			position: relative;
			&::after {
				content: "";
				height: 15px;
				width: 4px;
				background-color: #1677ff;
				position: absolute;
				top: 50%;
				left: 0;
				transform: translateY(-50%);
			}
		}
		.classification {
			padding: 20px 16px;
			box-sizing: border-box;
		}
	}
	.container-right {
		flex: 1;
		height: 100%;
		overflow-y: auto;
		.list {
			padding: 10px;
			box-sizing: border-box;
			width: 100%;
		}
	}
</style>