@ecoding/components.antd 0.4.22 → 0.4.23

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.
@@ -14,6 +14,7 @@ import { buildURL } from "@ecoding/helper.url";
14
14
  import { DndContext, PointerSensor, useSensor } from '@dnd-kit/core';
15
15
  import { arrayMove, SortableContext, useSortable, horizontalListSortingStrategy, } from '@dnd-kit/sortable';
16
16
  import { CSS } from '@dnd-kit/utilities';
17
+ import Toast from "../../core/toast";
17
18
  const DraggableUploadListItem = ({ originNode, file }) => {
18
19
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
19
20
  id: file.uid,
@@ -63,17 +64,25 @@ const MultipleImgUpload = (props) => {
63
64
  onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(!isEmpty ? urls : undefined));
64
65
  };
65
66
  const handleChange = ({ fileList }) => {
66
- fileList && fileList.forEach((item) => {
67
- var _a, _b, _c;
68
- if (item.status == "done" && (((_a = item.response) === null || _a === void 0 ? void 0 : _a.code) == 200 || ((_b = item.response) === null || _b === void 0 ? void 0 : _b.code) == 0) && ((_c = item.response) === null || _c === void 0 ? void 0 : _c.data)) {
69
- item.url = item.response.data.url;
67
+ fileList && fileList.forEach((file) => {
68
+ if (file.status == "done") {
69
+ const response = file.response || {};
70
+ if (response.code === 200 ||
71
+ response.code === 0 ||
72
+ response.success ||
73
+ response.successed) {
74
+ const data = response.data || response.model;
75
+ file.url = data.url;
76
+ }
77
+ }
78
+ else if (file.status === "error") {
79
+ Toast.error({
80
+ mask: true,
81
+ title: file.response ? file.response.msg || file.response.message : `${props.i18n ? props.i18n.$t('global.upload.error.img') : '服务出错,图片上传失败'}`
82
+ });
70
83
  }
71
84
  });
72
85
  updateItems(fileList);
73
- // if (len) {
74
- // return;
75
- // }
76
- // updateItems(fileList)
77
86
  };
78
87
  const handleRemove = (file) => {
79
88
  const lefts = imgList.filter(item => item.uid !== file.uid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.4.22",
3
+ "version": "0.4.23",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "^6.0.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "92f998a40fb7a5d3f41530d8533ca3eed9fd22a0"
50
+ "gitHead": "5aa815b17cd22335a5983f6354f0313e7d6fc6cf"
51
51
  }