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