|
|
@@ -0,0 +1,669 @@
|
|
|
+import { RootState } from "@/store";
|
|
|
+import { GoodsTableSearch } from "@/types";
|
|
|
+import { Button, Form, Input, message, Popconfirm, Radio, Select } from "antd";
|
|
|
+import TextArea from "antd/es/input/TextArea";
|
|
|
+import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
+import {
|
|
|
+ PlusOutlined,
|
|
|
+ CloseCircleOutlined,
|
|
|
+ UploadOutlined,
|
|
|
+ PlayCircleOutlined,
|
|
|
+ CloseOutlined
|
|
|
+} from "@ant-design/icons";
|
|
|
+import { useDispatch, useSelector } from "react-redux";
|
|
|
+import styles from "./index.module.scss";
|
|
|
+import ImageLazy from "@/components/ImageLazy";
|
|
|
+import {
|
|
|
+ goodsDetailById,
|
|
|
+ goodsSaveAPI,
|
|
|
+ goodsUploadAPI,
|
|
|
+} from "@/store/action/goods";
|
|
|
+import { baseURL } from "@/utils/http";
|
|
|
+import { ExhibitTableType } from "@/types/api/exhibit";
|
|
|
+
|
|
|
+// 上传附件的进度条
|
|
|
+const UpAsyncLodingDom: any = document.querySelector("#UpAsyncLoding");
|
|
|
+const progressDom: any = document.querySelector("#progress");
|
|
|
+
|
|
|
+type Props = {
|
|
|
+ id: any;
|
|
|
+ closePage: () => void;
|
|
|
+ upTableList: () => void;
|
|
|
+ addTableList: () => void;
|
|
|
+ ExhibitList: ExhibitTableType[];
|
|
|
+};
|
|
|
+
|
|
|
+function GoodsAdd({
|
|
|
+ id,
|
|
|
+ closePage,
|
|
|
+ upTableList,
|
|
|
+ addTableList,
|
|
|
+ ExhibitList,
|
|
|
+}: Props) {
|
|
|
+ const dispatch = useDispatch();
|
|
|
+
|
|
|
+ // 从仓库获取下拉列表数据
|
|
|
+ const dictList = useSelector((state: RootState) => state.loginStore.dictList);
|
|
|
+
|
|
|
+ // 设置表单初始数据(区分编辑和新增)
|
|
|
+ const FormBoxRef = useRef<any>({});
|
|
|
+
|
|
|
+ const getInfoInAPIFu = useCallback(async (id: number) => {
|
|
|
+ const res = await goodsDetailById(id);
|
|
|
+ const data: GoodsTableSearch = res.data;
|
|
|
+ FormBoxRef.current.setFieldsValue(data);
|
|
|
+
|
|
|
+ setCover(data.thumb!);
|
|
|
+ setType(data.type!);
|
|
|
+
|
|
|
+ // if (data.type === "model") {
|
|
|
+ // setModelFile({ fileName: data.fileName!, filePath: data.filePath! });
|
|
|
+ // } else if (data.type === "img")
|
|
|
+ // setImgFile({ fileName: data.fileName!, filePath: data.filePath! });
|
|
|
+ // else if (data.type === "audio")
|
|
|
+ // setAudioFile({ fileName: data.fileName!, filePath: data.filePath! });
|
|
|
+ // else if (data.type === "video")
|
|
|
+ // setVideoFile({ fileName: data.fileName!, filePath: data.filePath! });
|
|
|
+
|
|
|
+ console.log("是编辑,在这里发请求拿数据", res);
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ // 没有通过校验
|
|
|
+ const onFinishFailed = useCallback(() => {
|
|
|
+ // return message.warning("有表单不符号规则!");
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (id) getInfoInAPIFu(id);
|
|
|
+ else {
|
|
|
+ setDirCode(Date.now() + "");
|
|
|
+ FormBoxRef.current.setFieldsValue({
|
|
|
+ topic: 1,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, [getInfoInAPIFu, id]);
|
|
|
+
|
|
|
+ // 上传的inputRef
|
|
|
+ const myInput = useRef<HTMLInputElement>(null);
|
|
|
+ const myInput2 = useRef<HTMLInputElement>(null);
|
|
|
+
|
|
|
+ // 封面图片
|
|
|
+ const [cover, setCover] = useState("");
|
|
|
+
|
|
|
+ // 文件类型
|
|
|
+ const [type, setType] = useState<"model" | "img" | "audio" | "video">(
|
|
|
+ "model"
|
|
|
+ );
|
|
|
+
|
|
|
+ // 文件的dirCode码
|
|
|
+ const [dirCode, setDirCode] = useState("");
|
|
|
+
|
|
|
+ // 模型的链接输入
|
|
|
+ const [modelFile, setModelFile] = useState({
|
|
|
+ fileName: "",
|
|
|
+ filePath: "",
|
|
|
+ id: "",
|
|
|
+ });
|
|
|
+
|
|
|
+ // 图片的附件信息
|
|
|
+ const [imgFile, setImgFile] = useState<
|
|
|
+ {
|
|
|
+ fileName: string;
|
|
|
+ filePath: string;
|
|
|
+ id: string;
|
|
|
+ }[]
|
|
|
+ >([]);
|
|
|
+
|
|
|
+ // 删除某一张图片
|
|
|
+ const delImgListFu = useCallback(
|
|
|
+ (id: string) => {
|
|
|
+ setImgFile(imgFile.filter((v) => v.id !== id));
|
|
|
+ },
|
|
|
+ [imgFile]
|
|
|
+ );
|
|
|
+
|
|
|
+ // 音频的附件信息
|
|
|
+ const [audioFile, setAudioFile] = useState({
|
|
|
+ fileName: "",
|
|
|
+ filePath: "",
|
|
|
+ id: "",
|
|
|
+ });
|
|
|
+
|
|
|
+ // 视频的附件信息
|
|
|
+ const [videoFile, setVideoFile] = useState({
|
|
|
+ fileName: "",
|
|
|
+ filePath: "",
|
|
|
+ id: "",
|
|
|
+ });
|
|
|
+
|
|
|
+ // 通过校验点击确定
|
|
|
+ const onFinish = useCallback(
|
|
|
+ async (values: GoodsTableSearch) => {
|
|
|
+ if (cover === "") return message.warning("请上传封面图!");
|
|
|
+ if (type === "model" && modelFile.filePath === "")
|
|
|
+ return message.warning("请输上传模型附件!");
|
|
|
+ if (type === "img" && imgFile.length === 0)
|
|
|
+ return message.warning("请上传图片附件!");
|
|
|
+ if (type === "audio" && audioFile.filePath === "")
|
|
|
+ return message.warning("请上传音频附件!");
|
|
|
+ if (type === "video" && videoFile.filePath === "")
|
|
|
+ return message.warning("请上传视频附件!");
|
|
|
+
|
|
|
+ let fileIds = "";
|
|
|
+
|
|
|
+ if (type === "model") fileIds = modelFile.id;
|
|
|
+ else if (type === "img") fileIds = imgFile.map((v) => v.id).join(",");
|
|
|
+ else if (type === "audio") fileIds = audioFile.id;
|
|
|
+ else if (type === "video") fileIds = videoFile.id;
|
|
|
+
|
|
|
+ const obj = {
|
|
|
+ ...values,
|
|
|
+ id: id ? id : null,
|
|
|
+ thumb: cover,
|
|
|
+ type: type,
|
|
|
+ fileIds,
|
|
|
+ dirCode: dirCode,
|
|
|
+ };
|
|
|
+
|
|
|
+ const res: any = await goodsSaveAPI(obj);
|
|
|
+
|
|
|
+ if (res.code === 0) {
|
|
|
+ message.success(id ? "编辑成功!" : "新增成功!");
|
|
|
+ if (id) upTableList();
|
|
|
+ else addTableList();
|
|
|
+
|
|
|
+ closePage();
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("通过校验,点击确定", res);
|
|
|
+ },
|
|
|
+ [
|
|
|
+ addTableList,
|
|
|
+ audioFile,
|
|
|
+ closePage,
|
|
|
+ cover,
|
|
|
+ dirCode,
|
|
|
+ id,
|
|
|
+ imgFile,
|
|
|
+ modelFile,
|
|
|
+ type,
|
|
|
+ upTableList,
|
|
|
+ videoFile,
|
|
|
+ ]
|
|
|
+ );
|
|
|
+
|
|
|
+ // 上传封面图
|
|
|
+ const handeUpPhoto = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
+ if (e.target.files) {
|
|
|
+ // 拿到files信息
|
|
|
+ const filesInfo = e.target.files[0];
|
|
|
+ // 校验格式
|
|
|
+ const type = ["image/jpeg", "image/png"];
|
|
|
+ if (!type.includes(filesInfo.type)) {
|
|
|
+ e.target.value = "";
|
|
|
+ return message.warning("只支持jpg、png格式!");
|
|
|
+ }
|
|
|
+ // 校验大小
|
|
|
+ if (filesInfo.size > 20 * 1024 * 1024) {
|
|
|
+ e.target.value = "";
|
|
|
+ return message.warning("最大支持20M!");
|
|
|
+ }
|
|
|
+ // 创建FormData对象
|
|
|
+ const fd = new FormData();
|
|
|
+ // 把files添加进FormData对象(‘photo’为后端需要的字段)
|
|
|
+ fd.append("type", "thumb");
|
|
|
+ fd.append("dirCode", dirCode);
|
|
|
+ fd.append("file", filesInfo);
|
|
|
+
|
|
|
+ e.target.value = "";
|
|
|
+
|
|
|
+ const res: any = await goodsUploadAPI(fd);
|
|
|
+ if (res.code === 0) {
|
|
|
+ message.success("上传成功!");
|
|
|
+ setCover(res.data.filePath);
|
|
|
+ }
|
|
|
+ UpAsyncLodingDom.style.opacity = 0;
|
|
|
+ progressDom.style.width = "0%";
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 上传附件
|
|
|
+ const handeUpPhoto2 = useCallback(
|
|
|
+ async (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
+ if (e.target.files) {
|
|
|
+ // 拿到files信息
|
|
|
+ const filesInfo = e.target.files[0];
|
|
|
+
|
|
|
+ let anType = ["image/jpeg", "image/png", "image/gif"];
|
|
|
+ let anTit1 = "只支持png、jpg、gif和jpeg格式!";
|
|
|
+ let anTit2 = "最大支持20M!";
|
|
|
+ let anSize = 20 * 1024 * 1024;
|
|
|
+
|
|
|
+ if (type === "audio") {
|
|
|
+ anType = ["audio/mpeg"];
|
|
|
+ anTit1 = "只支持mp3格式!";
|
|
|
+ anTit2 = "最大支持10M!";
|
|
|
+ anSize = 10 * 1024 * 1024;
|
|
|
+ } else if (type === "video") {
|
|
|
+ anType = ["video/mp4"];
|
|
|
+ anTit1 = "只支持mp4格式!";
|
|
|
+ anTit2 = "最大支持500M!";
|
|
|
+ anSize = 500 * 1024 * 1024;
|
|
|
+ } else if (type === "model") {
|
|
|
+ anType = [""];
|
|
|
+ anTit1 = "只支持4dage格式!";
|
|
|
+ anTit2 = "最大支持500M!";
|
|
|
+ anSize = 500 * 1024 * 1024;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验格式
|
|
|
+ if (type !== "model") {
|
|
|
+ if (!anType.includes(filesInfo.type)) {
|
|
|
+ e.target.value = "";
|
|
|
+ return message.warning(anTit1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!filesInfo.name.includes(".4dage")) {
|
|
|
+ e.target.value = "";
|
|
|
+ return message.warning(anTit1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验大小
|
|
|
+ if (filesInfo.size > anSize) {
|
|
|
+ e.target.value = "";
|
|
|
+ return message.warning(anTit2);
|
|
|
+ }
|
|
|
+ // 创建FormData对象
|
|
|
+ const fd = new FormData();
|
|
|
+ // 把files添加进FormData对象(‘photo’为后端需要的字段)
|
|
|
+ fd.append("type", type);
|
|
|
+ fd.append("file", filesInfo);
|
|
|
+
|
|
|
+ e.target.value = "";
|
|
|
+
|
|
|
+ const res: any = await goodsUploadAPI(fd);
|
|
|
+ if (res.code === 0) {
|
|
|
+ message.success("上传成功!");
|
|
|
+ if (type === "img") setImgFile([res.data, ...imgFile]);
|
|
|
+ else if (type === "audio") setAudioFile(res.data);
|
|
|
+ else if (type === "video") setVideoFile(res.data);
|
|
|
+ else if (type === "model") setModelFile(res.data);
|
|
|
+ }
|
|
|
+ UpAsyncLodingDom.style.opacity = 0;
|
|
|
+ progressDom.style.width = "0%";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ [imgFile, type]
|
|
|
+ );
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className={styles.GoodsAdd}>
|
|
|
+ <div className="pageTitlt">{id ? "编辑" : "新增"}馆藏</div>
|
|
|
+ <div className="formBox">
|
|
|
+ <div className="formBoxSon">
|
|
|
+ <Form
|
|
|
+ ref={FormBoxRef}
|
|
|
+ name="basic"
|
|
|
+ labelCol={{ span: 4 }}
|
|
|
+ onFinish={onFinish}
|
|
|
+ onFinishFailed={onFinishFailed}
|
|
|
+ autoComplete="off"
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ label="名称"
|
|
|
+ name="name"
|
|
|
+ rules={[{ required: true, message: "请输入名称!" }]}
|
|
|
+ getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
|
|
|
+ >
|
|
|
+ <Input maxLength={50} showCount placeholder="请输入内容" />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item
|
|
|
+ label="所属展馆"
|
|
|
+ name="exhibitionId"
|
|
|
+ rules={[{ required: true, message: "请选择所属展馆!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ placeholder="请选择"
|
|
|
+ style={{ width: 400 }}
|
|
|
+ options={ExhibitList.map((v) => ({
|
|
|
+ value: v.id,
|
|
|
+ label: v.name,
|
|
|
+ }))}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item
|
|
|
+ label="年代"
|
|
|
+ name="dictAge"
|
|
|
+ rules={[{ required: true, message: "请选择年代!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ placeholder="请选择"
|
|
|
+ style={{ width: 400 }}
|
|
|
+ options={dictList["age"].slice(1)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item
|
|
|
+ label="类别"
|
|
|
+ name="dictTexture"
|
|
|
+ rules={[{ required: true, message: "请选择类别!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ placeholder="请选择"
|
|
|
+ style={{ width: 400 }}
|
|
|
+ options={dictList["texture"].slice(1)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item
|
|
|
+ label="级别"
|
|
|
+ name="dictLevel"
|
|
|
+ rules={[{ required: true, message: "请选择级别!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ placeholder="请选择"
|
|
|
+ style={{ width: 400 }}
|
|
|
+ options={dictList["level"].slice(1)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item
|
|
|
+ label="来源"
|
|
|
+ name="dictSource"
|
|
|
+ rules={[{ required: true, message: "请选择来源!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ placeholder="请选择"
|
|
|
+ style={{ width: 400 }}
|
|
|
+ options={dictList["source"].slice(1)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item label="简历" name="description">
|
|
|
+ <TextArea
|
|
|
+ rows={4}
|
|
|
+ placeholder="请输入内容"
|
|
|
+ showCount
|
|
|
+ maxLength={500}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ <input
|
|
|
+ id="upInput"
|
|
|
+ type="file"
|
|
|
+ accept=".png,.jpg,.jpeg"
|
|
|
+ ref={myInput}
|
|
|
+ onChange={(e) => handeUpPhoto(e)}
|
|
|
+ />
|
|
|
+ <input
|
|
|
+ id="upInput2"
|
|
|
+ type="file"
|
|
|
+ accept={
|
|
|
+ type === "img"
|
|
|
+ ? ".gif,.png,.jpg,.jpeg"
|
|
|
+ : type === "audio"
|
|
|
+ ? ".mp3"
|
|
|
+ : type === "model"
|
|
|
+ ? ".4dage"
|
|
|
+ : ".mp4"
|
|
|
+ }
|
|
|
+ ref={myInput2}
|
|
|
+ onChange={(e) => handeUpPhoto2(e)}
|
|
|
+ />
|
|
|
+
|
|
|
+ {/* 封面图片 */}
|
|
|
+
|
|
|
+ <div className="formRow">
|
|
|
+ <div className="fileBoxRow_tit">封面图:</div>
|
|
|
+ <div
|
|
|
+ hidden={cover !== ""}
|
|
|
+ className="fileBoxRow_up"
|
|
|
+ onClick={() => myInput.current?.click()}
|
|
|
+ >
|
|
|
+ <PlusOutlined />
|
|
|
+ </div>
|
|
|
+ <div className="fileBoxRow_r_img" hidden={cover === ""}>
|
|
|
+ {cover ? (
|
|
|
+ <ImageLazy width={100} height={100} src={cover} />
|
|
|
+ ) : null}
|
|
|
+
|
|
|
+ <Popconfirm
|
|
|
+ title="删除后无法恢复,是否删除?"
|
|
|
+ okText="删除"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={() => setCover("")}
|
|
|
+ >
|
|
|
+ <div className="clearCover">
|
|
|
+ <CloseCircleOutlined />
|
|
|
+ </div>
|
|
|
+ </Popconfirm>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="fileBoxRow_r_tit">
|
|
|
+ 格式要求:支持png、jpg和jpeg的图片格式;最大支持20M。
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 文件类型 */}
|
|
|
+ <div className="formRow2">
|
|
|
+ <div className="fileBoxRow_tit">文件类型:</div>
|
|
|
+ <Radio.Group
|
|
|
+ onChange={(e) => setType(e.target.value)}
|
|
|
+ value={type}
|
|
|
+ >
|
|
|
+ <Radio value="model">模型</Radio>
|
|
|
+ <Radio value="img">图片</Radio>
|
|
|
+ <Radio value="audio">音频</Radio>
|
|
|
+ <Radio value="video">视频</Radio>
|
|
|
+ </Radio.Group>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 模型的文件上传 */}
|
|
|
+ <div className="upFileBox">
|
|
|
+ <div hidden={type !== "model"}>
|
|
|
+ <Button
|
|
|
+ hidden={!!modelFile.filePath}
|
|
|
+ onClick={() => myInput2.current?.click()}
|
|
|
+ icon={<UploadOutlined />}
|
|
|
+ >
|
|
|
+ 上传
|
|
|
+ </Button>
|
|
|
+
|
|
|
+ <div className="donUpFileBox">
|
|
|
+ <div className="fileRowBox">
|
|
|
+ <a
|
|
|
+ href={baseURL + modelFile.filePath}
|
|
|
+ download
|
|
|
+ target="_blank"
|
|
|
+ className="upSuccTxt"
|
|
|
+ rel="noreferrer"
|
|
|
+ >
|
|
|
+ {modelFile.fileName}
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <Popconfirm
|
|
|
+ title="删除后无法恢复,是否删除?"
|
|
|
+ okText="删除"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={() =>
|
|
|
+ setModelFile({ fileName: "", filePath: "", id: "" })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className="clearCover" hidden={!modelFile.fileName}>
|
|
|
+ <CloseCircleOutlined />
|
|
|
+ </div>
|
|
|
+ </Popconfirm>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="fileBoxRow_r_tit">
|
|
|
+ 仅支持4dage格式的模型文件,大小不能超过500M。
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 上传附件图片 */}
|
|
|
+ <div hidden={type !== "img"}>
|
|
|
+ <div className="upImgBox">
|
|
|
+ <div
|
|
|
+ hidden={imgFile.length >= 9}
|
|
|
+ className="fileBoxRow_up"
|
|
|
+ onClick={() => myInput2.current?.click()}
|
|
|
+ >
|
|
|
+ <PlusOutlined />
|
|
|
+ </div>
|
|
|
+ {imgFile.map((v) => (
|
|
|
+ <div className="fileBoxRow_r_img" key={v.id} >
|
|
|
+ {v.filePath ? (
|
|
|
+ <ImageLazy width={100} height={100} src={v.filePath} />
|
|
|
+ ) : null}
|
|
|
+
|
|
|
+ <Popconfirm
|
|
|
+ title="删除后无法恢复,是否删除?"
|
|
|
+ okText="删除"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={() => delImgListFu(v.id)}
|
|
|
+ >
|
|
|
+ <div className="clearCover">
|
|
|
+ <CloseOutlined />
|
|
|
+ </div>
|
|
|
+ </Popconfirm>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="fileBoxRow_r_tit">
|
|
|
+ 支持png、jpg、gif和jpeg的图片格式;最大支持20M;最多支持9张。
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 上传音频和视频 */}
|
|
|
+ <div hidden={type === "model" || type === "img"}>
|
|
|
+ <Button
|
|
|
+ hidden={
|
|
|
+ (type === "audio" && !!audioFile.filePath) ||
|
|
|
+ (type === "video" && !!videoFile.filePath)
|
|
|
+ }
|
|
|
+ onClick={() => myInput2.current?.click()}
|
|
|
+ icon={<UploadOutlined />}
|
|
|
+ >
|
|
|
+ 上传
|
|
|
+ </Button>
|
|
|
+
|
|
|
+ {type === "audio" ? (
|
|
|
+ <div className="donUpFileBox">
|
|
|
+ <div className="fileRowBox">
|
|
|
+ <a
|
|
|
+ href={baseURL + audioFile.filePath}
|
|
|
+ download
|
|
|
+ target="_blank"
|
|
|
+ className="upSuccTxt"
|
|
|
+ rel="noreferrer"
|
|
|
+ >
|
|
|
+ {audioFile.fileName}
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <Popconfirm
|
|
|
+ title="删除后无法恢复,是否删除?"
|
|
|
+ okText="删除"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={() =>
|
|
|
+ setAudioFile({ fileName: "", filePath: "", id: "" })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ className="clearCover"
|
|
|
+ hidden={!audioFile.fileName}
|
|
|
+ >
|
|
|
+ <CloseCircleOutlined />
|
|
|
+ </div>
|
|
|
+ </Popconfirm>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="fileBoxRow_r_tit">
|
|
|
+ 仅支持MP3格式的音频文件,大小不得超过10MB。
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ) : type === "video" ? (
|
|
|
+ <div className="donUpFileBox">
|
|
|
+ <div className="fileRowBox">
|
|
|
+ <div className="upSuccTxt">{videoFile.fileName}</div>
|
|
|
+ <div
|
|
|
+ className="clearCover"
|
|
|
+ hidden={!videoFile.fileName}
|
|
|
+ onClick={() =>
|
|
|
+ dispatch({
|
|
|
+ type: "login/lookVideo",
|
|
|
+ payload: videoFile.filePath,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <PlayCircleOutlined />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Popconfirm
|
|
|
+ title="删除后无法恢复,是否删除?"
|
|
|
+ okText="删除"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={() =>
|
|
|
+ setVideoFile({ fileName: "", filePath: "", id: "" })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ className="clearCover"
|
|
|
+ hidden={!videoFile.fileName}
|
|
|
+ >
|
|
|
+ <CloseCircleOutlined />
|
|
|
+ </div>
|
|
|
+ </Popconfirm>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="fileBoxRow_r_tit">
|
|
|
+ 仅支持MP4格式的视频文件,大小不得超过500MB。
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <br />
|
|
|
+ <Form.Item
|
|
|
+ label="展示状态"
|
|
|
+ name="display"
|
|
|
+ rules={[{ required: true, message: "请选择来源!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ placeholder="请选择"
|
|
|
+ style={{ width: 400 }}
|
|
|
+ options={[
|
|
|
+ { value: 1, label: "展示" },
|
|
|
+ { value: 0, label: "不展示" },
|
|
|
+ ]}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ {/* 确定和取消按钮 */}
|
|
|
+ <br />
|
|
|
+ <Form.Item wrapperCol={{ offset: 10, span: 16 }}>
|
|
|
+ <Button type="primary" htmlType="submit">
|
|
|
+ 提交
|
|
|
+ </Button>
|
|
|
+  
|
|
|
+ <Popconfirm
|
|
|
+ title="放弃编辑后,信息将不会保存!"
|
|
|
+ okText="放弃"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={closePage}
|
|
|
+ >
|
|
|
+ <Button>取消</Button>
|
|
|
+ </Popconfirm>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+const MemoGoodsAdd = React.memo(GoodsAdd);
|
|
|
+
|
|
|
+export default MemoGoodsAdd;
|