|
@@ -1,5 +1,13 @@
|
|
|
import store, { RootState } from "@/store";
|
|
import store, { RootState } from "@/store";
|
|
|
-import { Button, Checkbox, Form, FormInstance, Input, Popconfirm, Select } from "antd";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ Button,
|
|
|
|
|
+ Checkbox,
|
|
|
|
|
+ Form,
|
|
|
|
|
+ FormInstance,
|
|
|
|
|
+ Input,
|
|
|
|
|
+ Popconfirm,
|
|
|
|
|
+ Select,
|
|
|
|
|
+} from "antd";
|
|
|
import React, {
|
|
import React, {
|
|
|
useCallback,
|
|
useCallback,
|
|
|
useEffect,
|
|
useEffect,
|
|
@@ -27,7 +35,7 @@ import {
|
|
|
} from "@/store/action/A3Goods";
|
|
} from "@/store/action/A3Goods";
|
|
|
import { baseURL } from "@/utils/http";
|
|
import { baseURL } from "@/utils/http";
|
|
|
import { FileListType, GoodsTableType } from "@/types";
|
|
import { FileListType, GoodsTableType } from "@/types";
|
|
|
-import { domShowFu, progressDomFu } from "@/utils/domShow";
|
|
|
|
|
|
|
+import { fileDomInitialFu } from "@/utils/domShow";
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
id: number;
|
|
id: number;
|
|
@@ -120,13 +128,16 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
|
|
|
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
|
|
|
|
|
- const res: any = await goodsUploadAPI(fd);
|
|
|
|
|
- if (res.code === 0) {
|
|
|
|
|
- MessageFu.success("上传成功!");
|
|
|
|
|
- setCover(res.data.filePath);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await goodsUploadAPI(fd);
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ MessageFu.success("上传成功!");
|
|
|
|
|
+ setCover(res.data.filePath);
|
|
|
|
|
+ }
|
|
|
|
|
+ fileDomInitialFu();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ fileDomInitialFu();
|
|
|
}
|
|
}
|
|
|
- domShowFu("#UpAsyncLoding", false);
|
|
|
|
|
- progressDomFu("0%");
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
[dirCode]
|
|
[dirCode]
|
|
@@ -229,16 +240,19 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
|
|
|
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
|
|
|
|
|
- const res: any = await goodsUploadAPI(fd);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await goodsUploadAPI(fd);
|
|
|
|
|
|
|
|
- if (res.code === 0) {
|
|
|
|
|
- MessageFu.success("上传成功!");
|
|
|
|
|
- if (fileOneType === "img")
|
|
|
|
|
- setFileList({ ...fileList, img: [...fileList.img, res.data] });
|
|
|
|
|
- else setFileList({ ...fileList, [fileOneType]: res.data });
|
|
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ MessageFu.success("上传成功!");
|
|
|
|
|
+ if (fileOneType === "img")
|
|
|
|
|
+ setFileList({ ...fileList, img: [...fileList.img, res.data] });
|
|
|
|
|
+ else setFileList({ ...fileList, [fileOneType]: res.data });
|
|
|
|
|
+ }
|
|
|
|
|
+ fileDomInitialFu();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ fileDomInitialFu();
|
|
|
}
|
|
}
|
|
|
- domShowFu("#UpAsyncLoding", false);
|
|
|
|
|
- progressDomFu("0%");
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
[dirCode, fileList, fileOneType]
|
|
[dirCode, fileList, fileOneType]
|