|
@@ -9,11 +9,16 @@ import {
|
|
Modal,
|
|
Modal,
|
|
Select,
|
|
Select,
|
|
} from "antd";
|
|
} from "antd";
|
|
-import { A7_APIgetInfo, A7_APIgetListByTheme } from "@/store/action/A7school";
|
|
|
|
|
|
+import {
|
|
|
|
+ A7_APIgetInfo,
|
|
|
|
+ A7_APIgetListByTheme,
|
|
|
|
+ A7_APIsave,
|
|
|
|
+} from "@/store/action/A7school";
|
|
import { ListType } from "./A7theme";
|
|
import { ListType } from "./A7theme";
|
|
import MyPopconfirm from "@/components/MyPopconfirm";
|
|
import MyPopconfirm from "@/components/MyPopconfirm";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
import ZupOne from "@/components/ZupOne";
|
|
import ZupOne from "@/components/ZupOne";
|
|
|
|
+import { MessageFu } from "@/utils/message";
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
fId: number;
|
|
fId: number;
|
|
@@ -29,8 +34,20 @@ function A7tab1M({ fId, closeFu, addTableFu, upTableFu }: Props) {
|
|
const getInfoFu = useCallback(async (id: number) => {
|
|
const getInfoFu = useCallback(async (id: number) => {
|
|
const res = await A7_APIgetInfo(id);
|
|
const res = await A7_APIgetInfo(id);
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
- console.log(123, res);
|
|
|
|
- // setDirCode()
|
|
|
|
|
|
+ const data = res.data;
|
|
|
|
+
|
|
|
|
+ FormBoxRef.current?.setFieldsValue(data);
|
|
|
|
+
|
|
|
|
+ // 设置封面图
|
|
|
|
+ ZupOneRef1.current?.setFileComFileFu({
|
|
|
|
+ fileName: "",
|
|
|
|
+ filePath: data.thumb,
|
|
|
|
+ });
|
|
|
|
+ // 设置视频
|
|
|
|
+ ZupOneRef2.current?.setFileComFileFu({
|
|
|
|
+ fileName: data.fileName,
|
|
|
|
+ filePath: data.filePath,
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
@@ -44,9 +61,6 @@ function A7tab1M({ fId, closeFu, addTableFu, upTableFu }: Props) {
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
getSelList();
|
|
getSelList();
|
|
if (fId > 0) getInfoFu(fId);
|
|
if (fId > 0) getInfoFu(fId);
|
|
- else {
|
|
|
|
- // FormBoxRef.current?.setFieldsValue({});
|
|
|
|
- }
|
|
|
|
}, [fId, getInfoFu, getSelList]);
|
|
}, [fId, getInfoFu, getSelList]);
|
|
|
|
|
|
// 附件的ref
|
|
// 附件的ref
|
|
@@ -56,17 +70,38 @@ function A7tab1M({ fId, closeFu, addTableFu, upTableFu }: Props) {
|
|
// 附件 是否 已经点击过确定
|
|
// 附件 是否 已经点击过确定
|
|
const [fileCheck, setFileCheck] = useState(false);
|
|
const [fileCheck, setFileCheck] = useState(false);
|
|
|
|
|
|
- // 文件的code码
|
|
|
|
- const [dirCode, setDirCode] = useState("");
|
|
|
|
-
|
|
|
|
// 没有通过校验
|
|
// 没有通过校验
|
|
const onFinishFailed = useCallback(() => {
|
|
const onFinishFailed = useCallback(() => {
|
|
setFileCheck(true);
|
|
setFileCheck(true);
|
|
}, []);
|
|
}, []);
|
|
// 通过校验点击确定
|
|
// 通过校验点击确定
|
|
- const onFinish = useCallback(async (values: any) => {
|
|
|
|
- setFileCheck(true);
|
|
|
|
- }, []);
|
|
|
|
|
|
+ const onFinish = useCallback(
|
|
|
|
+ async (values: any) => {
|
|
|
|
+ setFileCheck(true);
|
|
|
|
+ // 没有传 封面图 或者视频
|
|
|
|
+ const coverUrl1 = ZupOneRef1.current?.fileComFileResFu();
|
|
|
|
+ const coverUrl2 = ZupOneRef2.current?.fileComFileResFu();
|
|
|
|
+
|
|
|
|
+ if (!coverUrl1.filePath || !coverUrl2.filePath) return;
|
|
|
|
+
|
|
|
|
+ const obj = {
|
|
|
|
+ ...values,
|
|
|
|
+ id: fId > 0 ? fId : null,
|
|
|
|
+ fileName: coverUrl2.fileName,
|
|
|
|
+ filePath: coverUrl2.filePath,
|
|
|
|
+ thumb: coverUrl1.filePath,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const res = await A7_APIsave(obj);
|
|
|
|
+
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ MessageFu.success(fId > 0 ? "编辑成功!" : "新增成功!");
|
|
|
|
+ fId > 0 ? addTableFu() : upTableFu();
|
|
|
|
+ closeFu();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ [addTableFu, closeFu, fId, upTableFu]
|
|
|
|
+ );
|
|
|
|
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
@@ -144,7 +179,7 @@ function A7tab1M({ fId, closeFu, addTableFu, upTableFu }: Props) {
|
|
isLook={false}
|
|
isLook={false}
|
|
fileCheck={fileCheck}
|
|
fileCheck={fileCheck}
|
|
size={2}
|
|
size={2}
|
|
- dirCode={dirCode}
|
|
|
|
|
|
+ dirCode="schoolThumb"
|
|
myUrl="cms/person/upload"
|
|
myUrl="cms/person/upload"
|
|
format={["image/jpeg", "image/png"]}
|
|
format={["image/jpeg", "image/png"]}
|
|
formatTxt="png、jpg和jpeg"
|
|
formatTxt="png、jpg和jpeg"
|
|
@@ -167,7 +202,7 @@ function A7tab1M({ fId, closeFu, addTableFu, upTableFu }: Props) {
|
|
isLook={false}
|
|
isLook={false}
|
|
fileCheck={fileCheck}
|
|
fileCheck={fileCheck}
|
|
size={500}
|
|
size={500}
|
|
- dirCode={dirCode}
|
|
|
|
|
|
+ dirCode="schoolVideo"
|
|
myUrl="cms/person/upload"
|
|
myUrl="cms/person/upload"
|
|
format={["video/mp4"]}
|
|
format={["video/mp4"]}
|
|
formatTxt="mp4"
|
|
formatTxt="mp4"
|