|
@@ -1,6 +1,6 @@
|
|
|
import { RootState } from "@/store";
|
|
import { RootState } from "@/store";
|
|
|
import { GoodsTableSearch } from "@/types";
|
|
import { GoodsTableSearch } from "@/types";
|
|
|
-import { Button, Form, Input, message, Popconfirm, Radio, Select } from "antd";
|
|
|
|
|
|
|
+import { Button, Form, Input, Popconfirm, Radio, Select } from "antd";
|
|
|
import TextArea from "antd/es/input/TextArea";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
import {
|
|
import {
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
} from "@/store/action/goods";
|
|
} from "@/store/action/goods";
|
|
|
import { baseURL } from "@/utils/http";
|
|
import { baseURL } from "@/utils/http";
|
|
|
import { ExhibitTableType } from "@/types/api/exhibit";
|
|
import { ExhibitTableType } from "@/types/api/exhibit";
|
|
|
|
|
+import { MessageFu } from "@/utils/message";
|
|
|
|
|
|
|
|
// 上传附件的进度条
|
|
// 上传附件的进度条
|
|
|
const UpAsyncLodingDom: any = document.querySelector("#UpAsyncLoding");
|
|
const UpAsyncLodingDom: any = document.querySelector("#UpAsyncLoding");
|
|
@@ -67,7 +68,7 @@ function GoodsAdd({
|
|
|
|
|
|
|
|
// 没有通过校验
|
|
// 没有通过校验
|
|
|
const onFinishFailed = useCallback(() => {
|
|
const onFinishFailed = useCallback(() => {
|
|
|
- // return message.warning("有表单不符号规则!");
|
|
|
|
|
|
|
+ // return MessageFu.warning("有表单不符号规则!");
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -158,15 +159,15 @@ function GoodsAdd({
|
|
|
// 通过校验点击确定
|
|
// 通过校验点击确定
|
|
|
const onFinish = useCallback(
|
|
const onFinish = useCallback(
|
|
|
async (values: GoodsTableSearch) => {
|
|
async (values: GoodsTableSearch) => {
|
|
|
- if (cover === "") return message.warning("请上传封面图!");
|
|
|
|
|
|
|
+ if (cover === "") return MessageFu.warning("请上传封面图!");
|
|
|
if (type === "model" && modelFile.filePath === "")
|
|
if (type === "model" && modelFile.filePath === "")
|
|
|
- return message.warning("请输上传模型附件!");
|
|
|
|
|
|
|
+ return MessageFu.warning("请输上传模型附件!");
|
|
|
if (type === "img" && imgFile.length === 0)
|
|
if (type === "img" && imgFile.length === 0)
|
|
|
- return message.warning("请上传图片附件!");
|
|
|
|
|
|
|
+ return MessageFu.warning("请上传图片附件!");
|
|
|
if (type === "audio" && audioFile.filePath === "")
|
|
if (type === "audio" && audioFile.filePath === "")
|
|
|
- return message.warning("请上传音频附件!");
|
|
|
|
|
|
|
+ return MessageFu.warning("请上传音频附件!");
|
|
|
if (type === "video" && videoFile.filePath === "")
|
|
if (type === "video" && videoFile.filePath === "")
|
|
|
- return message.warning("请上传视频附件!");
|
|
|
|
|
|
|
+ return MessageFu.warning("请上传视频附件!");
|
|
|
|
|
|
|
|
let fileIds = "";
|
|
let fileIds = "";
|
|
|
|
|
|
|
@@ -187,7 +188,7 @@ function GoodsAdd({
|
|
|
const res: any = await goodsSaveAPI(obj);
|
|
const res: any = await goodsSaveAPI(obj);
|
|
|
|
|
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
- message.success(id ? "编辑成功!" : "新增成功!");
|
|
|
|
|
|
|
+ MessageFu.success(id ? "编辑成功!" : "新增成功!");
|
|
|
if (id) upTableList();
|
|
if (id) upTableList();
|
|
|
else addTableList();
|
|
else addTableList();
|
|
|
|
|
|
|
@@ -220,12 +221,12 @@ function GoodsAdd({
|
|
|
const type = ["image/jpeg", "image/png"];
|
|
const type = ["image/jpeg", "image/png"];
|
|
|
if (!type.includes(filesInfo.type)) {
|
|
if (!type.includes(filesInfo.type)) {
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
- return message.warning("只支持jpg、png格式!");
|
|
|
|
|
|
|
+ return MessageFu.warning("只支持jpg、png格式!");
|
|
|
}
|
|
}
|
|
|
// 校验大小
|
|
// 校验大小
|
|
|
if (filesInfo.size > 20 * 1024 * 1024) {
|
|
if (filesInfo.size > 20 * 1024 * 1024) {
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
- return message.warning("最大支持20M!");
|
|
|
|
|
|
|
+ return MessageFu.warning("最大支持20M!");
|
|
|
}
|
|
}
|
|
|
// 创建FormData对象
|
|
// 创建FormData对象
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
@@ -238,7 +239,7 @@ function GoodsAdd({
|
|
|
|
|
|
|
|
const res: any = await goodsUploadAPI(fd);
|
|
const res: any = await goodsUploadAPI(fd);
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
- message.success("上传成功!");
|
|
|
|
|
|
|
+ MessageFu.success("上传成功!");
|
|
|
setCover(res.data.filePath);
|
|
setCover(res.data.filePath);
|
|
|
}
|
|
}
|
|
|
UpAsyncLodingDom.style.opacity = 0;
|
|
UpAsyncLodingDom.style.opacity = 0;
|
|
@@ -279,19 +280,19 @@ function GoodsAdd({
|
|
|
if (type !== "model") {
|
|
if (type !== "model") {
|
|
|
if (!anType.includes(filesInfo.type)) {
|
|
if (!anType.includes(filesInfo.type)) {
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
- return message.warning(anTit1);
|
|
|
|
|
|
|
+ return MessageFu.warning(anTit1);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
if (!filesInfo.name.includes(".4dage")) {
|
|
if (!filesInfo.name.includes(".4dage")) {
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
- return message.warning(anTit1);
|
|
|
|
|
|
|
+ return MessageFu.warning(anTit1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 校验大小
|
|
// 校验大小
|
|
|
if (filesInfo.size > anSize) {
|
|
if (filesInfo.size > anSize) {
|
|
|
e.target.value = "";
|
|
e.target.value = "";
|
|
|
- return message.warning(anTit2);
|
|
|
|
|
|
|
+ return MessageFu.warning(anTit2);
|
|
|
}
|
|
}
|
|
|
// 创建FormData对象
|
|
// 创建FormData对象
|
|
|
const fd = new FormData();
|
|
const fd = new FormData();
|
|
@@ -303,7 +304,7 @@ function GoodsAdd({
|
|
|
|
|
|
|
|
const res: any = await goodsUploadAPI(fd);
|
|
const res: any = await goodsUploadAPI(fd);
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
- message.success("上传成功!");
|
|
|
|
|
|
|
+ MessageFu.success("上传成功!");
|
|
|
if (type === "img") setImgFile([res.data, ...imgFile]);
|
|
if (type === "img") setImgFile([res.data, ...imgFile]);
|
|
|
else if (type === "audio") setAudioFile(res.data);
|
|
else if (type === "audio") setAudioFile(res.data);
|
|
|
else if (type === "video") setVideoFile(res.data);
|
|
else if (type === "video") setVideoFile(res.data);
|