mui.plusReady(function(){
	var wait = 120;

	function time() {

		if(wait == 0) {
			$('#mobileCode').removeAttr("disabled");
			$('#mobileCode').val("重新发送");
			wait = 120;
		} else {
			$('#mobileCode').attr("disabled", true);
			$('#mobileCode').val("重新发送(" + wait + ")");
			wait--;
			setTimeout(function() {
					time();
				},
				1000)
		}

	}
	$(".photos").on("tap", 'img', function() {
		var _input = $(this).parent().parent().parent().prev()[0];
		UP.init(_input.id, "test", this.id)
		openCamera()
	})
	var token = localStorage.getItem('token');
	mui.ajax(qlgUrl('app/users/editPhone'), {
		headers: {
			"HYH-Token": token
		},
		data: {},
		dataType: 'json', //服务器返回json格式数据  
		type: 'post', //HTTP请求类型  
		timeout: 10000, //超时时间设置为10秒;  
		success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
			var data = toJson(data);
			if (data.status == 1) {
				data = data.data;
				if (data.userPhone) {
					$('#userPhone').val(data.userPhone);
				}
			}
		},
	})
	mui('.row').on('tap', '#mobileCode', function() {
		var that = $(this);
	
		that.attr("disabled", true);
		alert('功能开发中');
	// 	mui.ajax(hyhUrl('app/users/backpayCode'), { 
	// 
	// 		data: {},
	// 		dataType: 'json', //服务器返回json格式数据
	// 		type: 'post', //HTTP请求类型
	// 		timeout: 10000, //超时时间设置为10秒
	// 		success: function(data) {
	// 			var data = toJson(data);
	// 			//服务器返回响应,根据响应结果,分析是否登录成功;
	// 			if(data.status == 1) {
	// 				time();
	// 			} else {
	// 				alert(data.msg)
	// 			}
	// 			that.removeAttr('disabled');
	// 		},
	// 
	// 		error: function(xhr, type, errorThrown) {
	// 			//异常处理;
	// 			//							alert(type)
	// 			//						alert(type);      
	// 		}
	// 	}); 
	})
	mui('.down').on('tap', '#true', function() {
		var phoneCode = $('#phoneCode').val();
		var that = $(this);
		if(phoneCode == '') {
			alert('验证码不能为空!');
			return;
		} else if(phoneCode.length < 4) {
			alert('验证码格式不正确!');
			return;
		}
		alert('功能开发中');
	})
})