mui.plusReady(function() {
	var self = plus.webview.currentWebview();
	var userLevel = self.level
	// mui.alert(userLevel)
	var page = 1;
	var pagesize = 10;
	var isjiazai = 1;
	getRecommend(page, pagesize)

	function getRecommend(page, pagesize) {
		var recommenddata = {
			page: page ? page : 1,
			pagesize: pagesize ? pagesize : 10
		}
		recommenddata.userLevel = userLevel;
		if (-1 == userLevel) {
			recommenddata.isLock = 1;
		} else {
			recommenddata.isLock = 0;

		}
		if (isjiazai == 0) {
			return;
		} else {
			isjiazai = 0;
		}
		JZL.ajax(qlgUrl('app/users/myFriendList'), recommenddata, function(data) {
			//console.log(data);
			if (1 == data.status) {
				var data = data.data;
				var html = '';
				if (data.Rows == '') {
					$('.fri-con').append(
						'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; padding-top:9px;">没有更多朋友</p>');
					isjiazai = 0;
					return;
				}
				mui.each(data.Rows, function() {
					if (!this.lockReason || '' == this.lockReason) {
						html += '<div class="lock_row shadown_wai"><label for="">姓名</label><span for="">' + this.trueName +
							'</span><label for="">手机号</label><span for="" >' + this.userPhone + '</span></div>'
					} else {
						html += '<div class="list_row shadown_wai"><label for="">姓名</label><span for="">' + this.trueName +
							'</span><label for="">手机号</label><span for="">' + this.userPhone +
							'</span><label for="">锁定原因</label><span for="">' + this.lockReason +
							'</span><label for="">锁定时间</label><span for="">8' + this.lockTime +
							'小时</span><label for="">开始时间</label><span for="">' + this.createTime + '</span></div>'

					}

				})

				if (page == 1) {
					$('.fri-con').html(html);
				} else {
					$('.fri-con').append(html);
				}
				isjiazai = 1;
			} else {
				mui.alert(data.msg)
			}
		})
	}

	document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
		// 判断默认行为是否可以被禁用
		if (e.cancelable) {
			// 判断默认行为是否已经被禁用
			if (!e.defaultPrevented) {
				e.preventDefault();
			}
		}
		if (scroll.y == scroll.maxScrollY) {
			if (isjiazai == 1) {
				page++;
				getRecommend(page, pagesize);
			}
		}
		if (scroll.y > 80 && issx == 0) {
			issx = 1;
			setTimeout(function() {
				location.reload()
			}, 1000)
		}
	}, false)
})
