imageUtils.js
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var __image_utils = {
setImage : function(_param) {
var el = _param.el ,
loadcb = _param.loadcb,
closecb = _param.closecb;
el.imageUpload({
width: _param.width,
height: _param.height,
uploadInputName : _param.uploadInputName,
realInputName: _param.realInputName,
url: _param.uploadImageUrl,
queryParams: {
uploadFileName : _param.uploadInputName,
bucket: _param.bucket
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
//loadcb && loadcb(data.data);
return false;
},
onClose: function(){
closecb && closecb();
}
});
var val = el.attr('value');
if (val) {
el.imageUpload("setValue", val);
}
}
}