优化后台UI,修复文件上传组件
This commit is contained in:
@@ -125,6 +125,7 @@ define(['jquery', 'bootstrap', 'webupload'], function ($, undefined, WebUploader
|
||||
switch( type ) {
|
||||
case 'uploadFinished':
|
||||
Upload.setState( 'confirm' );
|
||||
Upload.uploadFinished();
|
||||
break;
|
||||
case 'uploadSuccess':
|
||||
Upload.uploadSuccess(response, file);
|
||||
@@ -148,7 +149,6 @@ define(['jquery', 'bootstrap', 'webupload'], function ($, undefined, WebUploader
|
||||
if ( $(this).hasClass( 'disabled' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( state === 'ready' ) {
|
||||
uploader.upload();
|
||||
} else if ( state === 'paused' ) {
|
||||
@@ -285,25 +285,7 @@ define(['jquery', 'bootstrap', 'webupload'], function ($, undefined, WebUploader
|
||||
});
|
||||
} else {
|
||||
$wrap.css( 'filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation='+ (~~((file.rotation/90)%4 + 4)%4) +')');
|
||||
// use jquery animate to rotation
|
||||
// $({
|
||||
// rotation: rotation
|
||||
// }).animate({
|
||||
// rotation: file.rotation
|
||||
// }, {
|
||||
// easing: 'linear',
|
||||
// step: function( now ) {
|
||||
// now = now * Math.PI / 180;
|
||||
|
||||
// var cos = Math.cos( now ),
|
||||
// sin = Math.sin( now );
|
||||
|
||||
// $wrap.css( 'filter', "progid:DXImageTransform.Microsoft.Matrix(M11=" + cos + ",M12=" + (-sin) + ",M21=" + sin + ",M22=" + cos + ",SizingMethod='auto expand')");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$li.appendTo( $queue );
|
||||
@@ -425,19 +407,40 @@ define(['jquery', 'bootstrap', 'webupload'], function ($, undefined, WebUploader
|
||||
},
|
||||
uploadSuccess: function(res, file){
|
||||
if (res.code == 1) {
|
||||
var query = sent.parseUrl(window.location.href);
|
||||
Upload.config.upList.push(res.info);
|
||||
if(Upload.config.upList.length > 0){
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
}else{
|
||||
sent.msg('未上传数据或上传失败!', 'error')
|
||||
}
|
||||
},
|
||||
uploadFinished: function(){
|
||||
var query = sent.parseUrl(window.location.href);
|
||||
if(Upload.config.upList.length > 0){
|
||||
if(query.limit == 1 && Upload.config.upList.length > 1){
|
||||
sent.msg('请单选图片或文件', 'error');
|
||||
return false;
|
||||
}
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
}else{
|
||||
sent.msg('未选择数据!', 'error')
|
||||
}
|
||||
},
|
||||
server: function(){
|
||||
var query = sent.parseUrl(window.location.href);
|
||||
if($('.img-list .item .thumb').length > 0){
|
||||
$('.img-list .item .thumb').on('click', function(){
|
||||
if($(this).hasClass('selected')){
|
||||
Upload.config.upList = Upload.config.upList.filter(item => !sent.utils.isObjEqual(item, $(this).data()));
|
||||
$(this).removeClass('selected');
|
||||
}else{
|
||||
Upload.config.upList.push($(this).data());
|
||||
$(this).addClass('selected');
|
||||
}
|
||||
})
|
||||
}
|
||||
$('button.btn-select').click(function(){
|
||||
var query = sent.parseUrl(window.location.href);
|
||||
if(Upload.config.upList.length > 0){
|
||||
if(query.limit == 1 && Upload.config.upList.length > 1){
|
||||
sent.msg('请单选图片或文件', 'error');
|
||||
return false;
|
||||
}
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
}else{
|
||||
sent.msg('未选择数据!', 'error')
|
||||
|
||||
Reference in New Issue
Block a user