Sha256: aad41268222bec1fef0cd32a6f4069b202ebd7ee6e7720fe919726bce94c5bd5

Contents?: true

Size: 1.56 KB

Versions: 408

Compression:

Stored size: 1.56 KB

Contents

<div style="padding-left: 50px">
        <button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>选择文件</button>
</div>
<script>
    layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'selectInput'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            laytpl = layui.laytpl,
            upload = layui.upload,
            request = layui.request,
            $ = layui.$;
        selectInput = layui.selectInput;

        form.render();

        //指定允许上传的文件类型
        upload.render({
            elem: '#test3'
            ,url: '/missions/import_teachers' //此处配置你自己的上传接口即可
            ,accept: 'file', //普通文件
                headers: {
                    'X-CSRF-Token': $('meta[name=csrf-token]').attr('content')
                }
            ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
                layer.load(); //上传loading
            }
            ,done: function(res){
                layer.msg('导入成功');
                table.reload('teachers_table');
                table.reload('activities_table');
                layer.close(parent.import_index)
                layer.closeAll('loading'); //关闭loading
            }
            ,error: function(index, upload){
                layer.closeAll('loading'); //关闭loading
                layer.alert('导入失败,请检查文件格式')
            }
        });
    });
</script>

Version data entries

408 entries across 200 versions & 1 rubygems

Version Path
educode_sales-1.10.74 app/views/educode_sales/ideas/import.html.erb
educode_sales-1.10.74 app/views/educode_sales/teachers/import.html.erb
educode_sales-1.10.74 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.73 app/views/educode_sales/teachers/import.html.erb
educode_sales-1.10.73 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.73 app/views/educode_sales/ideas/import.html.erb
educode_sales-1.10.72 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.72 app/views/educode_sales/ideas/import.html.erb
educode_sales-1.10.72 app/views/educode_sales/teachers/import.html.erb
educode_sales-1.10.71 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.71 app/views/educode_sales/ideas/import.html.erb
educode_sales-1.10.71 app/views/educode_sales/teachers/import.html.erb
educode_sales-1.10.70 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.70 app/views/educode_sales/ideas/import.html.erb
educode_sales-1.10.70 app/views/educode_sales/teachers/import.html.erb
educode_sales-1.10.59 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.59 app/views/educode_sales/ideas/import.html.erb
educode_sales-1.10.59 app/views/educode_sales/teachers/import.html.erb
educode_sales-1.10.58 app/views/educode_sales/idea_recycles/import.html.erb
educode_sales-1.10.58 app/views/educode_sales/ideas/import.html.erb