qingjian/view/manager/widget/files.html

1 line
2.1 KiB
HTML

<div class="upload-image-box">
<div id="list{$append}" class="upload_img">
<div class="img-item" id="filename{$append}">
</div>
</div>
<div ><a target="_blank" href="{$src ?? ''}">{$src ?? ''}</a></div>
<div class="upload_img_btn" id="upload-file{$append}">
<i></i><p>上传文件</p>
</div>
<div class="upload layui-clear">
<div class="layui-clear"></div>
<div class="upload-image-points">
<p id="upload-image-src{$append}"></p>
<input type="hidden" id="picker{$append}" name="file{$append}" value="{$src ?? ''}" class="layui-file"/>
</div>
</div>
</div>
<script type="text/javascript">
var _token = $('#token').attr('content');
$(document).ready(function(){
var uploadUrl = "{:url('manager.upload/file')}";
layui.use(['upload','element'], function(){
var upload = layui.upload;
var element = layui.element;
var uploadInst = upload.render({
elem: "#upload-file{$append}"
,url: uploadUrl
,data: {_token:_token}
,field: 'file'
,accept: 'file'
,acceptMime: 'xlsx/*'
,choose: function(obj){
}
,before: function(obj){
layer.load();
}
,done: function(res, index, upload){
var imgInput = "#picker{$append}";
layer.closeAll('loading');
if(res.code == 0) {
$('#filename{$append}').text(res.data.src);
$('#picker{$append}').val(res.data.src);
} else {
layer.msg(res.msg,{time:1500});
}
}
,error: function(index, upload){
layer.closeAll('loading');
}
});
});
});
function imgdel(obj){
$('#picker{$append}').val('');
$(obj).parent().remove();
}
</script>