|
@@ -0,0 +1,589 @@
|
|
|
|
+import { RootState } from "@/store";
|
|
|
|
+import { GoodsTableSearch } from "@/types";
|
|
|
|
+import history, { urlParameter } from "@/utils/history";
|
|
|
|
+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,
|
|
|
|
+} from "@ant-design/icons";
|
|
|
|
+import { useDispatch, useSelector } from "react-redux";
|
|
|
|
+import { useLocation } from "react-router-dom";
|
|
|
|
+import styles from "./index.module.scss";
|
|
|
|
+import ImageLazy from "@/components/ImageLazy";
|
|
|
|
+import {
|
|
|
|
+ goodsDetailById,
|
|
|
|
+ goodsSaveAPI,
|
|
|
|
+ goodsUploadAPI,
|
|
|
|
+} from "@/store/action/goods";
|
|
|
|
+import { baseURL } from "@/utils/http";
|
|
|
|
+
|
|
|
|
+// 上传附件的进度条
|
|
|
|
+const UpAsyncLodingDom: any = document.querySelector("#UpAsyncLoding");
|
|
|
|
+const progressDom: any = document.querySelector("#progress");
|
|
|
|
+
|
|
|
|
+type Props ={
|
|
|
|
+ id:number
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function GoodsAdd({id}:Props) {
|
|
|
|
+ const dispatch = useDispatch();
|
|
|
|
+
|
|
|
|
+ // 获取地址栏参数
|
|
|
|
+ const location = useLocation();
|
|
|
|
+ const urlParamRef = useRef<any>({});
|
|
|
|
+
|
|
|
|
+ const [id, SetId] = useState<any>(null);
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ urlParamRef.current = urlParameter(location.search);
|
|
|
|
+ if (urlParamRef.current.id) SetId(Number(urlParamRef.current.id));
|
|
|
|
+ // console.log("地址栏参数", urlParamRef.current);
|
|
|
|
+ }, [location]);
|
|
|
|
+
|
|
|
|
+ // 从仓库获取下拉列表数据
|
|
|
|
+ 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") setModelSrc(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 [modelSrc, setModelSrc] = useState("");
|
|
|
|
+
|
|
|
|
+ // 图片的附件信息
|
|
|
|
+ const [imgFile, setImgFile] = useState({ fileName: "", filePath: "" });
|
|
|
|
+
|
|
|
|
+ // 音频的附件信息
|
|
|
|
+ const [audioFile, setAudioFile] = useState({ fileName: "", filePath: "" });
|
|
|
|
+
|
|
|
|
+ // 视频的附件信息
|
|
|
|
+ const [videoFile, setVideoFile] = useState({ fileName: "", filePath: "" });
|
|
|
|
+
|
|
|
|
+ // 点击取消
|
|
|
|
+ const btnX = useCallback(() => {
|
|
|
|
+ history.push({
|
|
|
|
+ pathname: `/goods`,
|
|
|
|
+ state: { k: urlParamRef.current.k ? urlParamRef.current.k : "1" },
|
|
|
|
+ });
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
|
|
+ // 通过校验点击确定
|
|
|
|
+ const onFinish = useCallback(
|
|
|
|
+ async (values: GoodsTableSearch) => {
|
|
|
|
+ if (cover === "") return message.warning("请上传封面图!");
|
|
|
|
+ if (type === "model" && modelSrc === "")
|
|
|
|
+ return message.warning("请输入模型的链接地址!");
|
|
|
|
+ if (type === "img" && imgFile.filePath === "")
|
|
|
|
+ return message.warning("请上传图片附件!");
|
|
|
|
+ if (type === "audio" && audioFile.filePath === "")
|
|
|
|
+ return message.warning("请上传音频附件!");
|
|
|
|
+ if (type === "video" && videoFile.filePath === "")
|
|
|
|
+ return message.warning("请上传视频附件!");
|
|
|
|
+
|
|
|
|
+ let fileArr = { fileName: "", filePath: "" };
|
|
|
|
+
|
|
|
|
+ if (type === "model") fileArr = { fileName: "", filePath: modelSrc };
|
|
|
|
+ else if (type === "img") fileArr = imgFile;
|
|
|
|
+ else if (type === "audio") fileArr = audioFile;
|
|
|
|
+ else if (type === "video") fileArr = videoFile;
|
|
|
|
+
|
|
|
|
+ const obj = {
|
|
|
|
+ ...values,
|
|
|
|
+ id: id ? id : null,
|
|
|
|
+ thumb: cover,
|
|
|
|
+ type: type,
|
|
|
|
+ ...fileArr,
|
|
|
|
+ dirCode: dirCode,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const res: any = await goodsSaveAPI(obj);
|
|
|
|
+
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ message.success(id ? "编辑成功!" : "新增成功!");
|
|
|
|
+ btnX();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log("通过校验,点击确定", res);
|
|
|
|
+ },
|
|
|
|
+ [audioFile, btnX, cover, dirCode, id, imgFile, modelSrc, type, 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 > 10 * 1024 * 1024) {
|
|
|
|
+ e.target.value = "";
|
|
|
|
+ return message.warning("最大支持10M!");
|
|
|
|
+ }
|
|
|
|
+ // 创建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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 校验格式
|
|
|
|
+ if (!anType.includes(filesInfo.type)) {
|
|
|
|
+ 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);
|
|
|
|
+ else if (type === "audio") setAudioFile(res.data);
|
|
|
|
+ else if (type === "video") setVideoFile(res.data);
|
|
|
|
+ }
|
|
|
|
+ UpAsyncLodingDom.style.opacity = 0;
|
|
|
|
+ progressDom.style.width = "0%";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ [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={20} showCount placeholder="请输入内容" />
|
|
|
|
+ </Form.Item>
|
|
|
|
+
|
|
|
|
+ <Form.Item
|
|
|
|
+ label="登记编号"
|
|
|
|
+ name="num"
|
|
|
|
+ rules={[{ required: true, message: "请输入登记编号!" }]}
|
|
|
|
+ getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
|
|
|
|
+ >
|
|
|
|
+ <Input maxLength={20} showCount placeholder="请输入内容" />
|
|
|
|
+ </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="topic"
|
|
|
|
+ rules={[{ required: true, message: "请选择万物墙主题!" }]}
|
|
|
|
+ >
|
|
|
|
+ <Select
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ style={{ width: 400 }}
|
|
|
|
+ options={[
|
|
|
|
+ { label: "珍品", value: 1 },
|
|
|
|
+ { label: "精品", value: 2 },
|
|
|
|
+ ]}
|
|
|
|
+ />
|
|
|
|
+ </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="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={3}
|
|
|
|
+ placeholder="请输入内容"
|
|
|
|
+ showCount
|
|
|
|
+ maxLength={200}
|
|
|
|
+ />
|
|
|
|
+ </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"
|
|
|
|
+ : ".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的图片格式;最大支持10M。
|
|
|
|
+ </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"}>
|
|
|
|
+ <Input
|
|
|
|
+ value={modelSrc}
|
|
|
|
+ onChange={(e) =>
|
|
|
|
+ setModelSrc(e.target.value.replace(/\s+/g, ""))
|
|
|
|
+ }
|
|
|
|
+ maxLength={100}
|
|
|
|
+ showCount
|
|
|
|
+ placeholder="请输入衔接地址"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ {/* 上传附件图片 */}
|
|
|
|
+ <div hidden={type !== "img"}>
|
|
|
|
+ <div
|
|
|
|
+ hidden={imgFile.filePath !== ""}
|
|
|
|
+ className="fileBoxRow_up"
|
|
|
|
+ onClick={() => myInput2.current?.click()}
|
|
|
|
+ >
|
|
|
|
+ <PlusOutlined />
|
|
|
|
+ </div>
|
|
|
|
+ <div
|
|
|
|
+ className="fileBoxRow_r_img"
|
|
|
|
+ hidden={imgFile.filePath === ""}
|
|
|
|
+ >
|
|
|
|
+ {imgFile.filePath ? (
|
|
|
|
+ <ImageLazy
|
|
|
|
+ width={100}
|
|
|
|
+ height={100}
|
|
|
|
+ src={imgFile.filePath}
|
|
|
|
+ />
|
|
|
|
+ ) : null}
|
|
|
|
+
|
|
|
|
+ <Popconfirm
|
|
|
|
+ title="删除后无法恢复,是否删除?"
|
|
|
|
+ okText="删除"
|
|
|
|
+ cancelText="取消"
|
|
|
|
+ onConfirm={() => setImgFile({ fileName: "", filePath: "" })}
|
|
|
|
+ >
|
|
|
|
+ <div className="clearCover">
|
|
|
|
+ <CloseCircleOutlined />
|
|
|
|
+ </div>
|
|
|
|
+ </Popconfirm>
|
|
|
|
+ </div>
|
|
|
|
+ <div className="fileBoxRow_r_tit">
|
|
|
|
+ 格式要求:支持png、jpg、gif和jpeg的图片格式;最大支持20M。
|
|
|
|
+ </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: "" })
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ <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: "" })
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ <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 wrapperCol={{ offset: 10, span: 16 }}>
|
|
|
|
+ <Button type="primary" htmlType="submit">
|
|
|
|
+ 提交
|
|
|
|
+ </Button>
|
|
|
|
+  
|
|
|
|
+ <Popconfirm
|
|
|
|
+ title="放弃编辑后,信息将不会保存!"
|
|
|
|
+ okText="放弃"
|
|
|
|
+ cancelText="取消"
|
|
|
|
+ onConfirm={btnX}
|
|
|
|
+ >
|
|
|
|
+ <Button>取消</Button>
|
|
|
|
+ </Popconfirm>
|
|
|
|
+ </Form.Item>
|
|
|
|
+ </Form>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const MemoGoodsAdd = React.memo(GoodsAdd);
|
|
|
|
+
|
|
|
|
+export default MemoGoodsAdd;
|