修改图片管理

This commit is contained in:
Anyon 2022-06-30 14:56:05 +08:00
parent 423c3d424b
commit 229fdf2392
4 changed files with 4 additions and 4 deletions

View File

@ -188,7 +188,7 @@ define(['md5', 'notify'], function (SparkMD5, Notify, allowMime) {
$(this.option.elem.data('input')).val(file.xurl).trigger('change', file);
}
// 文件上传成功事件
this.event('choose', file.xurl).event('upload.done', {file: file, data: ret}, file, message);
this.event('push', file.xurl).event('upload.done', {file: file, data: ret}, file, message);
/*! 所有文件上传完成后结果处理 */
if (this.count.success + this.count.error >= this.count.total) {
this.option.hide || $.msg.close(this.loader);

View File

@ -75,7 +75,7 @@
},
// 设置选择数据
setValue: function (url) {
this.$btn.triggerHandler('choose', url);
this.$btn.triggerHandler('push', url);
if (this.$btn.data('input')) $(this.$btn.data('input')).val(url).trigger('change', url);
$('#ImageDialog').parents('.layui-layer-content').next().find('.layui-layer-close').trigger('click');
},

View File

@ -611,7 +611,7 @@ $(function () {
if ($(this).data('inited')) return true; else $(this).data('inited', true);
var $bt = $('<div class="uploadimage"><span><a data-file="mul" class="layui-icon layui-icon-upload-drag"></a></span><span data-file="images"></span></div>');
var ims = this.value ? this.value.split('|') : [], $in = $(this).after($bt);
$bt.find('[data-file]').attr('data-size', $in.data('size') || 0).attr('data-type', $in.data('type') || 'gif,png,jpg,jpeg').data('input', this).on('choose', function (evt, src) {
$bt.find('[data-file]').attr('data-size', $in.data('size') || 0).attr('data-type', $in.data('type') || 'gif,png,jpg,jpeg').data('input', this).on('done', function (evt, src) {
ims.push(src), $in.val(ims.join('|')), showImageContainer([src]);
}) && (ims.length > 0 && showImageContainer(ims))

View File

@ -25,7 +25,7 @@ CKEDITOR.plugins.add("uimage", {
editor.ui.addButton("UploadImage", {label: "上传本地图片", command: 'uimage', icon: 'image', toolbar: 'insert,10'});
setTimeout(function () {
$('#cke_' + editor.name).find('.cke_button__uploadimage_label').parent().map(function () {
$(this).attr('data-type', 'png,jpg,gif,jpeg').attr('data-file', 'mul').uploadFile(function (url) {
$(this).attr('data-type', 'png,jpg,gif,jpeg').attr('data-file', 'images').on('push', function (e, url) {
editor.insertElement(CKEDITOR.dom.element.createFromHtml('<div><img style="border:0;max-width:100%;" alt="" src="' + url + '"></div>'));
});
});