
<div class="layuimini-main">
  <blockquote class="layui-elem-quote layui-text">
   须按照格式导入，格式须为xlsx
   <a href="../demo/student.xlsx">点击下载demo文件</a>
</blockquote>
<div class="layui-form layuimini-main">

  
         <?
         $title="xlsx文件";
         $field="xlsx";
         $name="xlsx";
         $fvalue="";

         include(ADMINROOT.'/template/tpl/inputimg.tpl.php'); //
       ?>
        
         <div class="layui-form-item">
            <div class="layui-input-block">
             
              <input type="hidden" name="id">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="uploadxls" >确认上传</button>
            </div>
        </div>
   
</div>
</div>
<script>
    layui.use(['form', 'table','miniAdmin'], function () {
        var form = layui.form,
            layer = layui.layer,
            miniAdmin = layui.miniAdmin,
            table = layui.table,
            $ = layui.jquery;   
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

         // 进行登录操作
        form.on('submit(uploadxls)', function (data) {
            data = data.field;
            if (data.xlsx == '') {
                layer.msg('xlsx文件不能为空');
                return false;
            }
             layer.load(2);
             $.post("index.php?class=student&act=import",{xls:data.xlsx}, function(data) {
                 layer.closeAll('loading');    

                 if (data.code==0){
                     layer.alert(data.msg)
                 }else{
                     layer.alert(data.msg)
                }
             },"json");

             return false;
        });

    });
</script>