mui.plusReady(function() {

	window.addEventListener('reload', function(e) { //执行刷新
		location.reload();
	});
	var page = 1;
	var pageSize = 10;
	// var isloading = false;
	getRecommend();

	function getRecommend() {

		// //console.log(recommenddata);
		//获取亲人报备列表
		JZL.ajax(qlgUrl('app/auth/getAuthFamilyReportSelect'), {}, function(data) {
			//服务器返回响应，根据响应结果，分析是否登录成功；  
			//console.log(data);
			if (data.status == 1) {
				var html = '';
				var data = data.data;
				if (data == '') {
					$('.con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多数据</p>');
					return;
				}
				$.each(data, function() {
					html += '<div class="block clearfix"  data-id="' + this.id +
						'"><p class="pname">' + this.familyName + '(' + this.familyRelations +
						')</p><div class="caozuo"><span class="bj" data-id="' + this.id +
						'"><img src="../img/bianji.png"></span><span class="del" data-id="' + this.id +
						'"><img src="../img/delete.png"></span></div></div>';
				})
				$('.con').html(html);
			} else {
				mui.alert(data.msg)
			}
		});


	}
	// 	document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
	// 		if (scroll.y == scroll.maxScrollY) {
	// 			if (isloading == true) {
	// 				page++;
	// 				getRecommend(page, pageSize);
	// 			}
	// 		}
	// 	})

	var qrbbid;
	mui('.con').on('tap', '.bj', function() {
		qrbbid = $(this).attr('data-id')

		JZL.openWindow('addqrbb.html', qrbbid);

	})
	$('.con').on('tap', '.del', function() {
		qrbbid = $(this).attr('data-id')
		if (confirm('确认删除？')) {
			var lxy_div =
				'<div class="mui-backdrop lxy_home_zz" style="display: block;background-color: rgba(0,0,0,.7);" id="home_zhezhao">	<div class="lxy_zz clearfix"><h3>请输入操作密码</h3><div style="background:linear-gradient(to right,#48D1CC,#FFD700,#D2691E);height:5px; margin:10px auto"></div><input class="payword" type="password" placeholder="请输入操作密码"><div class="lxy_zz_btn"><button class="cancle" type="button">取消</button><button class="sure"  type="button">确定</button></div></div></div>';

			$('body').append(lxy_div);

			$('.lxy_zz').on('tap', function(e) {
				e.preventDefault();
				e.stopPropagation()
			})
			mui('.lxy_zz_btn').on('tap', '.cancle', function() {
				// $('#home_zhezhao').css('display', 'none');
				$('#home_zhezhao').remove();
				return;

			})

			mui('.lxy_zz_btn').on('tap', '.sure', function() {
				var payPwd = $('.payword').val();
				//console.log(payPwd);
				if (payPwd == '') {
					mui.alert("请输入密码")
				}
				JZL.ajax(qlgUrl('app/auth/delAuthFamily'), {
					isReport: 1,
					id: qrbbid,
					payPwd: payPwd
				}, function(data) { //服务器返回响应，根据响应结果，分析是否登录成功；  
					//console.log(data);
					var data = toJson(data, 1);
					if (data.status == 1) {
						$('#home_zhezhao').remove();
						location.reload()
					} else {
						mui.alert(data.msg)
					}
				})

			});
		}

	})
	/* 	mui('.mui-content').on('tap','.qrrz',function(){
			JZL.openWindow('qrrz.html', 'qrrz.html');
		
		}) */
	$('.add1').on('tap', function() {
		JZL.openWindow('addqrbb.html', 'addqrbb.html');
	})




})
