@ecoding/components.antd 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,24 +25,20 @@ const SingleFileUpload = (props) => {
|
|
|
25
25
|
break;
|
|
26
26
|
case "done":
|
|
27
27
|
const response = info.file.response;
|
|
28
|
-
if (response &&
|
|
28
|
+
if ((response && response.code === 200) || response.success) {
|
|
29
29
|
props.onDone && props.onDone(info.file, info.file.response.data);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
Toast.error({
|
|
33
33
|
mask: true,
|
|
34
|
-
title: info.file.response
|
|
35
|
-
? info.file.response.retDesc || info.file.response.desc || info.file.response.message
|
|
36
|
-
: "服务出错,文件上传失败"
|
|
34
|
+
title: info.file.response ? info.file.response.msg || info.file.response.message : "服务出错,文件上传失败"
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
37
|
break;
|
|
40
38
|
case "error":
|
|
41
39
|
Toast.error({
|
|
42
40
|
mask: true,
|
|
43
|
-
title: info.file.response
|
|
44
|
-
? info.file.response.retDesc || info.file.response.desc || info.file.response.message
|
|
45
|
-
: "服务出错,文件上传失败"
|
|
41
|
+
title: info.file.response ? info.file.response.msg || info.file.response.message : "服务出错,文件上传失败"
|
|
46
42
|
});
|
|
47
43
|
props.onError && props.onError(info.file);
|
|
48
44
|
break;
|
|
@@ -51,8 +51,8 @@ const ImgUpload = (props) => {
|
|
|
51
51
|
case "done":
|
|
52
52
|
setLoading(false);
|
|
53
53
|
const response = info.file.response;
|
|
54
|
-
if (response &&
|
|
55
|
-
const url =
|
|
54
|
+
if ((response && response.code === 200) || response.success) {
|
|
55
|
+
const url = response.data && response.data.url;
|
|
56
56
|
setImageUrl(url);
|
|
57
57
|
// Form.item 值注入关键
|
|
58
58
|
props.onChange && props.onChange(url);
|
|
@@ -60,18 +60,14 @@ const ImgUpload = (props) => {
|
|
|
60
60
|
else {
|
|
61
61
|
Toast.error({
|
|
62
62
|
mask: true,
|
|
63
|
-
title: info.file.response
|
|
64
|
-
? info.file.response.retDesc || info.file.response.desc || info.file.response.message
|
|
65
|
-
: "服务出错,图片上传失败"
|
|
63
|
+
title: info.file.response ? info.file.response.msg || info.file.response.message : "服务出错,图片上传失败"
|
|
66
64
|
});
|
|
67
65
|
}
|
|
68
66
|
break;
|
|
69
67
|
case "error":
|
|
70
68
|
Toast.error({
|
|
71
69
|
mask: true,
|
|
72
|
-
title: info.file.response
|
|
73
|
-
? info.file.response.retDesc || info.file.response.desc || info.file.response.message
|
|
74
|
-
: "服务出错,图片上传失败"
|
|
70
|
+
title: info.file.response ? info.file.response.msg || info.file.response.message : "服务出错,图片上传失败"
|
|
75
71
|
});
|
|
76
72
|
setLoading(false);
|
|
77
73
|
break;
|
|
@@ -154,7 +150,7 @@ const ImgUpload = (props) => {
|
|
|
154
150
|
props.gif ? "、gif" : ""))));
|
|
155
151
|
};
|
|
156
152
|
ImgUpload.defaultProps = {
|
|
157
|
-
action: "/upload/img",
|
|
153
|
+
action: "/api/upload/img",
|
|
158
154
|
name: "file",
|
|
159
155
|
value: "",
|
|
160
156
|
gif: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"author": "cxc",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"react-quill": "^2.0.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "cff4572674ded5234d2444bdb5598555f7545503"
|
|
44
44
|
}
|