
@{
    ViewBag.Title = "Add";
    Layout = "~/Views/Shared/_LayoutForm.cshtml";
}
<style type="text/css">
    .fr {
        float: right;
    }

    .img-headshot {
        width: 90px;
        height: 90px;
        position: absolute;
        top: -30px;
        border: medium none;
        border-radius: 50%;
        cursor: pointer;
    }
</style>
<form class="layui-form layui-form-pane angel-form">
    <div class="layui-form-item">
        <label class="layui-form-label">登陆名</label>
        <div class="layui-input-block">
            <input type="text" name="ManageName" placeholder="账号" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="ManagePwd" placeholder="密码" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
@*    @Html.GenderRadioHtml()*@
@*    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-inline">
            <input name="HeadIcon" readonly id="HeadShot" placeholder="图片地址" value="" class="layui-input">
        </div>
        <div class="layui-input-inline layui-btn-container" style="width: auto;">
            <button type="button" class="layui-btn layui-btn-primary" id="btnUpload">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
            <div id="layer-photos-demo" class="fr">
                <img class="img-headshot" id="imgHeadShot" layer-pid="HeadShot" layer-src="~/Content/images/timg.jpg" src="~/Content/images/timg.jpg" alt="头像预览">
            </div>
        </div>
    </div>*@
    <div class="layui-form-item">
        <label class="layui-form-label">重复密码</label>
        <div class="layui-input-block">
            <input type="text" name="ReManagePwd" placeholder="重复密码" autocomplete="off" class="layui-input" maxlength="11">
        </div>
    </div>
@*    <div class="layui-form-item">
        <label class="layui-form-label">微信</label>
        <div class="layui-input-block">
            <input type="password" name="WeChat" placeholder="微信" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="Email" placeholder="邮箱" autocomplete="off" class="layui-input">
        </div>
    </div>
   <div class="layui-form-item">
        <label class="layui-form-label">出生日期</label>
        <div class="layui-input-block">
            <input type="text" name="Birthday" id="birthday" placeholder="请选择出生日期" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>*@
  
@*    @Html.EnabledMarkRadioHtml()*@
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="add">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(["form", "laydate", "angelLayer", "angelUtils", "upload", "layer"], function () {
        var form = layui.form;
        var laydate = layui.laydate;
        var angelLayer = layui.angelLayer;
        var angelUtils = layui.angelUtils;
        var upload = layui.upload;
        var layer = layui.layer;
        var $ = layui.$;
        //laydate.render({ elem: "#birthday" });
@*        upload.render({
            elem: '#btnUpload',
            url: '/Home/ExportFile',
            size: '@ViewBag.UploadFileSize',
            exts: '@ViewBag.UploadFileType',
            done: function (res) {
                if (res.code == 0) {
                    $("#HeadShot").val(res.src);
                    $("#imgHeadShot").attr("src", res.src);
                    $("#imgHeadShot").attr("layer-src", res.src)
                }
            }
        });*@
        //layer.photos({
        //    photos: '#layer-photos-demo',
        //    anim: 1
        //});
        form.on("submit(add)", function (data) {
            angelUtils.ajax("api/amanagerapi/postadd", "post", data.field, true).done(function (response) {
                angelLayer.greenTickMsg(response.message, function () {
                    parent.location.reload(); // 父页面刷新
                    parent.layer.close(parent.layer.getFrameIndex(window.name));//先得到当前iframe层的索引 再执行关闭
                });
            }).fail(function (error) {
                console.log(error)
            });
            return false;
        });
    });
</script>