优化后台UI,修复文件上传组件
This commit is contained in:
@@ -586,9 +586,21 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
setFile: function(fileList, param){
|
||||
var file = $('#fileList_'+param.name);
|
||||
var field = $('#field_'+param.name);
|
||||
var html = '<div class="item"><div class="thumb"><div class="close"><i class="fa fa-close"></i></div><img src="#" /></div></div>';
|
||||
for(var i = 0; i < 10; i++){
|
||||
file.append(html);
|
||||
var value = field.val() ? field.val().split(",") : [];
|
||||
|
||||
if(param.limit == 1){
|
||||
var html = '<div class="item"><div class="thumb" data-id="'+fileList[0].id+'"><div class="close"><i class="fa fa-close"></i></div><img src="'+fileList[0].url+'" /></div></div>';
|
||||
file.html(html);
|
||||
field.val(fileList[0].id);
|
||||
}else{
|
||||
for(var i = 0; i < fileList.length; i++){
|
||||
if(!value.includes((fileList[i].id).toString())){
|
||||
var html = '<div class="item"><div class="thumb" data-id="'+fileList[i].id+'"><div class="close"><i class="fa fa-close"></i></div><img src="'+fileList[i].url+'" /></div></div>';
|
||||
value.push(fileList[i].id);
|
||||
file.append(html);
|
||||
}
|
||||
}
|
||||
field.val(value.join(','));
|
||||
}
|
||||
if(param.type == 'image'){
|
||||
Form.events.imageDel();
|
||||
|
||||
Reference in New Issue
Block a user