$(document).ready(function(){
	
	
})


var user = {
	children : function(){
		var url = webPath + "/rainbow/user/list?type=0";
		user.search(url);
	},
	caringPeople : function() {
		var url = webPath + "/rainbow/user/list?type=1";
		user.search(url);
	},
	search : function(url){
		var searchStr = $("#searchStr").val();
		
		
		if (searchStr != ""){
			var param = "&searchStr=" + searchStr;		
			url = url + param;
		}
			
		window.location.href = url;
	},
	openlayer: function(id,name) {
		user.userId = id;
		layer.open({
			  type: 1,
			  title:name,
			  skin: 'layui-layer-rim', //加上边框
			  area: ['300px', '200px'], //宽高
			  content: activityHTML,
			  success: function(layero, index){
				  	
			  }
			});

	},
	userId:"",
	validateWish:function(){
		var activityId = $("#activityId").val()
		if (activityId == ""){
			$("#message").html("请选择活动！");
			return;
		}
		$.ajax({
			  type: 'POST',
			  url: '/rainbow/wish/validate',
			  dataType:'json',
			  data: {
				  activityId: $("#activityId").val(),
				  userId:user.userId
				  
			  },
			  success: function(data){
				  if (data.message=="success"){
					  $(".layui-layer-close").click();
					  window.location.href=webPath + "/rainbow/wish/view?userId="+user.userId+"&activityId="+activityId;
				  } else {
					  $("#message").html("已有愿望！")
				  }
				 
			  }
		  })
		
	}
	
	
}