Skip to content

Commit e7fc004

Browse files
committed
Merge pull request pandao#201 from luckylh/master
跨域上传图片时,不直接进行判断是否上传图片成功
2 parents dc80a77 + fb9859f commit e7fc004

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

plugins/image-dialog/image-dialog.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,14 @@
134134
if (fileName === "")
135135
{
136136
alert(imageLang.uploadFileEmpty);
137-
137+
138138
return false;
139139
}
140-
140+
141141
if (!isImage.test(fileName))
142142
{
143143
alert(imageLang.formatNotAllowed + settings.imageFormats.join(", "));
144-
144+
145145
return false;
146146
}
147147

@@ -152,21 +152,24 @@
152152
var uploadIframe = document.getElementById(iframeName);
153153

154154
uploadIframe.onload = function() {
155-
155+
156156
loading(false);
157157

158158
var body = (uploadIframe.contentWindow ? uploadIframe.contentWindow : uploadIframe.contentDocument).document.body;
159159
var json = (body.innerText) ? body.innerText : ( (body.textContent) ? body.textContent : null);
160160

161161
json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
162162

163-
if (json.success === 1)
164-
{
165-
dialog.find("[data-url]").val(json.url);
166-
}
167-
else
163+
if(!settings.crossDomainUpload)
168164
{
169-
alert(json.message);
165+
if (json.success === 1)
166+
{
167+
dialog.find("[data-url]").val(json.url);
168+
}
169+
else
170+
{
171+
alert(json.message);
172+
}
170173
}
171174

172175
return false;

0 commit comments

Comments
 (0)