{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
    text-align: center;
}
.dropdown-menu{
    z-index: 100000;
}
</style>

<section class="wrapper">
    <h3 class="">
        <a href="<?php echo url('@admin/Post/index')?>">
            <i class="fa fa-angle-right"></i> <a href="{:url('admin/banner/index')}">轮播图管理</a> <i class="fa fa-angle-right"></i> 添加轮播图
        </a>
    </h3>
    <hr>

    <?php if(isset($msg) && $msg):?>
    <div class="row margin-bottom">
        <div class="col-md-12">
            <div class="alert alert-danger alert-dismissible fade in" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
                <?php echo $msg;?>
            </div>
        </div>
    </div>
    <?php endif;?>

    <div class="row margin-bottom">
        <div class="col-md-12">
            <form name="myFrom" id="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{:url('admin/banner/create')}" id="article-create-form">
                <div class="form-group">
                    <label for="title" class="col-sm-1 control-label text-right" >图片</label>
                    <div class="col-lg-10 col-md-8 col-lg-6">
                        <input id="input-b1" name="image" class="validate[required]" type="file">
                        <span class="form-group-tip"> * 尺寸建议：375px*360px </span>
                    </div>
                </div>

                <div class="form-group">
                    <label for="title" class="col-sm-1 control-label text-right">类型</label>
                    <div class="col-lg-10 col-md-8 col-lg-6">
                        <select class="form-control" name="type" id="post_type">
                            <option value="1">小程序页面路径</option>
                            <option value="2">跳转到网页链接地址</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="title" class="col-sm-1 control-label text-right">链接</label>
                    <div class="col-lg-10 col-md-8 col-lg-6">
                        <input type="text" name="url" class="form-control validate[required]" >
                    </div>
                </div>

                <div class="form-group">
                    <label for="title" class="col-sm-1 control-label text-right">状态</label>
                    <div class="col-lg-10 col-md-8 col-lg-6">
                        <select class="form-control" name="status" id="post_type">
                            <option value="1">显示</option>
                            <option value="2">不显示</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-1 col-sm-10">
                        <button type="submit" class="btn btn-success" id="btn-save">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine.js"></script>

<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>

<script type="text/javascript">
$("#myFrom").validationEngine();
// 初始化文件上传
initFileInput($("#input-b1"));
// 单文件上传
function initFileInput(el,initArr,initConfig){
    // var initialPreview = [];
    // initialPreview.push(initArr);
    el.fileinput({
    language: 'zh',
    uploadExtraData:{'name':name},
    // initialPreview: initialPreview,
    uploadExtraData:{'name':'banner-choose'},
    // initialPreviewConfig: initConfig,
    autoReplace : true,
    showUpload:false, //是否显示上    传按钮
    initialPreviewShowDelete:true,
    initialPreviewAsData: true,
    dropZoneEnabled: false,
    showRemove :false,
    showUpload:false, //是否显示上    传按钮
    overwriteInitial:true,
    showUploadedThumbs:false,
    allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
  })
}
</script>
