聯 系 人:李總
聯系電話:13759574266
在線 QQ:89417157
郵箱:13759574266@qq.com
微信號:ynlongtou
地址:昆明市滇緬大道旁昆建路5號108智庫空間A座4樓
今天微信有個朋友說我們的系統怎么不能按照圖片的順序進行排列,今天教大家如何進行簡單的配置,廢話不多說,入正題。
在我們做站點的時候,用的最多的就是百度UEditor編輯器,用UEditor的多圖上傳時,編輯器會按照上傳成功的先后順序來排列圖片。那么如果想修改為按照選擇圖片的先后順序進行排列應該如何修改呢?
解決方法:
修改 /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();
}
});
修改:/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();
}
})
【特別提示】修改之后,記得清理下瀏覽器緩存和系統緩存。
掃描關注官方微信