Sha256: 30498429b3de138052f1b95b61ad688a3f1c16e9af5d6ae7da5829f7817dbf11

Contents?: true

Size: 1.65 KB

Versions: 189

Compression:

Stored size: 1.65 KB

Contents

<div style="padding-left: 50px">
        <button type="button" class="layui-btn" id="get_file"><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();

        //指定允许上传的文件类型
        var business_id = parent.id
        var renderObj = upload.render({
            elem: '#get_file'
            ,url: '/missions/upload_files?business_id='+business_id //此处配置你自己的上传接口即可
            ,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('file');
                layer.closeAll('loading'); //关闭loading
                layer.close(parent.import_index)
            }
            ,error: function(index, upload){
                table.reload('file');
                layer.closeAll('loading'); //关闭loading
                layer.alert('导入失败,请检查文件格式')
                layer.close(parent.import_index)
            }
        });
    });
</script>

Version data entries

189 entries across 189 versions & 1 rubygems

Version Path
educode_sales-0.9.52 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.51 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.50 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.49 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.48 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.47 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.46 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.45 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.44 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.43 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.42 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.41 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.40 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.39 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.38 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.37 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.36 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.35 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.34 app/views/educode_sales/businesses/upload_file.html.erb
educode_sales-0.9.33 app/views/educode_sales/businesses/upload_file.html.erb