<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Powered by 9416.cn</title>


<!--#include file="../inc/conn.asp"-->


<script type="text/javascript" src="../ui/jquery.js"></script>
 <link rel="stylesheet" href="../ui/layui/css/layui.css" type="text/css"  />
 <style type="text/css">
 .user_avatar {
	float: left;
	height: 80px;
	width: 80px;

}
 .user_avatar img {

	height: 80px;
	width: 80px;
	border-radius:100%;
}

 .uploads {
	float: left;
	margin-left: 20px;
	margin-top:20px;
}
 .user_info {
	float: left;
	width: 100%;
	line-height: 40px;
	color: #999;
}
 </style>
<script type="text/javascript" src="../ui/layui/layui.js"></script>


</head>


<body>


  
   <div class="mec_div" style="padding:20px;">
 <%jianbook.uqxmsg()
sql="select * from [user] where id="&request.Cookies("user")("id")
  rs.open sql,conn,3,3%>
        <form id="form1" name="form1" class="layui-form"  method="post" action="?act=add&id=<%=request("id")%>">
  	   <table width="100%" border="0" cellspacing="0" cellpadding="0"  >
    <tr>
      <td width="110" height="50">会员账号：</td>
      <td><%=rs("email")%></td>
    </tr>
     <tr>
      <td width="110" height="50">会员头像：</td>
      <td>
	 <div class="layui-upload"> 
     <div class="user_avatar">
     <%if isnull(rs("pic")) then
	 
	 response.Write "<img src='../ui/images/user_08.png' /> "
	  else
	  response.Write "<img src='../"&rs("pic")&"' /> "
	 end if%>
   
         </div>
	<input name="pic" type="hidden" class="fileurl"   value="<%=rs("pic")%>"  />
 
  <input type="button" name="button"  value="上传头像" class="layui-btn layui-btn-primary uploads"   />
  
   
      </div>
        <div class="user_info">
       建议尺寸200*200;最大不能超过100KB</div>
      </td>
    </tr>
    
    <tr>
      <td width="100" height="50">昵称：</td>
      <td><input name="username" type="text" class="layui-input"  style="width:200px"  lay-verify="required" value="<%=rs("username")%>" placeholder="" /></td>
    </tr>
    
    <tr>
      <td height="50">登陆密码：</td>
      <td><input name="psw" type="text" class="layui-input" style="width:200px"   placeholder="不修改留空 "/></td>
    </tr>
    
    
       
        <tr>
          <td height="50"></td>
          <td><input type="submit" class="layui-btn" value="保存资料" lay-submit="lay-submit" /></td>
         </tr>
       </table>
 
  </form>
    
 
 
	
</div> 
 

<%

  if request("act")="add" then
  jianbook.demomsg()
if trim(request("psw"))<>"" then
  if len(request("psw"))>=6 then
  
  rs("code")=MD5(request("psw"))
  else
  response.Write"<script>alert('密码要大于6位字符'); </script>"
response.End()
  end if
  
 end if

rs("username")=request("username")
rs("pic")=request("pic")


	
        rs.update
		rs.close
	
jianbook.mgbox "保存成功","set.asp"
end if
	

 
 
%>
<script>

layui.use(['layer','form','laydate','upload','element'], function(){ 
  var  layer = layui.layer; 
   var form = layui.form;
    var element = layui.element;
	 var laydate = layui.laydate;
     var device = layui.device();
      var upload = layui.upload	  
	 upload.render({
    elem: '.uploads'
	,size:100
    ,url: '../upload/index.asp'
    ,before: function(obj){
	layer.load(); 
    }
    ,done: function(res){
		  layer.closeAll('loading');
      //如果上传失败
      if(res.code > 0){
        return layer.msg(res.msg);
      }
      //上传成功
	    if(res.code == 0){
		
	var item=this.item
		console.log(item)
	item.parent(".layui-upload").find(".fileurl").val(res.data["src"]);
	item.parent(".layui-upload").find(".user_avatar").html("<img src=../"+res.data["src"]+">");
        return layer.msg(res.msg);
		
      }
    }
    ,error: function(){
		  layer.closeAll('loading');
      //演示失败状态，并实现重传
     return layer.msg('上传失败');
    
    }
  });	





});






</script>
		

</body>

</html>
