Sha256: cbb4e69205208d9d890bef7fb88f8357d398ac11b9c83dc13b1b935999b44c4e

Contents?: true

Size: 1.64 KB

Versions: 79

Compression:

Stored size: 1.64 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 idea_id = parent.idea_id
        var renderObj = upload.render({
            elem: '#get_file'
            , url: '/missions/upload_files?idea_id=' + idea_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

79 entries across 79 versions & 1 rubygems

Version Path
educode_sales-1.10.26 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.25 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.24 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.23 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.22 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.21 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.20 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.19 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.18 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.17 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.16 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.15 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.14 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.13 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.12 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.11 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.10 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.9 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.8 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.7 app/views/educode_sales/ideas/upload_file.html.erb