{{template "header"}}
<title>博客 - 个人随笔</title>
<link type="text/css" rel="styleSheet" href="/static/css/me.css"/>
<script type="text/javascript" src="/static/js/upload.js"></script>
</head>
<body>
<div class="root-container">
{{template "nav" .}}
{{template "memenu" .}}
    <div class="me-blog-root">
        <div class="me-blog-list">
            <ol class="breadcrumb">
                <li>个人中心</li>
                <li>我的资料</li>
                <li class="active">个人信息</li>
            </ol>
            <div style="display: flex">
                <div style="width: 128px">
                    <img src="{{.HeadImg}}" alt="头像" class="img-circle img-circle-large">
                    <div id="drop_area" style="margin-top: 15px"></div>
                </div>
                <div class="info-header">
                    <div style="display: flex">
                        <p style="flex: 1;color: #888">ID: {{.User.UserName}}</p>
                        <p><a href="/u/{{.User.Id}}" style="text-decoration: none">个人主页 ></a></p>
                    </div>
                    <div>
                        <span>博客 {{.User.BlogCount}}</span>
                        <span>浏览量 {{.User.BlogBrowes}}</span>
                        <span>博客 {{.User.BlogCount}}</span>
                        <span>博客 {{.User.BlogCount}}</span>
                    </div>
                    <hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 10px 0 5px 0;"/>
                    <div>
                        <div style="display: flex">
                            <p style="flex: 1">昵称 :{{.User.NickName}}</p>
                            <p><a href="javascript:void(0)" style="text-decoration: none" id="editBtn">修改资料</a></p>
                        </div>
                        <p>生日 :{{.User.Birthday.Format "2006-01-02"}}</p>
                        <p>邮箱 :{{.User.Email}}</p>
                        <p>手机 :{{.User.Mobile}}</p>
                        <p>Q Q :{{.User.QQ}}</p>
                    {{if eq 0  .User.Sex}}
                        <p>性别 :女</p>
                    {{else}}
                        <p>性别 :男</p>
                    {{end}}
                        <p>简介 :{{.User.DescInfo}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="me-footer">
        {{template "footer"}}
        </div>
    </div>
</div>
</div>
</body>
<script>
    var dragImgUpload = new DragImgUpload("#drop_area",{
        callback:function (files) {
            //回调函数,可以传递给后台等等
            var file = files[0];
            console.log(file.name);
            debugger
            var formData = new FormData();
            formData.append("imgfile",file );
            if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(file.name))
            {
                return false;
            }else{
                $.ajax({
                    url: '/himg/upload',
                    type:'POST',
                    contentType: false,
                    processData: false,
                    data: formData,
                    success:function(data,textstatus){
                        if (data.Status == 0){
                            layer.msg("上传成功", {icon: 6});
                        }else{
                            layer.msg("上传失败", {icon: 5});
                        }
                    }
                });
            }
        }
    })
    function refresh() {
        window.location.href = window.location.href
    }
    $(function () {
        $("#editBtn").click(function () {
            layer.open({
                type: 2,
                title: '修改个人资料',
                shadeClose: true,
                shade: 0.5,
                area: ['450px', '415px'],
                content: '/iframe/user.html' //iframe的url
            });
        })
    })
</script>
</html>