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.74 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.73 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.72 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.71 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.70 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.59 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.58 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.49 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.48 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.46 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.41 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.37 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.36 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.35 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.34 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.33 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.31 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.30 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.29 app/views/educode_sales/ideas/upload_file.html.erb
educode_sales-1.10.28 app/views/educode_sales/ideas/upload_file.html.erb