// Generated by CoffeeScript 1.8.0
(function() {
  $(function() {
  
    $.ajax({
    	url:baseUrl+"/api/user/get_user_info.do",
        success:function(data){
        	if(data.status==200){
        		var user=data.data.userinfo;
        		$("#name").html(user.name);
        		$("#mobile").html(user.mobile);
        		if (user.email != null) {
        			$("#email").html(user.email);
        		}
        		if(user.portraitUri!=null&&user.portraitUri!=""&&user.portraitUri!=undefined){
        			$("#portrait")[0].src="/"+user.portraitUri;
        			$("#photo").on("tap",function(){
        				return location.href="../product/photo.html?src=/"+user.portraitUri;
        			});
        		}else{
        			$("#photo").on("tap",function(){
        				return location.href="../product/photo.html";
        			});
        		}
        		$("#uname,#EMAIL").on("tap",function(){
        			return location.href="./updateUserInfo.html";
        		});
        		$("#pwd").on("tap",function(){
        			return location.href="./updatePassword.html";
        		});
        	}else{
        		wrongMsg(data.message);
        		setTimeout(function(){
        			return location.href="./login.html";
        		},1000);
        		
        	}
        }
    });
    
    $("#exit").on("tap",function(){
    	localStorage.clear();
    	$.cookie("_id",null,{path:"/"});
    	$.cookie("_ts", null,{path:"/"});
    	$.cookie("token",null,{path:"/"});
    	$.cookie("uname",null,{path:"/"});
    	return location.href="../product/index.html";
    });
    
  });
  
}).call(this);
