您现在的位置是:网站首页 >> 网站技术
网站技术

联 系 人:李总
联系电话:13759574266
在线 QQ:89417157
邮箱:13759574266@qq.com
微信号:ynlongtou
地址:昆明市滇缅大道旁昆建路5号108智库空间A座4楼

网站技术

解决UEditor百度编辑器多图上传按照选择图片的顺序排列

  今天微信有个朋友说我们的系统怎么不能按照图片的顺序进行排列,今天教大家如何进行简单的配置,废话不多说,入正题。

  在我们做站点的时候,用的最多的就是百度UEditor编辑器,用UEditor的多图上传时,编辑器会按照上传成功的先后顺序来排列图片。那么如果想修改为按照选择图片的先后顺序进行排列应该如何修改呢?

解决方法:

修改 /template/admin/public/js/ueditor/dialogs/imag/image.js文件

找到_this.imageList.push(json);替换成_this.imageList[$file.index()] = json;(注意标点符号)

为了防止出现问题,可以将以下文件进行备份或者注释:

uploader.on('uploadSuccess', function (file, ret) {

var $file = $('#' + file.id);

try {

var responseText = (ret._raw || ret),

json = utils.str2json(responseText);

if (json.state == 'SUCCESS') {

//_this.imageList.push(json);

_this.imageList[$file.index()] = json;

$file.append('');

} else {

$file.find('.error').text(json.state).show();

}

} catch (e) {

$file.find('.error').text(lang.errorServerUpload).show();

}

});


修改:/template/admin/public/js/ueditor/dialogs/attachment/attachment.js文件,

找到_this.fileList.push(json);替换成 _this.fileList[$file.index()] = json;

修改后的内容:

uploader.on('uploadSuccess', function (file, ret) {

var $file = $('#' + file.id);

try {

var responseText = (ret._raw || ret),

json = utils.str2json(responseText);

if (json.state == 'SUCCESS') {

//_this.fileList.push(json);

_this.fileList[$file.index()] = json;

$file.append('');

} else {

$file.find('.error').text(json.state).show();

}

} catch (e) {

$file.find('.error').text(lang.errorServerUpload).show();

}

})

  【特别提示】修改之后,记得清理下浏览器缓存和系统缓存。