|
@@ -38,7 +38,7 @@ import {
|
|
|
} from "@/store/action/B2Goods";
|
|
|
import { baseURL } from "@/utils/http";
|
|
|
import { FileListType, GoodsTableType } from "@/types";
|
|
|
-import { domShowFu, progressDomFu } from "@/utils/domShow";
|
|
|
+import { fileDomInitialFu } from "@/utils/domShow";
|
|
|
import { CheckboxValueType } from "antd/es/checkbox/Group";
|
|
|
|
|
|
type Props = {
|
|
@@ -155,13 +155,16 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
|
|
|
|
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]
|
|
@@ -284,16 +287,19 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
|
|
|
|
e.target.value = "";
|
|
|
|
|
|
- const res: any = await goodsUploadAPI(fd);
|
|
|
+ const res = await goodsUploadAPI(fd);
|
|
|
|
|
|
- if (res.code === 0) {
|
|
|
- MessageFu.success("上传成功!");
|
|
|
- if (fileOneType === "img")
|
|
|
- setFileList({ ...fileList, img: [res.data, ...fileList.img] });
|
|
|
- else setFileList({ ...fileList, [fileOneType]: res.data });
|
|
|
+ try {
|
|
|
+ if (res.code === 0) {
|
|
|
+ MessageFu.success("上传成功!");
|
|
|
+ if (fileOneType === "img")
|
|
|
+ setFileList({ ...fileList, img: [res.data, ...fileList.img] });
|
|
|
+ else setFileList({ ...fileList, [fileOneType]: res.data });
|
|
|
+ }
|
|
|
+ fileDomInitialFu();
|
|
|
+ } catch (error) {
|
|
|
+ fileDomInitialFu();
|
|
|
}
|
|
|
- domShowFu("#UpAsyncLoding", false);
|
|
|
- progressDomFu("0%");
|
|
|
}
|
|
|
},
|
|
|
[dirCode, fileList, fileOneType]
|