
@{
    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="SortName" 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="radio" name="ViewFlag" value="0" title="否">
				<input type="radio" name="ViewFlag" value="1" title="是" checked>
			</div>
		</div>
    <div class="layui-form-item">
        <label class="layui-form-label">父类ID</label>
        <div class="layui-input-block">
            <input type="text" name="ParentID" placeholder="默认为0" value="0" 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="Sequence" placeholder="排序号请输入数字" value="0" autocomplete="off" class="layui-input">
        </div>
    </div>
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">备注</label>
			<div class="layui-input-block">
				<textarea name="show" placeholder="请输入内容" class="layui-textarea"></textarea>
			</div>
		</div>

    <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 () {
        let form = layui.form;
        let laydate = layui.laydate;
        let angelLayer = layui.angelLayer;
        let angelUtils = layui.angelUtils;
        let upload = layui.upload;
        let layer = layui.layer;
        let $ = 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/atikuksclassapi/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>