上传图片 添加加载中动画

This commit is contained in:
浅念
2025-09-01 14:22:08 +08:00
parent 431c41be79
commit ec19e24f68
10 changed files with 96 additions and 6 deletions
+9
View File
@@ -365,11 +365,20 @@
url:baseUrl+ 'console/upload/image',
accept: 'images',
field: 'image',
before: function(obj) {
// 显示上传loading
showUploadLoading();
},
done: function(res){
hideUploadLoading();
if(res.code == 0){
$item.find('img').attr('src',res.data.image_url);
$item.find('input').val(res.data.image_name);
}
},
error: function() {
layer.msg('上传失败');
hideUploadLoading();
}
});
});
+9
View File
@@ -436,13 +436,22 @@
url:baseUrl+ 'console/upload/image',
accept: 'images',
field: 'image',
before: function(obj) {
// 显示上传loading
showUploadLoading();
},
done: function(res){
hideUploadLoading();
if(res.code == 0){
// var $preview = $item.find('.preview-box');
// $preview.html('<img src="'+res.data.src+'" style="max-width:100px;">');
$item.find('img').attr('src',res.data.image_url);
$item.find('input').val(res.data.image_name);
}
},
error: function() {
layer.msg('上传失败');
hideUploadLoading();
}
});
});
+9
View File
@@ -255,11 +255,20 @@
url:baseUrl+ 'console/upload/image',
accept: 'images',
field: 'image',
before: function(obj) {
// 显示上传loading
showUploadLoading();
},
done: function(res){
hideUploadLoading();
if(res.code == 0){
$item.find('img').attr('src',res.data.image_url);
$item.find('input').val(res.data.image_name);
}
},
error: function() {
layer.msg('上传失败');
hideUploadLoading();
}
});
});
+9
View File
@@ -360,11 +360,20 @@
url:baseUrl+ 'console/upload/image',
accept: 'images',
field: 'image',
before: function(obj) {
// 显示上传loading
showUploadLoading();
},
done: function(res){
hideUploadLoading();
if(res.code == 0){
$item.find('img').attr('src',res.data.image_url);
$item.find('input').val(res.data.image_name);
}
},
error: function() {
layer.msg('上传失败');
hideUploadLoading();
}
});
});
+9
View File
@@ -76,11 +76,20 @@
url:baseUrl+ 'console/upload/image',
accept: 'images',
field: 'image',
before: function(obj) {
// 显示上传loading
showUploadLoading();
},
done: function(res){
hideUploadLoading();
if(res.code == 0){
$(".img-3").attr('src',res.data.image_url);
$("#avatarinput").val(res.data.image_name);
}
},
error: function() {
layer.msg('上传失败');
hideUploadLoading();
}
});
//监听提交
+9
View File
@@ -120,11 +120,20 @@
url:baseUrl+ 'console/upload/image',
accept: 'images',
field: 'image',
before: function(obj) {
// 显示上传loading
showUploadLoading();
},
done: function(res){
hideUploadLoading();
if(res.code == 0){
$(".img-3").attr('src',res.data.image_url);
$("#avatarinput").val(res.data.image_name);
}
},
error: function() {
layer.msg('上传失败');
hideUploadLoading();
}
});
});