shaogen1995 пре 1 година
родитељ
комит
1c94f46825

+ 155 - 173
src/pages/A1event/A1add/index.tsx

@@ -1,164 +1,156 @@
-import React, { useCallback, useEffect, useRef, useState } from "react";
-import styles from "./index.module.scss";
-import { A1EditInfoType } from "../data";
-import {
-  Button,
-  Checkbox,
-  DatePicker,
-  Form,
-  FormInstance,
-  InputNumber,
-  Select,
-} from "antd";
-import { A1_APIgetInfo, A1_APIsave } from "@/store/action/A1event";
-import dayjs from "dayjs";
-import { MessageFu } from "@/utils/message";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import ZupAudio from "@/components/ZupAudio";
-import ZupOne from "@/components/ZupOne";
-import ZRichTexts from "@/components/ZRichTexts";
-import classNames from "classnames";
-import TextArea from "antd/es/input/TextArea";
-
-const { RangePicker } = DatePicker;
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A1EditInfoType } from '../data'
+import { Button, Checkbox, DatePicker, Form, FormInstance, InputNumber, Select } from 'antd'
+import { A1_APIgetInfo, A1_APIsave } from '@/store/action/A1event'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import ZupAudio from '@/components/ZupAudio'
+import ZupOne from '@/components/ZupOne'
+import ZRichTexts from '@/components/ZRichTexts'
+import classNames from 'classnames'
+import TextArea from 'antd/es/input/TextArea'
+
+const { RangePicker } = DatePicker
 
 type Props = {
-  editInfo: A1EditInfoType;
-  closeFu: () => void;
-  editTableFu: () => void;
-  addTableFu: () => void;
-};
+  editInfo: A1EditInfoType
+  closeFu: () => void
+  editTableFu: () => void
+  addTableFu: () => void
+}
 
 function A1add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
-  const [dirCode, setDirCode] = useState("");
+  const [dirCode, setDirCode] = useState('')
 
   // 表单的ref
-  const FormBoxRef = useRef<FormInstance>(null);
+  const FormBoxRef = useRef<FormInstance>(null)
 
   // pc封面图的ref
-  const ZupPcRef = useRef<any>(null);
+  const ZupPcRef = useRef<any>(null)
 
-    // 移动端封面图的ref
-    const ZupAppRef = useRef<any>(null);
+  // 移动端封面图的ref
+  const ZupAppRef = useRef<any>(null)
 
   // 富文本的ref
-  const ZRichTextRef = useRef<any>(null);
+  const ZRichTextRef = useRef<any>(null)
 
   // 标题的音频
   const [nameAudio, setNameAudio] = useState({
-    fileName: "",
-    filePath: "",
-  });
+    fileName: '',
+    filePath: ''
+  })
 
   // 活动日期 是否长期有效
-  const [timeLong, setTimeLong] = useState(false);
+  const [timeLong, setTimeLong] = useState(false)
 
   // 编辑/查看 进入页面 获取信息
   const getInfoFu = useCallback(async (id: number) => {
-    const res = await A1_APIgetInfo(id);
+    const res = await A1_APIgetInfo(id)
     if (res.code === 0) {
-      const data = res.data;
+      const data = res.data
 
-      setDirCode(data.dirCode);
+      setDirCode(data.dirCode)
 
       // 设置标题的 音频
       if (data.fileName && data.filePath) {
         setNameAudio({
           fileName: data.fileName,
-          filePath: data.filePath,
-        });
+          filePath: data.filePath
+        })
       }
       // 设置富文本
-      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf));
+      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf))
 
       const obj = {
         ...data,
         myTime: dayjs(data.datePublish),
-        timeLong1: dayjs(data.dateStart),
-      };
+        timeLong1: dayjs(data.dateStart)
+      }
 
       if (data.dateEnd && data.dateStart) {
-        obj.timeLong2 = [dayjs(data.dateStart), dayjs(data.dateEnd)];
+        obj.timeLong2 = [dayjs(data.dateStart), dayjs(data.dateEnd)]
       } else {
         // 活动时间长期有效
-        setTimeLong(true);
+        setTimeLong(true)
       }
 
-      FormBoxRef.current?.setFieldsValue(obj);
+      FormBoxRef.current?.setFieldsValue(obj)
 
       // 设置封面图
       ZupPcRef.current?.setFileComFileFu({
-        fileName: "",
-        filePath: data.thumb,
-      });
+        fileName: '',
+        filePath: data.thumb
+      })
       ZupAppRef.current?.setFileComFileFu({
-        fileName: "",
-        filePath: data.thumbApp,
-      });
+        fileName: '',
+        filePath: data.thumbApp
+      })
     }
-  }, []);
+  }, [])
 
   useEffect(() => {
     if (editInfo.id > 0) {
-      getInfoFu(editInfo.id);
+      getInfoFu(editInfo.id)
     } else {
-      setDirCode(Date.now() + "");
+      setDirCode(Date.now() + '')
       FormBoxRef.current?.setFieldsValue({
         myTime: dayjs(Date.now()),
         sort: 999,
-        display: 1,
-      });
+        display: 1
+      })
     }
-  }, [editInfo.id, getInfoFu]);
+  }, [editInfo.id, getInfoFu])
 
   // 附件 是否 已经点击过确定
-  const [fileCheck, setFileCheck] = useState(false);
+  const [fileCheck, setFileCheck] = useState(false)
 
   // 没有通过校验
   const onFinishFailed = useCallback(() => {
-    setFileCheck(true);
-  }, []);
+    setFileCheck(true)
+  }, [])
 
   //  通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
-      setFileCheck(true);
+      setFileCheck(true)
 
       // 活动日期数据修改
-      let dateStart = "";
-      let dateEnd = "";
-      const timeLong1 = values.timeLong1;
-      const timeLong2 = values.timeLong2;
+      let dateStart = ''
+      let dateEnd = ''
+      const timeLong1 = values.timeLong1
+      const timeLong2 = values.timeLong2
 
       if (timeLong) {
         // 长期 dateEnd为空
-        dateStart = dayjs(timeLong1).format("YYYY-MM-DD");
-        dateEnd = "";
+        dateStart = dayjs(timeLong1).format('YYYY-MM-DD')
+        dateEnd = ''
       } else {
         // 有结束时间和开始时间
-        dateStart = dayjs(timeLong2[0]).format("YYYY-MM-DD");
-        dateEnd = dayjs(timeLong2[1]).format("YYYY-MM-DD");
+        dateStart = dayjs(timeLong2[0]).format('YYYY-MM-DD')
+        dateEnd = dayjs(timeLong2[1]).format('YYYY-MM-DD')
       }
-      const thumbPc = ZupPcRef.current?.fileComFileResFu();
+      const thumbPc = ZupPcRef.current?.fileComFileResFu()
       // 没有传 封面图
-      if (!thumbPc.filePath) return MessageFu.warning("请上传PC端封面!");
+      if (!thumbPc.filePath) return MessageFu.warning('请上传PC端封面!')
 
-      const thumbApp = ZupAppRef.current?.fileComFileResFu();
+      const thumbApp = ZupAppRef.current?.fileComFileResFu()
       // 没有传 封面图
-      if (!thumbApp.filePath) return MessageFu.warning("请上传移动端封面!");
+      if (!thumbApp.filePath) return MessageFu.warning('请上传移动端封面!')
 
       // 发布日期
-      const datePublish = dayjs(values.myTime).format("YYYY-MM-DD");
+      const datePublish = dayjs(values.myTime).format('YYYY-MM-DD')
 
       // 富文本校验不通过
-      const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true };
+      const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
 
-      if (rtf.flag) return MessageFu.warning("请输入完整正文!");
+      if (rtf.flag) return MessageFu.warning('请输入完整正文!')
 
       // 富文本标题集合
-      let rtfNameArr: string[] = [];
+      let rtfNameArr: string[] = []
       if (rtf.val && rtf.val.txtArr && rtf.val.txtArr.length) {
-        rtfNameArr = rtf.val.txtArr.map((v: any) => v.name);
+        rtfNameArr = rtf.val.txtArr.map((v: any) => v.name)
       }
 
       const obj = {
@@ -167,21 +159,21 @@ function A1add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
         datePublish,
         thumb: thumbPc.filePath,
         thumbApp: thumbApp.filePath,
-        rtf: JSON.stringify(rtf.val || ""),
+        rtf: JSON.stringify(rtf.val || ''),
         dateStart,
         dateEnd,
         fileName: nameAudio.fileName,
         filePath: nameAudio.filePath,
         dirCode,
-        rtfTitle: JSON.stringify(rtfNameArr),
-      };
+        rtfTitle: JSON.stringify(rtfNameArr)
+      }
 
-      const res = await A1_APIsave(obj);
+      const res = await A1_APIsave(obj)
 
       if (res.code === 0) {
-        MessageFu.success(`${editInfo.txt}成功!`);
-        editInfo.id > 0 ? editTableFu() : addTableFu();
-        closeFu();
+        MessageFu.success(`${editInfo.txt}成功!`)
+        editInfo.id > 0 ? editTableFu() : addTableFu()
+        closeFu()
       }
     },
     [
@@ -193,208 +185,198 @@ function A1add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
       editTableFu,
       nameAudio.fileName,
       nameAudio.filePath,
-      timeLong,
+      timeLong
     ]
-  );
+  )
 
   return (
     <div className={styles.A1add}>
-      <div
-        className={classNames(
-          "A1eMain",
-          editInfo.txt === "查看" ? "A1eMainLook" : ""
-        )}
-      >
+      <div className={classNames('A1eMain', editInfo.txt === '查看' ? 'A1eMainLook' : '')}>
         <Form
           ref={FormBoxRef}
-          name="basic"
+          name='basic'
           labelCol={{ span: 3 }}
           onFinish={onFinish}
           onFinishFailed={onFinishFailed}
-          autoComplete="off"
+          autoComplete='off'
           scrollToFirstError
         >
-          <div className="A1fromRow">
+          <div className='A1fromRow'>
             <Form.Item
-              label="标题"
-              name="name"
-              rules={[{ required: true, message: "请输入标题!" }]}
+              label='标题'
+              name='name'
+              rules={[{ required: true, message: '请输入标题!' }]}
             >
               <TextArea
-                readOnly={editInfo.txt === "查看"}
-                style={{ width: "500px" }}
-                maxLength={100}
+                readOnly={editInfo.txt === '查看'}
+                style={{ width: '500px' }}
+                maxLength={200}
                 showCount
-                placeholder="请输入内容"
+                placeholder='请输入内容'
               />
             </Form.Item>
             {/* 标题的无障碍音频 */}
-            <div className="A1_1Frow">
+            <div className='A1_1Frow'>
               <ZupAudio
                 fileInfo={nameAudio}
-                upDataFu={(info) => setNameAudio(info)}
-                delFu={() => setNameAudio({ fileName: "", filePath: "" })}
+                upDataFu={info => setNameAudio(info)}
+                delFu={() => setNameAudio({ fileName: '', filePath: '' })}
                 dirCode={dirCode}
-                myUrl="cms/event/upload"
-                isLook={editInfo.txt === "查看"}
+                myUrl='cms/event/upload'
+                isLook={editInfo.txt === '查看'}
               />
             </div>
           </div>
 
           {/* 封面 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               PC端封面:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZupOne
                 ref={ZupPcRef}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 fileCheck={fileCheck}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/event/upload"
-                format={["image/jpeg", "image/png"]}
-                formatTxt="png、jpg和jpeg"
-                checkTxt="请上传封面图!"
-                upTxt="最多1张"
-                myType="thumb"
+                myUrl='cms/event/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面图!'
+                upTxt='最多1张'
+                myType='thumb'
               />
             </div>
           </div>
 
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               移动端封面:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZupOne
                 ref={ZupAppRef}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 fileCheck={fileCheck}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/event/upload"
-                format={["image/jpeg", "image/png"]}
-                formatTxt="png、jpg和jpeg"
-                checkTxt="请上传封面图!"
-                upTxt="最多1张"
-                myType="thumb"
+                myUrl='cms/event/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面图!'
+                upTxt='最多1张'
+                myType='thumb'
               />
             </div>
           </div>
 
           {/* 正文 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               正文:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZRichTexts
                 check={fileCheck}
                 dirCode={dirCode}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 ref={ZRichTextRef}
-                myUrl="cms/event/upload"
+                myUrl='cms/event/upload'
               />
             </div>
           </div>
 
-          <div className="A1fromRow">
+          <div className='A1fromRow'>
             {timeLong ? (
               // 只有开始日期
               <Form.Item
-                label="活动日期"
-                name="timeLong1"
-                rules={[{ required: true, message: "请选择活动日期!" }]}
+                label='活动日期'
+                name='timeLong1'
+                rules={[{ required: true, message: '请选择活动日期!' }]}
               >
                 <DatePicker />
               </Form.Item>
             ) : (
               // 开始和结束日期
               <Form.Item
-                label="活动日期"
-                name="timeLong2"
-                rules={[{ required: true, message: "请选择活动日期!" }]}
+                label='活动日期'
+                name='timeLong2'
+                rules={[{ required: true, message: '请选择活动日期!' }]}
               >
                 <RangePicker />
               </Form.Item>
             )}
             &emsp;
             <Checkbox
-              className="A1_4Frow"
+              className='A1_4Frow'
               checked={timeLong}
-              onChange={(e) => setTimeLong(e.target.checked)}
+              onChange={e => setTimeLong(e.target.checked)}
             >
               长期有效
             </Checkbox>
           </div>
 
           <Form.Item
-            label="发布日期"
-            name="myTime"
-            rules={[{ required: true, message: "请选择发布日期!" }]}
+            label='发布日期'
+            name='myTime'
+            rules={[{ required: true, message: '请选择发布日期!' }]}
           >
             <DatePicker />
           </Form.Item>
 
-          <div className="A1fromRow">
+          <div className='A1fromRow'>
             <Form.Item
-              label="排序值"
-              name="sort"
-              rules={[{ required: true, message: "请输入排序值!" }]}
+              label='排序值'
+              name='sort'
+              rules={[{ required: true, message: '请输入排序值!' }]}
             >
-              <InputNumber
-                min={1}
-                max={999}
-                precision={0}
-                placeholder="请输入"
-              />
+              <InputNumber min={1} max={999} precision={0} placeholder='请输入' />
             </Form.Item>
-            <div className="A1_6Frow" hidden={editInfo.txt === "查看"}>
+            <div className='A1_6Frow' hidden={editInfo.txt === '查看'}>
               请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
             </div>
           </div>
 
           <Form.Item
-            label="状态"
-            name="display"
-            rules={[{ required: true, message: "请选择状态!" }]}
+            label='状态'
+            name='display'
+            rules={[{ required: true, message: '请选择状态!' }]}
           >
             <Select
-              placeholder="请选择状态"
+              placeholder='请选择状态'
               style={{ width: 149 }}
               options={[
-                { value: 1, label: "发布" },
-                { value: 0, label: "不发布" },
+                { value: 1, label: '发布' },
+                { value: 0, label: '不发布' }
               ]}
             />
           </Form.Item>
 
           {/* 确定和取消按钮 */}
-          <Form.Item className="A1Ebtn">
-            {editInfo.txt === "查看" ? (
+          <Form.Item className='A1Ebtn'>
+            {editInfo.txt === '查看' ? (
               <Button onClick={closeFu}>返回</Button>
             ) : (
               <>
-                <Button type="primary" htmlType="submit">
+                <Button type='primary' htmlType='submit'>
                   提交
                 </Button>
                 <br />
                 <br />
-                <MyPopconfirm txtK="取消" onConfirm={closeFu} />
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
               </>
             )}
           </Form.Item>
         </Form>
       </div>
     </div>
-  );
+  )
 }
 
-const MemoA1add = React.memo(A1add);
+const MemoA1add = React.memo(A1add)
 
-export default MemoA1add;
+export default MemoA1add

+ 67 - 82
src/pages/A1event/index.tsx

@@ -1,151 +1,138 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import { useDispatch, useSelector } from "react-redux";
-import { A1_APIdel, A1_APIgetList } from "@/store/action/A1event";
-import { A1EditInfoType, A1FromDataType, A1Selct } from "./data";
-import { RootState } from "@/store";
-import { MessageFu } from "@/utils/message";
-import { A1tableType } from "@/types";
-import { Button, Input, Select } from "antd";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import MyTable from "@/components/MyTable";
-import { A1tableC } from "@/utils/tableData";
-import A1add from "./A1add";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A1_APIdel, A1_APIgetList } from '@/store/action/A1event'
+import { A1EditInfoType, A1FromDataType, A1Selct } from './data'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { A1tableType } from '@/types'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import MyTable from '@/components/MyTable'
+import { A1tableC } from '@/utils/tableData'
+import A1add from './A1add'
 function A1event() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   const [fromData, setFromData] = useState<A1FromDataType>({
     pageNum: 1,
     pageSize: 10,
-    searchKey: "",
-    display: "",
-  });
+    searchKey: '',
+    display: ''
+  })
 
   const getListFu = useCallback(() => {
-    dispatch(A1_APIgetList(fromData));
-  }, [dispatch, fromData]);
+    dispatch(A1_APIgetList(fromData))
+  }, [dispatch, fromData])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu]);
+    getListFu()
+  }, [getListFu])
 
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
 
   // 标题的输入
-  const timeRef = useRef(-1);
+  const timeRef = useRef(-1)
   const fromKeyChangeFu = useCallback(
-    (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey") => {
-      clearTimeout(timeRef.current);
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey') => {
+      clearTimeout(timeRef.current)
       timeRef.current = window.setTimeout(() => {
-        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 });
-      }, 500);
+        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 })
+      }, 500)
     },
     [fromData]
-  );
+  )
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setInputKey(Date.now());
+    setInputKey(Date.now())
     setFromData({
       pageNum: 1,
       pageSize: 10,
-      searchKey: "",
-      display: "",
-    });
-  }, []);
+      searchKey: '',
+      display: ''
+    })
+  }, [])
 
-  const tableInfo = useSelector((state: RootState) => state.A1event.tableInfo);
+  const tableInfo = useSelector((state: RootState) => state.A1event.tableInfo)
 
   const delTableFu = useCallback(
     async (id: number) => {
-      const res = await A1_APIdel(id);
+      const res = await A1_APIdel(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
-        title: "操作",
+        title: '操作',
         render: (item: A1tableType) => (
           <>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "查看" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '查看' })}
             >
               查看
             </Button>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "编辑" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '编辑' })}
             >
               编辑
             </Button>
-            <MyPopconfirm txtK="删除" onConfirm={() => delTableFu(item.id)} />
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
           </>
-        ),
-      },
-    ];
-  }, [delTableFu]);
+        )
+      }
+    ]
+  }, [delTableFu])
 
   //查看、新增、编辑
   const [editInfo, setEditInfo] = useState<A1EditInfoType>({
     id: 0,
-    txt: "",
-  });
+    txt: ''
+  })
 
   return (
     <div className={styles.A1event}>
-      <div className="pageTitle">
-        事件管理{editInfo.id ? ` - ${editInfo.txt}` : ""}
-      </div>
+      <div className='pageTitle'>事件管理{editInfo.id ? ` - ${editInfo.txt}` : ''}</div>
 
       {/* 顶部筛选 */}
-      <div className="A1top">
-        <div className="A1topLeft">
+      <div className='A1top'>
+        <div className='A1topLeft'>
           <div>
             <span>标题:</span>
             <Input
               key={inputKey}
-              maxLength={100}
+              maxLength={200}
               showCount
               style={{ width: 300 }}
-              placeholder="请输入关键字"
+              placeholder='请输入关键字'
               allowClear
-              onChange={(e) => fromKeyChangeFu(e, "searchKey")}
+              onChange={e => fromKeyChangeFu(e, 'searchKey')}
             />
           </div>
           <div>
             <span>状态:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 200 }}
               value={fromData.display}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, display: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, display: e })}
               options={A1Selct}
             />
           </div>
         </div>
 
         <div>
-          <Button
-            type="primary"
-            onClick={() => setEditInfo({ id: -1, txt: "新增" })}
-          >
+          <Button type='primary' onClick={() => setEditInfo({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
@@ -154,7 +141,7 @@ function A1event() {
       </div>
 
       {/* 表格主体 */}
-      <div className="A1tableBox">
+      <div className='A1tableBox'>
         <MyTable
           yHeight={625}
           list={tableInfo.list}
@@ -163,9 +150,7 @@ function A1event() {
           pageNum={fromData.pageNum}
           pageSize={fromData.pageSize}
           total={tableInfo.total}
-          onChange={(pageNum, pageSize) =>
-            setFromData({ ...fromData, pageNum, pageSize })
-          }
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
         />
       </div>
 
@@ -173,15 +158,15 @@ function A1event() {
       {editInfo.id ? (
         <A1add
           editInfo={editInfo}
-          closeFu={() => setEditInfo({ id: 0, txt: "" })}
+          closeFu={() => setEditInfo({ id: 0, txt: '' })}
           editTableFu={() => getListFu()}
           addTableFu={() => resetSelectFu()}
         />
       ) : null}
     </div>
-  );
+  )
 }
 
-const MemoA1event = React.memo(A1event);
+const MemoA1event = React.memo(A1event)
 
-export default MemoA1event;
+export default MemoA1event

+ 1 - 1
src/pages/A2exhibition/A2add/index.tsx

@@ -284,7 +284,7 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
               <TextArea
                 readOnly={editInfo.txt === '查看'}
                 style={{ width: '500px' }}
-                maxLength={100}
+                maxLength={200}
                 showCount
                 placeholder='请输入内容'
               />

+ 76 - 97
src/pages/A2exhibition/index.tsx

@@ -1,147 +1,135 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import { useDispatch, useSelector } from "react-redux";
-import { A2FromDataType, A2Selct_1, A2Selct_2 } from "./data";
-import { A2_APIdel, A2_APIgetList } from "@/store/action/A2exhibition";
-import { A2tableType } from "@/types";
-import { RootState } from "@/store";
-import { MessageFu } from "@/utils/message";
-import { Button, Input, Select } from "antd";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import { A1EditInfoType, A1Selct } from "../A1event/data";
-import MyTable from "@/components/MyTable";
-import { A2tableC } from "@/utils/tableData";
-import A2add from "./A2add";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A2FromDataType, A2Selct_1, A2Selct_2 } from './data'
+import { A2_APIdel, A2_APIgetList } from '@/store/action/A2exhibition'
+import { A2tableType } from '@/types'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A1EditInfoType, A1Selct } from '../A1event/data'
+import MyTable from '@/components/MyTable'
+import { A2tableC } from '@/utils/tableData'
+import A2add from './A2add'
 function A2exhibition() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   const [fromData, setFromData] = useState<A2FromDataType>({
     pageNum: 1,
     pageSize: 10,
-    searchKey: "",
-    type: "",
-    display: "",
-    addrType: "",
-  });
+    searchKey: '',
+    type: '',
+    display: '',
+    addrType: ''
+  })
   const getListFu = useCallback(() => {
-    dispatch(A2_APIgetList(fromData));
-  }, [dispatch, fromData]);
+    dispatch(A2_APIgetList(fromData))
+  }, [dispatch, fromData])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu]);
+    getListFu()
+  }, [getListFu])
 
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
 
   // 标题的输入
-  const timeRef = useRef(-1);
+  const timeRef = useRef(-1)
   const fromKeyChangeFu = useCallback(
-    (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey") => {
-      clearTimeout(timeRef.current);
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey') => {
+      clearTimeout(timeRef.current)
       timeRef.current = window.setTimeout(() => {
-        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 });
-      }, 500);
+        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 })
+      }, 500)
     },
     [fromData]
-  );
+  )
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setInputKey(Date.now());
+    setInputKey(Date.now())
     setFromData({
       pageNum: 1,
       pageSize: 10,
-      searchKey: "",
-      type: "",
-      display: "",
-      addrType: "",
-    });
-  }, []);
+      searchKey: '',
+      type: '',
+      display: '',
+      addrType: ''
+    })
+  }, [])
 
-  const tableInfo = useSelector(
-    (state: RootState) => state.A2exhibition.tableInfo
-  );
+  const tableInfo = useSelector((state: RootState) => state.A2exhibition.tableInfo)
 
   const delTableFu = useCallback(
     async (id: number) => {
-      const res = await A2_APIdel(id);
+      const res = await A2_APIdel(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
-        title: "操作",
+        title: '操作',
         render: (item: A2tableType) => (
           <>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "查看" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '查看' })}
             >
               查看
             </Button>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "编辑" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '编辑' })}
             >
               编辑
             </Button>
-            <MyPopconfirm txtK="删除" onConfirm={() => delTableFu(item.id)} />
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
           </>
-        ),
-      },
-    ];
-  }, [delTableFu]);
+        )
+      }
+    ]
+  }, [delTableFu])
 
   //查看、新增、编辑
   const [editInfo, setEditInfo] = useState<A1EditInfoType>({
     id: 0,
-    txt: "",
-  });
+    txt: ''
+  })
   return (
     <div className={styles.A2exhibition}>
-      <div className="pageTitle">
-        展览管理{editInfo.id ? ` - ${editInfo.txt}` : ""}
-      </div>
+      <div className='pageTitle'>展览管理{editInfo.id ? ` - ${editInfo.txt}` : ''}</div>
 
       {/* 顶部筛选 */}
-      <div className="A2top">
-        <div className="A2topLeft">
+      <div className='A2top'>
+        <div className='A2topLeft'>
           <div>
             <span>标题:</span>
             <Input
               key={inputKey}
-              maxLength={100}
+              maxLength={200}
               showCount
               style={{ width: 300 }}
-              placeholder="请输入关键字"
+              placeholder='请输入关键字'
               allowClear
-              onChange={(e) => fromKeyChangeFu(e, "searchKey")}
+              onChange={e => fromKeyChangeFu(e, 'searchKey')}
             />
           </div>
 
           <div>
             <span>展览地址:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 100 }}
               value={fromData.addrType}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, addrType: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, addrType: e })}
               options={A2Selct_1}
             />
           </div>
@@ -149,12 +137,10 @@ function A2exhibition() {
           <div>
             <span>展览时间:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 100 }}
               value={fromData.type}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, type: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, type: e })}
               options={A2Selct_2}
             />
           </div>
@@ -162,22 +148,17 @@ function A2exhibition() {
           <div>
             <span>状态:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 100 }}
               value={fromData.display}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, display: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, display: e })}
               options={A1Selct}
             />
           </div>
         </div>
 
         <div>
-          <Button
-            type="primary"
-            onClick={() => setEditInfo({ id: -1, txt: "新增" })}
-          >
+          <Button type='primary' onClick={() => setEditInfo({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
@@ -186,7 +167,7 @@ function A2exhibition() {
       </div>
 
       {/* 表格主体 */}
-      <div className="A2tableBox">
+      <div className='A2tableBox'>
         <MyTable
           yHeight={625}
           list={tableInfo.list}
@@ -195,9 +176,7 @@ function A2exhibition() {
           pageNum={fromData.pageNum}
           pageSize={fromData.pageSize}
           total={tableInfo.total}
-          onChange={(pageNum, pageSize) =>
-            setFromData({ ...fromData, pageNum, pageSize })
-          }
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
         />
       </div>
 
@@ -205,15 +184,15 @@ function A2exhibition() {
       {editInfo.id ? (
         <A2add
           editInfo={editInfo}
-          closeFu={() => setEditInfo({ id: 0, txt: "" })}
+          closeFu={() => setEditInfo({ id: 0, txt: '' })}
           editTableFu={() => getListFu()}
           addTableFu={() => resetSelectFu()}
         />
       ) : null}
     </div>
-  );
+  )
 }
 
-const MemoA2exhibition = React.memo(A2exhibition);
+const MemoA2exhibition = React.memo(A2exhibition)
 
-export default MemoA2exhibition;
+export default MemoA2exhibition

+ 132 - 161
src/pages/A3holding/A3add/index.tsx

@@ -1,352 +1,323 @@
-import React, { useCallback, useEffect, useRef, useState } from "react";
-import styles from "./index.module.scss";
-import { A1EditInfoType } from "@/pages/A1event/data";
-import {
-  Button,
-  DatePicker,
-  Form,
-  FormInstance,
-  Input,
-  InputNumber,
-  Select,
-} from "antd";
-import { A3_APIgetInfo, A3_APIsave } from "@/store/action/A3holding";
-import dayjs from "dayjs";
-import { MessageFu } from "@/utils/message";
-import classNames from "classnames";
-import ZupAudio from "@/components/ZupAudio";
-import ZRichTexts from "@/components/ZRichTexts";
-import ZupTypes from "@/components/ZupTypes";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import TextArea from "antd/es/input/TextArea";
-import { A3Selct_1 } from "../data";
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A1EditInfoType } from '@/pages/A1event/data'
+import { Button, DatePicker, Form, FormInstance, Input, InputNumber, Select } from 'antd'
+import { A3_APIgetInfo, A3_APIsave } from '@/store/action/A3holding'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import classNames from 'classnames'
+import ZupAudio from '@/components/ZupAudio'
+import ZRichTexts from '@/components/ZRichTexts'
+import ZupTypes from '@/components/ZupTypes'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import TextArea from 'antd/es/input/TextArea'
+import { A3Selct_1 } from '../data'
 
 type Props = {
-  editInfo: A1EditInfoType;
-  selectAgeArr: { value: number | string; label: string }[];
-  closeFu: () => void;
-  editTableFu: () => void;
-  addTableFu: () => void;
-};
-
-function A3add({
-  editInfo,
-  selectAgeArr,
-  closeFu,
-  editTableFu,
-  addTableFu,
-}: Props) {
-  const [dirCode, setDirCode] = useState("");
+  editInfo: A1EditInfoType
+  selectAgeArr: { value: number | string; label: string }[]
+  closeFu: () => void
+  editTableFu: () => void
+  addTableFu: () => void
+}
+
+function A3add({ editInfo, selectAgeArr, closeFu, editTableFu, addTableFu }: Props) {
+  const [dirCode, setDirCode] = useState('')
 
   // 表单的ref
-  const FormBoxRef = useRef<FormInstance>(null);
+  const FormBoxRef = useRef<FormInstance>(null)
 
   // 富文本的ref
-  const ZRichTextRef = useRef<any>(null);
+  const ZRichTextRef = useRef<any>(null)
 
   // 标题的音频
   const [nameAudio, setNameAudio] = useState({
-    fileName: "",
-    filePath: "",
-  });
+    fileName: '',
+    filePath: ''
+  })
   // 多个图片的ref
-  const ZupFilesRef2 = useRef<any>(null);
+  const ZupFilesRef2 = useRef<any>(null)
 
   // 编辑/查看 进入页面 获取信息
   const getInfoFu = useCallback(async (id: number) => {
-    const res = await A3_APIgetInfo(id);
+    const res = await A3_APIgetInfo(id)
     if (res.code === 0) {
-      const data = res.data;
+      const data = res.data
 
-      setDirCode(data.dirCode);
+      setDirCode(data.dirCode)
 
       // 展示图片
       ZupFilesRef2.current?.setFileComFileFu({
-        type: "img",
-        fileList: data.files || [],
-      });
+        type: 'img',
+        fileList: data.files || []
+      })
 
       // 设置标题的 音频
       if (data.fileName && data.filePath) {
         setNameAudio({
           fileName: data.fileName,
-          filePath: data.filePath,
-        });
+          filePath: data.filePath
+        })
       }
       // 设置富文本
-      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf));
+      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf))
 
       const obj = {
         ...data,
-        myTime: dayjs(data.datePublish),
-      };
+        myTime: dayjs(data.datePublish)
+      }
 
-      FormBoxRef.current?.setFieldsValue(obj);
+      FormBoxRef.current?.setFieldsValue(obj)
     }
-  }, []);
+  }, [])
 
   // 附件 是否 已经点击过确定
-  const [fileCheck, setFileCheck] = useState(false);
+  const [fileCheck, setFileCheck] = useState(false)
 
   // 没有通过校验
   const onFinishFailed = useCallback(() => {
-    setFileCheck(true);
-  }, []);
+    setFileCheck(true)
+  }, [])
 
   //  通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
-      setFileCheck(true);
+      setFileCheck(true)
 
       // 图片的校验
-      const { sonFileIds: fileIds, coverUrl } =
-        ZupFilesRef2.current?.fileComFileResFu();
+      const { sonFileIds: fileIds, coverUrl } = ZupFilesRef2.current?.fileComFileResFu()
 
       if (fileIds.length <= 0) {
-        return MessageFu.warning("请最少上传一张图片!");
+        return MessageFu.warning('请最少上传一张图片!')
       }
 
       // 富文本校验不通过
-      const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true };
+      const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
 
-      if (rtf.flag) return MessageFu.warning("请输入完整正文!");
+      if (rtf.flag) return MessageFu.warning('请输入完整正文!')
 
       // 发布日期
-      const datePublish = dayjs(values.myTime).format("YYYY-MM-DD");
+      const datePublish = dayjs(values.myTime).format('YYYY-MM-DD')
 
       const obj = {
         ...values,
         id: editInfo.id > 0 ? editInfo.id : null,
         datePublish,
         thumb: coverUrl,
-        rtf: JSON.stringify(rtf.val || ""),
+        rtf: JSON.stringify(rtf.val || ''),
         fileName: nameAudio.fileName,
         filePath: nameAudio.filePath,
-        fileIds: fileIds.join(","),
-        dirCode,
-      };
-      const res = await A3_APIsave(obj);
+        fileIds: fileIds.join(','),
+        dirCode
+      }
+      const res = await A3_APIsave(obj)
 
       if (res.code === 0) {
-        MessageFu.success(`${editInfo.txt}成功!`);
-        editInfo.id > 0 ? editTableFu() : addTableFu();
-        closeFu();
+        MessageFu.success(`${editInfo.txt}成功!`)
+        editInfo.id > 0 ? editTableFu() : addTableFu()
+        closeFu()
       }
     },
     [addTableFu, closeFu, dirCode, editInfo, editTableFu, nameAudio]
-  );
+  )
 
   useEffect(() => {
     if (editInfo.id > 0) {
-      getInfoFu(editInfo.id);
+      getInfoFu(editInfo.id)
     } else {
-      setDirCode(Date.now() + "");
+      setDirCode(Date.now() + '')
       FormBoxRef.current?.setFieldsValue({
         myTime: dayjs(Date.now()),
         sort: 999,
-        display: 1,
-      });
+        display: 1
+      })
     }
-  }, [editInfo.id, getInfoFu]);
+  }, [editInfo.id, getInfoFu])
 
   return (
     <div className={styles.A3add}>
-      <div
-        className={classNames(
-          "A3eMain",
-          editInfo.txt === "查看" ? "A3eMainLook" : ""
-        )}
-      >
+      <div className={classNames('A3eMain', editInfo.txt === '查看' ? 'A3eMainLook' : '')}>
         <Form
           ref={FormBoxRef}
-          name="basic"
+          name='basic'
           labelCol={{ span: 3 }}
           onFinish={onFinish}
           onFinishFailed={onFinishFailed}
-          autoComplete="off"
+          autoComplete='off'
           scrollToFirstError
         >
-          <div className="A3fromRow">
+          <div className='A3fromRow'>
             <Form.Item
-              label="名称"
-              name="name"
-              rules={[{ required: true, message: "请输入名称!" }]}
+              label='名称'
+              name='name'
+              rules={[{ required: true, message: '请输入名称!' }]}
               // getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
             >
               <TextArea
-                readOnly={editInfo.txt === "查看"}
-                style={{ width: "500px" }}
-                maxLength={100}
+                readOnly={editInfo.txt === '查看'}
+                style={{ width: '500px' }}
+                maxLength={200}
                 showCount
-                placeholder="请输入内容"
+                placeholder='请输入内容'
               />
             </Form.Item>
             {/* 标题的无障碍音频 */}
-            <div className="A3_1Frow">
+            <div className='A3_1Frow'>
               <ZupAudio
                 fileInfo={nameAudio}
-                upDataFu={(info) => setNameAudio(info)}
-                delFu={() => setNameAudio({ fileName: "", filePath: "" })}
+                upDataFu={info => setNameAudio(info)}
+                delFu={() => setNameAudio({ fileName: '', filePath: '' })}
                 dirCode={dirCode}
-                myUrl="cms/collection/upload"
-                isLook={editInfo.txt === "查看"}
+                myUrl='cms/collection/upload'
+                isLook={editInfo.txt === '查看'}
               />
             </div>
           </div>
 
           {/* 图片 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               图片:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZupTypes
                 ref={ZupFilesRef2}
-                selecFlag="图片"
+                selecFlag='图片'
                 fileCheck={fileCheck}
                 dirCode={dirCode}
-                myUrl="cms/collection/upload"
-                isLook={editInfo.txt === "查看"}
+                myUrl='cms/collection/upload'
+                isLook={editInfo.txt === '查看'}
                 imgLength={50}
                 isTypeShow={true}
-                lastImgTxt="第一张将作为封面"
+                lastImgTxt='第一张将作为封面'
                 oneIsCover={true}
               />
             </div>
           </div>
 
-          <Form.Item
-            label="类别"
-            name="type"
-            rules={[{ required: true, message: "请选择类别!" }]}
-          >
+          <Form.Item label='类别' name='type' rules={[{ required: true, message: '请选择类别!' }]}>
             <Select
-              placeholder="请选择类别"
+              placeholder='请选择类别'
               style={{ width: 200 }}
-              options={A3Selct_1.filter((v) => v.label !== "全部")}
+              options={A3Selct_1.filter(v => v.label !== '全部')}
             />
           </Form.Item>
 
           <Form.Item
-            label="年代"
-            name="dictAgeId"
-            rules={[{ required: true, message: "请选择年代!" }]}
+            label='年代'
+            name='dictAgeId'
+            rules={[{ required: true, message: '请选择年代!' }]}
           >
             <Select
-              placeholder="请选择年代"
+              placeholder='请选择年代'
               style={{ width: 200 }}
-              options={selectAgeArr.filter((v) => v.label !== "全部")}
+              options={selectAgeArr.filter(v => v.label !== '全部')}
             />
           </Form.Item>
 
-          <Form.Item label="作者" name="author">
+          <Form.Item label='作者' name='author'>
             <Input
-              readOnly={editInfo.txt === "查看"}
+              readOnly={editInfo.txt === '查看'}
               maxLength={100}
               showCount
-              placeholder="请输入内容"
+              placeholder='请输入内容'
             />
           </Form.Item>
 
-          <Form.Item label="尺寸" name="size">
+          <Form.Item label='尺寸' name='size'>
             <Input
-              readOnly={editInfo.txt === "查看"}
+              readOnly={editInfo.txt === '查看'}
               maxLength={100}
               showCount
-              placeholder="请输入内容"
+              placeholder='请输入内容'
             />
           </Form.Item>
 
-          <Form.Item label="摘要" name="digest">
+          <Form.Item label='摘要' name='digest'>
             <TextArea
-              readOnly={editInfo.txt === "查看"}
-              placeholder="请输入内容"
+              readOnly={editInfo.txt === '查看'}
+              placeholder='请输入内容'
               maxLength={500}
               showCount
             />
           </Form.Item>
 
           {/* 简介 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               简介:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZRichTexts
                 check={fileCheck}
                 dirCode={dirCode}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 ref={ZRichTextRef}
-                myUrl="cms/collection/upload"
+                myUrl='cms/collection/upload'
                 isOne={true}
               />
             </div>
           </div>
 
           <Form.Item
-            label="发布日期"
-            name="myTime"
-            rules={[{ required: true, message: "请选择发布日期!" }]}
+            label='发布日期'
+            name='myTime'
+            rules={[{ required: true, message: '请选择发布日期!' }]}
           >
             <DatePicker />
           </Form.Item>
 
-          <div className="A3fromRow">
+          <div className='A3fromRow'>
             <Form.Item
-              label="排序值"
-              name="sort"
-              rules={[{ required: true, message: "请输入排序值!" }]}
+              label='排序值'
+              name='sort'
+              rules={[{ required: true, message: '请输入排序值!' }]}
             >
-              <InputNumber
-                min={1}
-                max={999}
-                precision={0}
-                placeholder="请输入"
-              />
+              <InputNumber min={1} max={999} precision={0} placeholder='请输入' />
             </Form.Item>
-            <div className="A3_6Frow" hidden={editInfo.txt === "查看"}>
+            <div className='A3_6Frow' hidden={editInfo.txt === '查看'}>
               请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
             </div>
           </div>
 
           <Form.Item
-            label="状态"
-            name="display"
-            rules={[{ required: true, message: "请选择状态!" }]}
+            label='状态'
+            name='display'
+            rules={[{ required: true, message: '请选择状态!' }]}
           >
             <Select
-              placeholder="请选择状态"
+              placeholder='请选择状态'
               style={{ width: 149 }}
               options={[
-                { value: 1, label: "发布" },
-                { value: 0, label: "不发布" },
+                { value: 1, label: '发布' },
+                { value: 0, label: '不发布' }
               ]}
             />
           </Form.Item>
 
           {/* 确定和取消按钮 */}
-          <Form.Item className="A3Ebtn">
-            {editInfo.txt === "查看" ? (
+          <Form.Item className='A3Ebtn'>
+            {editInfo.txt === '查看' ? (
               <Button onClick={closeFu}>返回</Button>
             ) : (
               <>
-                <Button type="primary" htmlType="submit">
+                <Button type='primary' htmlType='submit'>
                   提交
                 </Button>
                 <br />
                 <br />
-                <MyPopconfirm txtK="取消" onConfirm={closeFu} />
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
               </>
             )}
           </Form.Item>
         </Form>
       </div>
     </div>
-  );
+  )
 }
 
-const MemoA3add = React.memo(A3add);
+const MemoA3add = React.memo(A3add)
 
-export default MemoA3add;
+export default MemoA3add

+ 82 - 106
src/pages/A3holding/index.tsx

@@ -1,162 +1,147 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import { useDispatch, useSelector } from "react-redux";
-import { A3FromDataType, A3Selct_1 } from "./data";
-import { A3_APIdel, A3_APIgetList } from "@/store/action/A3holding";
-import { RootState } from "@/store";
-import { MessageFu } from "@/utils/message";
-import { A3tableType } from "@/types";
-import { Button, Input, Select } from "antd";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import { A1EditInfoType, A1Selct } from "../A1event/data";
-import MyTable from "@/components/MyTable";
-import { A3tableC } from "@/utils/tableData";
-import { A8_APIgetList } from "@/store/action/A8dict";
-import A3add from "./A3add";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A3FromDataType, A3Selct_1 } from './data'
+import { A3_APIdel, A3_APIgetList } from '@/store/action/A3holding'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { A3tableType } from '@/types'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A1EditInfoType, A1Selct } from '../A1event/data'
+import MyTable from '@/components/MyTable'
+import { A3tableC } from '@/utils/tableData'
+import { A8_APIgetList } from '@/store/action/A8dict'
+import A3add from './A3add'
 function A3holding() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   const [fromData, setFromData] = useState<A3FromDataType>({
     pageNum: 1,
     pageSize: 10,
-    searchKey: "",
-    type: "",
-    dictAgeId: "",
-    display: "",
-  });
+    searchKey: '',
+    type: '',
+    dictAgeId: '',
+    display: ''
+  })
   const getListFu = useCallback(() => {
-    dispatch(A3_APIgetList(fromData));
-  }, [dispatch, fromData]);
+    dispatch(A3_APIgetList(fromData))
+  }, [dispatch, fromData])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu]);
+    getListFu()
+  }, [getListFu])
 
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
 
   // 标题的输入
-  const timeRef = useRef(-1);
+  const timeRef = useRef(-1)
   const fromKeyChangeFu = useCallback(
-    (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey") => {
-      clearTimeout(timeRef.current);
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey') => {
+      clearTimeout(timeRef.current)
       timeRef.current = window.setTimeout(() => {
-        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 });
-      }, 500);
+        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 })
+      }, 500)
     },
     [fromData]
-  );
+  )
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setInputKey(Date.now());
+    setInputKey(Date.now())
     setFromData({
       pageNum: 1,
       pageSize: 10,
-      searchKey: "",
-      type: "",
-      dictAgeId: "",
-      display: "",
-    });
-  }, []);
+      searchKey: '',
+      type: '',
+      dictAgeId: '',
+      display: ''
+    })
+  }, [])
 
-  const tableInfo = useSelector(
-    (state: RootState) => state.A3holding.tableInfo
-  );
+  const tableInfo = useSelector((state: RootState) => state.A3holding.tableInfo)
 
   const delTableFu = useCallback(
     async (id: number) => {
-      const res = await A3_APIdel(id);
+      const res = await A3_APIdel(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
-        title: "操作",
+        title: '操作',
         render: (item: A3tableType) => (
           <>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "查看" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '查看' })}
             >
               查看
             </Button>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "编辑" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '编辑' })}
             >
               编辑
             </Button>
-            <MyPopconfirm txtK="删除" onConfirm={() => delTableFu(item.id)} />
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
           </>
-        ),
-      },
-    ];
-  }, [delTableFu]);
+        )
+      }
+    ]
+  }, [delTableFu])
 
   //查看、新增、编辑
   const [editInfo, setEditInfo] = useState<A1EditInfoType>({
     id: 0,
-    txt: "",
-  });
+    txt: ''
+  })
 
   useEffect(() => {
-    dispatch(A8_APIgetList());
-  }, [dispatch]);
+    dispatch(A8_APIgetList())
+  }, [dispatch])
 
-  const A8tableList = useSelector((state: RootState) => state.A8dict.list);
+  const A8tableList = useSelector((state: RootState) => state.A8dict.list)
 
   const selectAgeArr = useMemo(() => {
-    return [
-      { value: "", label: "全部" },
-      ...A8tableList.map((v) => ({ value: v.id, label: v.name })),
-    ];
-  }, [A8tableList]);
+    return [{ value: '', label: '全部' }, ...A8tableList.map(v => ({ value: v.id, label: v.name }))]
+  }, [A8tableList])
 
   return (
     <div className={styles.A3holding}>
-      <div className="pageTitle">
-        馆藏管理{editInfo.id ? ` - ${editInfo.txt}` : ""}
-      </div>
+      <div className='pageTitle'>馆藏管理{editInfo.id ? ` - ${editInfo.txt}` : ''}</div>
 
       {/* 顶部筛选 */}
-      <div className="A3top">
-        <div className="A3topLeft">
+      <div className='A3top'>
+        <div className='A3topLeft'>
           <div>
             <span>名称:</span>
             <Input
               key={inputKey}
-              maxLength={100}
+              maxLength={200}
               showCount
               style={{ width: 300 }}
-              placeholder="请输入关键字"
+              placeholder='请输入关键字'
               allowClear
-              onChange={(e) => fromKeyChangeFu(e, "searchKey")}
+              onChange={e => fromKeyChangeFu(e, 'searchKey')}
             />
           </div>
 
           <div>
             <span>类别:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 200 }}
               value={fromData.type}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, type: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, type: e })}
               options={A3Selct_1}
             />
           </div>
@@ -164,12 +149,10 @@ function A3holding() {
           <div>
             <span>年代:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 200 }}
               value={fromData.dictAgeId}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, dictAgeId: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, dictAgeId: e })}
               options={selectAgeArr}
             />
           </div>
@@ -177,22 +160,17 @@ function A3holding() {
           <div>
             <span>状态:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 100 }}
               value={fromData.display}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, display: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, display: e })}
               options={A1Selct}
             />
           </div>
         </div>
 
         <div>
-          <Button
-            type="primary"
-            onClick={() => setEditInfo({ id: -1, txt: "新增" })}
-          >
+          <Button type='primary' onClick={() => setEditInfo({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
@@ -201,7 +179,7 @@ function A3holding() {
       </div>
 
       {/* 表格主体 */}
-      <div className="A3tableBox">
+      <div className='A3tableBox'>
         <MyTable
           yHeight={625}
           list={tableInfo.list}
@@ -210,9 +188,7 @@ function A3holding() {
           pageNum={fromData.pageNum}
           pageSize={fromData.pageSize}
           total={tableInfo.total}
-          onChange={(pageNum, pageSize) =>
-            setFromData({ ...fromData, pageNum, pageSize })
-          }
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
         />
       </div>
 
@@ -221,15 +197,15 @@ function A3holding() {
         <A3add
           editInfo={editInfo}
           selectAgeArr={selectAgeArr}
-          closeFu={() => setEditInfo({ id: 0, txt: "" })}
+          closeFu={() => setEditInfo({ id: 0, txt: '' })}
           editTableFu={() => getListFu()}
           addTableFu={() => resetSelectFu()}
         />
       ) : null}
     </div>
-  );
+  )
 }
 
-const MemoA3holding = React.memo(A3holding);
+const MemoA3holding = React.memo(A3holding)
 
-export default MemoA3holding;
+export default MemoA3holding

+ 123 - 157
src/pages/A4study/A4add/index.tsx

@@ -1,273 +1,244 @@
-import React, { useCallback, useEffect, useRef, useState } from "react";
-import styles from "./index.module.scss";
-import { A1EditInfoType } from "@/pages/A1event/data";
-import {
-  Button,
-  DatePicker,
-  Form,
-  FormInstance,
-  InputNumber,
-  Select,
-} from "antd";
-import dayjs from "dayjs";
-import { MessageFu } from "@/utils/message";
-import classNames from "classnames";
-import ZupOne from "@/components/ZupOne";
-import TextArea from "antd/es/input/TextArea";
-import ZRichTexts from "@/components/ZRichTexts";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import { A4Selct_1 } from "../data";
-import { A4_APIgetInfo, A4_APIsave } from "@/store/action/A4study";
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A1EditInfoType } from '@/pages/A1event/data'
+import { Button, DatePicker, Form, FormInstance, InputNumber, Select } from 'antd'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import classNames from 'classnames'
+import ZupOne from '@/components/ZupOne'
+import TextArea from 'antd/es/input/TextArea'
+import ZRichTexts from '@/components/ZRichTexts'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A4Selct_1 } from '../data'
+import { A4_APIgetInfo, A4_APIsave } from '@/store/action/A4study'
 
 type Props = {
-  editInfo: A1EditInfoType;
-  closeFu: () => void;
-  editTableFu: () => void;
-  addTableFu: () => void;
-};
+  editInfo: A1EditInfoType
+  closeFu: () => void
+  editTableFu: () => void
+  addTableFu: () => void
+}
 
 function A4add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
-  const [dirCode, setDirCode] = useState("");
+  const [dirCode, setDirCode] = useState('')
 
   // 表单的ref
-  const FormBoxRef = useRef<FormInstance>(null);
+  const FormBoxRef = useRef<FormInstance>(null)
 
   // 封面图的ref
-  const ZupThumbRef = useRef<any>(null);
+  const ZupThumbRef = useRef<any>(null)
 
   // 富文本的ref
-  const ZRichTextRef = useRef<any>(null);
+  const ZRichTextRef = useRef<any>(null)
 
   // 编辑/查看 进入页面 获取信息
   const getInfoFu = useCallback(async (id: number) => {
-    const res = await A4_APIgetInfo(id);
+    const res = await A4_APIgetInfo(id)
     if (res.code === 0) {
-      const data = res.data;
+      const data = res.data
 
-      setDirCode(data.dirCode);
+      setDirCode(data.dirCode)
 
       // 设置富文本
-      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf));
+      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf))
 
       const obj = {
         ...data,
         myTime: dayjs(data.datePublish),
-        myTimeSta: dayjs(data.dateStart),
-      };
+        myTimeSta: dayjs(data.dateStart)
+      }
 
       if (data.dateEnd) {
-        obj.myTimeEnd = dayjs(data.dateEnd);
+        obj.myTimeEnd = dayjs(data.dateEnd)
       }
 
-      FormBoxRef.current?.setFieldsValue(obj);
+      FormBoxRef.current?.setFieldsValue(obj)
 
       // 设置封面图
       ZupThumbRef.current?.setFileComFileFu({
-        fileName: "",
-        filePath: data.thumb,
-      });
+        fileName: '',
+        filePath: data.thumb
+      })
     }
-  }, []);
+  }, [])
 
   // 附件 是否 已经点击过确定
-  const [fileCheck, setFileCheck] = useState(false);
+  const [fileCheck, setFileCheck] = useState(false)
 
   // 没有通过校验
   const onFinishFailed = useCallback(() => {
-    setFileCheck(true);
-  }, []);
+    setFileCheck(true)
+  }, [])
 
   //  通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
-      setFileCheck(true);
+      setFileCheck(true)
 
-      const coverUrl1 = ZupThumbRef.current?.fileComFileResFu();
+      const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
       // 没有传 封面图
-      if (!coverUrl1.filePath) return MessageFu.warning("请上传封面图!");
+      if (!coverUrl1.filePath) return MessageFu.warning('请上传封面图!')
 
       // 发布日期
-      const datePublish = dayjs(values.myTime).format("YYYY-MM-DD");
+      const datePublish = dayjs(values.myTime).format('YYYY-MM-DD')
 
       // 开始时间
-      const dateStart = dayjs(values.myTimeSta).format("YYYY-MM-DD HH:mm");
+      const dateStart = dayjs(values.myTimeSta).format('YYYY-MM-DD HH:mm')
 
       // 结束时间(可能为空)
-      let dateEnd = "";
-      if (values.myTimeEnd)
-        dateEnd = dayjs(values.myTimeEnd).format("YYYY-MM-DD HH:mm");
+      let dateEnd = ''
+      if (values.myTimeEnd) dateEnd = dayjs(values.myTimeEnd).format('YYYY-MM-DD HH:mm')
 
       // 富文本校验不通过
-      const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true };
+      const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
 
-      if (rtf.flag) return MessageFu.warning("请输入完整正文!");
+      if (rtf.flag) return MessageFu.warning('请输入完整正文!')
 
       const obj = {
         ...values,
         id: editInfo.id > 0 ? editInfo.id : null,
         datePublish,
         thumb: coverUrl1.filePath,
-        rtf: JSON.stringify(rtf.val || ""),
+        rtf: JSON.stringify(rtf.val || ''),
         dirCode,
         dateStart,
-        dateEnd,
-      };
+        dateEnd
+      }
 
       // if (obj) {
       //   console.log(123, obj);
       //   return;
       // }
 
-      const res = await A4_APIsave(obj);
+      const res = await A4_APIsave(obj)
 
       if (res.code === 0) {
-        MessageFu.success(`${editInfo.txt}成功!`);
-        editInfo.id > 0 ? editTableFu() : addTableFu();
-        closeFu();
+        MessageFu.success(`${editInfo.txt}成功!`)
+        editInfo.id > 0 ? editTableFu() : addTableFu()
+        closeFu()
       }
     },
     [addTableFu, closeFu, dirCode, editInfo.id, editInfo.txt, editTableFu]
-  );
+  )
 
   useEffect(() => {
     if (editInfo.id > 0) {
-      getInfoFu(editInfo.id);
+      getInfoFu(editInfo.id)
     } else {
-      setDirCode(Date.now() + "");
+      setDirCode(Date.now() + '')
       FormBoxRef.current?.setFieldsValue({
         myTime: dayjs(Date.now()),
         sort: 999,
-        display: 1,
-      });
+        display: 1
+      })
     }
-  }, [editInfo.id, getInfoFu]);
+  }, [editInfo.id, getInfoFu])
 
   return (
     <div className={styles.A4add}>
-      <div
-        className={classNames(
-          "A4eMain",
-          editInfo.txt === "查看" ? "A4eMainLook" : ""
-        )}
-      >
+      <div className={classNames('A4eMain', editInfo.txt === '查看' ? 'A4eMainLook' : '')}>
         <Form
           ref={FormBoxRef}
-          name="basic"
+          name='basic'
           labelCol={{ span: 3 }}
           onFinish={onFinish}
           onFinishFailed={onFinishFailed}
-          autoComplete="off"
+          autoComplete='off'
           scrollToFirstError
         >
-          <Form.Item
-            label="标题"
-            name="name"
-            rules={[{ required: true, message: "请输入标题!" }]}
-          >
+          <Form.Item label='标题' name='name' rules={[{ required: true, message: '请输入标题!' }]}>
             <TextArea
-              readOnly={editInfo.txt === "查看"}
-              maxLength={100}
+              readOnly={editInfo.txt === '查看'}
+              maxLength={200}
               showCount
-              placeholder="请输入内容"
+              placeholder='请输入内容'
             />
           </Form.Item>
 
-          <Form.Item
-            label="板块"
-            name="type"
-            rules={[{ required: true, message: "请选择板块!" }]}
-          >
+          <Form.Item label='板块' name='type' rules={[{ required: true, message: '请选择板块!' }]}>
             <Select
-              placeholder="请选择板块"
+              placeholder='请选择板块'
               style={{ width: 200 }}
-              options={A4Selct_1.filter((v) => v.label !== "全部")}
+              options={A4Selct_1.filter(v => v.label !== '全部')}
             />
           </Form.Item>
 
           <Form.Item
-            label="开始时间"
-            name="myTimeSta"
-            rules={[{ required: true, message: "请选择开始时间!" }]}
+            label='开始时间'
+            name='myTimeSta'
+            rules={[{ required: true, message: '请选择开始时间!' }]}
           >
-            <DatePicker
-              showTime
-              format={"YYYY-MM-DD HH:mm"}
-              placeholder="请选择开始时间"
-            />
+            <DatePicker showTime format={'YYYY-MM-DD HH:mm'} placeholder='请选择开始时间' />
           </Form.Item>
 
-          <Form.Item label="结束时间" name="myTimeEnd">
-            <DatePicker
-              showTime
-              format={"YYYY-MM-DD HH:mm"}
-              placeholder="请选择结束时间"
-            />
+          <Form.Item label='结束时间' name='myTimeEnd'>
+            <DatePicker showTime format={'YYYY-MM-DD HH:mm'} placeholder='请选择结束时间' />
           </Form.Item>
 
           <Form.Item
-            label="地点"
-            name="address"
-            rules={[{ required: true, message: "请输入标题!" }]}
+            label='地点'
+            name='address'
+            rules={[{ required: true, message: '请输入标题!' }]}
           >
             <TextArea
-              readOnly={editInfo.txt === "查看"}
-              placeholder="请输入内容"
+              readOnly={editInfo.txt === '查看'}
+              placeholder='请输入内容'
               maxLength={100}
               showCount
             />
           </Form.Item>
 
           <Form.Item
-            label="人数限制"
-            name="remark"
-            rules={[{ required: true, message: "请输入标题!" }]}
+            label='人数限制'
+            name='remark'
+            rules={[{ required: true, message: '请输入标题!' }]}
           >
             <TextArea
-              readOnly={editInfo.txt === "查看"}
-              placeholder="请输入内容"
+              readOnly={editInfo.txt === '查看'}
+              placeholder='请输入内容'
               maxLength={100}
               showCount
             />
           </Form.Item>
 
           {/* 封面 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               封面:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZupOne
                 ref={ZupThumbRef}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 fileCheck={fileCheck}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/learn/upload"
-                format={["image/jpeg", "image/png"]}
-                formatTxt="png、jpg和jpeg"
-                checkTxt="请上传封面图!"
-                upTxt="最多1张"
-                myType="thumb"
+                myUrl='cms/learn/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面图!'
+                upTxt='最多1张'
+                myType='thumb'
               />
             </div>
           </div>
 
-          {editInfo.txt === "查看" ? <br /> : null}
+          {editInfo.txt === '查看' ? <br /> : null}
 
           {/* 正文 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               正文:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZRichTexts
                 check={fileCheck}
                 dirCode={dirCode}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 ref={ZRichTextRef}
-                myUrl="cms/learn/upload"
+                myUrl='cms/learn/upload'
                 isOne={true}
                 upAudioBtnNone={true}
               />
@@ -275,67 +246,62 @@ function A4add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
           </div>
 
           <Form.Item
-            label="发布日期"
-            name="myTime"
-            rules={[{ required: true, message: "请选择发布日期!" }]}
+            label='发布日期'
+            name='myTime'
+            rules={[{ required: true, message: '请选择发布日期!' }]}
           >
             <DatePicker />
           </Form.Item>
 
-          <div className="A4fromRow">
+          <div className='A4fromRow'>
             <Form.Item
-              label="排序值"
-              name="sort"
-              rules={[{ required: true, message: "请输入排序值!" }]}
+              label='排序值'
+              name='sort'
+              rules={[{ required: true, message: '请输入排序值!' }]}
             >
-              <InputNumber
-                min={1}
-                max={999}
-                precision={0}
-                placeholder="请输入"
-              />
+              <InputNumber min={1} max={999} precision={0} placeholder='请输入' />
             </Form.Item>
-            <div className="A4_6Frow" hidden={editInfo.txt === "查看"}>
+            <div className='A4_6Frow' hidden={editInfo.txt === '查看'}>
               请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
             </div>
           </div>
 
           <Form.Item
-            label="状态"
-            name="display"
-            rules={[{ required: true, message: "请选择状态!" }]}
+            label='状态'
+            name='display'
+            rules={[{ required: true, message: '请选择状态!' }]}
           >
             <Select
-              placeholder="请选择状态"
+              placeholder='请选择状态'
               style={{ width: 149 }}
               options={[
-                { value: 1, label: "发布" },
-                { value: 0, label: "不发布" },
+                { value: 1, label: '发布' },
+                { value: 0, label: '不发布' }
               ]}
             />
           </Form.Item>
 
           {/* 确定和取消按钮 */}
-          <Form.Item className="A4Ebtn">
-            {editInfo.txt === "查看" ? (
+          <Form.Item className='A4Ebtn'>
+            {editInfo.txt === '查看' ? (
               <Button onClick={closeFu}>返回</Button>
             ) : (
               <>
-                <Button type="primary" htmlType="submit">
+                <Button type='primary' htmlType='submit'>
                   提交
                 </Button>
                 <br />
                 <br />
-                <MyPopconfirm txtK="取消" onConfirm={closeFu} />
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
               </>
             )}
           </Form.Item>
         </Form>
       </div>
     </div>
-  );
+  )
 }
 
-const MemoA4add = React.memo(A4add);
+const MemoA4add = React.memo(A4add)
 
-export default MemoA4add;
+export default MemoA4add

+ 72 - 89
src/pages/A4study/index.tsx

@@ -1,143 +1,133 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import { useDispatch, useSelector } from "react-redux";
-import { A4FromDataType, A4Selct_1 } from "./data";
-import { A4_APIdel, A4_APIgetList } from "@/store/action/A4study";
-import { RootState } from "@/store";
-import { MessageFu } from "@/utils/message";
-import { A4tableType } from "@/types";
-import { Button, Input, Select } from "antd";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import { A1EditInfoType, A1Selct } from "../A1event/data";
-import MyTable from "@/components/MyTable";
-import { A4tableC } from "@/utils/tableData";
-import A4add from "./A4add";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A4FromDataType, A4Selct_1 } from './data'
+import { A4_APIdel, A4_APIgetList } from '@/store/action/A4study'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { A4tableType } from '@/types'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A1EditInfoType, A1Selct } from '../A1event/data'
+import MyTable from '@/components/MyTable'
+import { A4tableC } from '@/utils/tableData'
+import A4add from './A4add'
 function A4study() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   const [fromData, setFromData] = useState<A4FromDataType>({
     pageNum: 1,
     pageSize: 10,
-    searchKey: "",
-    type: "",
-    display: "",
-  });
+    searchKey: '',
+    type: '',
+    display: ''
+  })
   const getListFu = useCallback(() => {
-    dispatch(A4_APIgetList(fromData));
-  }, [dispatch, fromData]);
+    dispatch(A4_APIgetList(fromData))
+  }, [dispatch, fromData])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu]);
+    getListFu()
+  }, [getListFu])
 
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
 
   // 标题的输入
-  const timeRef = useRef(-1);
+  const timeRef = useRef(-1)
   const fromKeyChangeFu = useCallback(
-    (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey") => {
-      clearTimeout(timeRef.current);
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey') => {
+      clearTimeout(timeRef.current)
       timeRef.current = window.setTimeout(() => {
-        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 });
-      }, 500);
+        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 })
+      }, 500)
     },
     [fromData]
-  );
+  )
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setInputKey(Date.now());
+    setInputKey(Date.now())
     setFromData({
       pageNum: 1,
       pageSize: 10,
-      searchKey: "",
-      type: "",
-      display: "",
-    });
-  }, []);
+      searchKey: '',
+      type: '',
+      display: ''
+    })
+  }, [])
 
-  const tableInfo = useSelector((state: RootState) => state.A4study.tableInfo);
+  const tableInfo = useSelector((state: RootState) => state.A4study.tableInfo)
 
   const delTableFu = useCallback(
     async (id: number) => {
-      const res = await A4_APIdel(id);
+      const res = await A4_APIdel(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
-        title: "操作",
+        title: '操作',
         render: (item: A4tableType) => (
           <>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "查看" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '查看' })}
             >
               查看
             </Button>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "编辑" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '编辑' })}
             >
               编辑
             </Button>
-            <MyPopconfirm txtK="删除" onConfirm={() => delTableFu(item.id)} />
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
           </>
-        ),
-      },
-    ];
-  }, [delTableFu]);
+        )
+      }
+    ]
+  }, [delTableFu])
 
   //查看、新增、编辑
   const [editInfo, setEditInfo] = useState<A1EditInfoType>({
     id: 0,
-    txt: "",
-  });
+    txt: ''
+  })
 
   return (
     <div className={styles.A4study}>
-      <div className="pageTitle">
-        学习参与管理{editInfo.id ? ` - ${editInfo.txt}` : ""}
-      </div>
+      <div className='pageTitle'>学习参与管理{editInfo.id ? ` - ${editInfo.txt}` : ''}</div>
       {/* 顶部筛选 */}
-      <div className="A4top">
-        <div className="A4topLeft">
+      <div className='A4top'>
+        <div className='A4topLeft'>
           <div>
             <span>标题:</span>
             <Input
               key={inputKey}
-              maxLength={100}
+              maxLength={200}
               showCount
               style={{ width: 300 }}
-              placeholder="请输入关键字"
+              placeholder='请输入关键字'
               allowClear
-              onChange={(e) => fromKeyChangeFu(e, "searchKey")}
+              onChange={e => fromKeyChangeFu(e, 'searchKey')}
             />
           </div>
 
           <div>
             <span>板块:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 200 }}
               value={fromData.type}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, type: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, type: e })}
               options={A4Selct_1}
             />
           </div>
@@ -145,22 +135,17 @@ function A4study() {
           <div>
             <span>状态:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 100 }}
               value={fromData.display}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, display: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, display: e })}
               options={A1Selct}
             />
           </div>
         </div>
 
         <div>
-          <Button
-            type="primary"
-            onClick={() => setEditInfo({ id: -1, txt: "新增" })}
-          >
+          <Button type='primary' onClick={() => setEditInfo({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
@@ -169,7 +154,7 @@ function A4study() {
       </div>
 
       {/* 表格主体 */}
-      <div className="A4tableBox">
+      <div className='A4tableBox'>
         <MyTable
           yHeight={625}
           list={tableInfo.list}
@@ -178,9 +163,7 @@ function A4study() {
           pageNum={fromData.pageNum}
           pageSize={fromData.pageSize}
           total={tableInfo.total}
-          onChange={(pageNum, pageSize) =>
-            setFromData({ ...fromData, pageNum, pageSize })
-          }
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
         />
       </div>
 
@@ -188,15 +171,15 @@ function A4study() {
       {editInfo.id ? (
         <A4add
           editInfo={editInfo}
-          closeFu={() => setEditInfo({ id: 0, txt: "" })}
+          closeFu={() => setEditInfo({ id: 0, txt: '' })}
           editTableFu={() => getListFu()}
           addTableFu={() => resetSelectFu()}
         />
       ) : null}
     </div>
-  );
+  )
 }
 
-const MemoA4study = React.memo(A4study);
+const MemoA4study = React.memo(A4study)
 
-export default MemoA4study;
+export default MemoA4study

+ 137 - 172
src/pages/A5publish/A5add/index.tsx

@@ -1,115 +1,108 @@
-import React, { useCallback, useEffect, useRef, useState } from "react";
-import styles from "./index.module.scss";
-import { A1EditInfoType } from "@/pages/A1event/data";
-import { A5topType } from "../data";
-import {
-  Button,
-  DatePicker,
-  Form,
-  FormInstance,
-  InputNumber,
-  Select,
-} from "antd";
-import { A5_APIgetInfo, A5_APIsave } from "@/store/action/A5publish";
-import dayjs from "dayjs";
-import { MessageFu } from "@/utils/message";
-import classNames from "classnames";
-import ZupOne from "@/components/ZupOne";
-import ZRichTexts from "@/components/ZRichTexts";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import TextArea from "antd/es/input/TextArea";
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A1EditInfoType } from '@/pages/A1event/data'
+import { A5topType } from '../data'
+import { Button, DatePicker, Form, FormInstance, InputNumber, Select } from 'antd'
+import { A5_APIgetInfo, A5_APIsave } from '@/store/action/A5publish'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import classNames from 'classnames'
+import ZupOne from '@/components/ZupOne'
+import ZRichTexts from '@/components/ZRichTexts'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import TextArea from 'antd/es/input/TextArea'
 
 type Props = {
-  topType: A5topType;
-  editInfo: A1EditInfoType;
-  closeFu: () => void;
-  editTableFu: () => void;
-  addTableFu: () => void;
-};
+  topType: A5topType
+  editInfo: A1EditInfoType
+  closeFu: () => void
+  editTableFu: () => void
+  addTableFu: () => void
+}
 
 function A5add({ editInfo, topType, closeFu, editTableFu, addTableFu }: Props) {
-  const [dirCode, setDirCode] = useState("");
+  const [dirCode, setDirCode] = useState('')
 
   // 表单的ref
-  const FormBoxRef = useRef<FormInstance>(null);
+  const FormBoxRef = useRef<FormInstance>(null)
 
   // 封面图的ref
-  const ZupThumbRef = useRef<any>(null);
+  const ZupThumbRef = useRef<any>(null)
 
   // 富文本的ref
-  const ZRichTextRef = useRef<any>(null);
+  const ZRichTextRef = useRef<any>(null)
 
   // pdf的ref
-  const ZupPdfRef = useRef<any>(null);
+  const ZupPdfRef = useRef<any>(null)
 
   // 编辑/查看 进入页面 获取信息
   const getInfoFu = useCallback(async (id: number) => {
-    const res = await A5_APIgetInfo(id);
+    const res = await A5_APIgetInfo(id)
     if (res.code === 0) {
-      const data = res.data;
+      const data = res.data
 
-      setDirCode(data.dirCode);
+      setDirCode(data.dirCode)
 
       // 设置富文本
-      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf));
+      ZRichTextRef.current?.ritxtShowFu(JSON.parse(data.rtf))
 
       const obj = {
         ...data,
-        myTime: dayjs(data.datePublish),
-      };
+        myTime: dayjs(data.datePublish)
+      }
 
-      FormBoxRef.current?.setFieldsValue(obj);
+      FormBoxRef.current?.setFieldsValue(obj)
 
       // 设置封面图
       ZupThumbRef.current?.setFileComFileFu({
-        fileName: "",
-        filePath: data.thumb,
-      });
+        fileName: '',
+        filePath: data.thumb
+      })
 
       // 设置Pdf
       ZupPdfRef.current?.setFileComFileFu({
         fileName: data.fileName,
-        filePath: data.filePath,
-      });
+        filePath: data.filePath
+      })
     }
-  }, []);
+  }, [])
 
   // 附件 是否 已经点击过确定
-  const [fileCheck, setFileCheck] = useState(false);
+  const [fileCheck, setFileCheck] = useState(false)
 
   // 没有通过校验
   const onFinishFailed = useCallback(() => {
-    setFileCheck(true);
-  }, []);
+    setFileCheck(true)
+  }, [])
 
   //  通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
-      setFileCheck(true);
+      setFileCheck(true)
 
-      const coverUrl1 = ZupThumbRef.current?.fileComFileResFu();
+      const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
       // 没有传 封面图
-      if (!coverUrl1.filePath) return MessageFu.warning("请上传封面图!");
+      if (!coverUrl1.filePath) return MessageFu.warning('请上传封面图!')
 
       // 发布日期
-      const datePublish = dayjs(values.myTime).format("YYYY-MM-DD");
+      const datePublish = dayjs(values.myTime).format('YYYY-MM-DD')
 
-      let rtf = { flag: true, val: "" };
+      let rtf = { flag: true, val: '' }
 
-      let fileName = "";
-      let filePath = "";
+      let fileName = ''
+      let filePath = ''
 
-      if (topType === "Magazines") {
+      if (topType === 'Magazines') {
         // 有富文本---富文本校验不通过
-        rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true };
+        rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
 
-        if (rtf.flag) return MessageFu.warning("请输入完整正文!");
+        if (rtf.flag) return MessageFu.warning('请输入完整正文!')
       } else {
         // 有pdf附件
-        const ZupPdfRefObj = ZupPdfRef.current?.fileComFileResFu();
-        fileName = ZupPdfRefObj.fileName;
-        filePath = ZupPdfRefObj.filePath;
-        if (!filePath) return MessageFu.warning("请上传pdf附件!");
+        const ZupPdfRefObj = ZupPdfRef.current?.fileComFileResFu()
+        fileName = ZupPdfRefObj.fileName
+        filePath = ZupPdfRefObj.filePath
+        if (!filePath) return MessageFu.warning('请上传pdf附件!')
       }
 
       const obj = {
@@ -117,238 +110,210 @@ function A5add({ editInfo, topType, closeFu, editTableFu, addTableFu }: Props) {
         id: editInfo.id > 0 ? editInfo.id : null,
         datePublish,
         thumb: coverUrl1.filePath,
-        rtf: topType === "Exhibition" ? null : JSON.stringify(rtf.val || ""),
+        rtf: topType === 'Exhibition' ? null : JSON.stringify(rtf.val || ''),
         dirCode,
         fileName,
         filePath,
-        type: topType,
-      };
+        type: topType
+      }
 
       // if (obj) {
       //   console.log(123, obj);
       //   return;
       // }
 
-      const res = await A5_APIsave(obj);
+      const res = await A5_APIsave(obj)
 
       if (res.code === 0) {
-        MessageFu.success(`${editInfo.txt}成功!`);
-        editInfo.id > 0 ? editTableFu() : addTableFu();
-        closeFu();
+        MessageFu.success(`${editInfo.txt}成功!`)
+        editInfo.id > 0 ? editTableFu() : addTableFu()
+        closeFu()
       }
     },
-    [
-      addTableFu,
-      closeFu,
-      dirCode,
-      editInfo.id,
-      editInfo.txt,
-      editTableFu,
-      topType,
-    ]
-  );
+    [addTableFu, closeFu, dirCode, editInfo.id, editInfo.txt, editTableFu, topType]
+  )
 
   useEffect(() => {
     if (editInfo.id > 0) {
-      getInfoFu(editInfo.id);
+      getInfoFu(editInfo.id)
     } else {
-      setDirCode(Date.now() + "");
+      setDirCode(Date.now() + '')
       FormBoxRef.current?.setFieldsValue({
         myTime: dayjs(Date.now()),
         sort: 999,
         display: 1,
-        year: dayjs().get("year"),
-      });
+        year: dayjs().get('year')
+      })
     }
-  }, [editInfo.id, getInfoFu]);
+  }, [editInfo.id, getInfoFu])
 
-  const [ageSelect, setAgeSelect] = useState<
-    { value: string; label: string }[]
-  >([]);
+  const [ageSelect, setAgeSelect] = useState<{ value: string; label: string }[]>([])
 
   useEffect(() => {
-    if (topType === "Magazines") {
+    if (topType === 'Magazines') {
       // 有分份
-      const arr: { value: string; label: string }[] = [];
-      const nowYear = dayjs().get("year");
-      const num = nowYear - 2010;
+      const arr: { value: string; label: string }[] = []
+      const nowYear = dayjs().get('year')
+      const num = nowYear - 2010
       for (let i = 0; i <= num; i++) {
-        const temp = nowYear - i + "";
+        const temp = nowYear - i + ''
         arr.push({
           value: temp,
-          label: temp,
-        });
+          label: temp
+        })
       }
 
-      setAgeSelect(arr);
+      setAgeSelect(arr)
     }
-  }, [topType]);
+  }, [topType])
 
   return (
     <div className={styles.A5add}>
-      <div
-        className={classNames(
-          "A5eMain",
-          editInfo.txt === "查看" ? "A5eMainLook" : ""
-        )}
-      >
+      <div className={classNames('A5eMain', editInfo.txt === '查看' ? 'A5eMainLook' : '')}>
         <Form
           ref={FormBoxRef}
-          name="basic"
+          name='basic'
           labelCol={{ span: 3 }}
           onFinish={onFinish}
           onFinishFailed={onFinishFailed}
-          autoComplete="off"
+          autoComplete='off'
           scrollToFirstError
         >
-          <Form.Item
-            label="标题"
-            name="name"
-            rules={[{ required: true, message: "请输入标题!" }]}
-          >
+          <Form.Item label='标题' name='name' rules={[{ required: true, message: '请输入标题!' }]}>
             <TextArea
-              readOnly={editInfo.txt === "查看"}
-              maxLength={100}
+              readOnly={editInfo.txt === '查看'}
+              maxLength={200}
               showCount
-              placeholder="请输入内容"
+              placeholder='请输入内容'
             />
           </Form.Item>
 
-          {topType === "Magazines" ? (
+          {topType === 'Magazines' ? (
             <Form.Item
-              label="年份"
-              name="year"
-              rules={[{ required: true, message: "请选择年份!" }]}
+              label='年份'
+              name='year'
+              rules={[{ required: true, message: '请选择年份!' }]}
             >
-              <Select
-                placeholder="请选择年份"
-                style={{ width: 200 }}
-                options={ageSelect}
-              />
+              <Select placeholder='请选择年份' style={{ width: 200 }} options={ageSelect} />
             </Form.Item>
           ) : null}
 
           {/* 封面 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               封面:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZupOne
                 ref={ZupThumbRef}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 fileCheck={fileCheck}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/publish/upload"
-                format={["image/jpeg", "image/png"]}
-                formatTxt="png、jpg和jpeg"
-                checkTxt="请上传封面图!"
-                upTxt="最多1张"
-                myType="thumb"
+                myUrl='cms/publish/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面图!'
+                upTxt='最多1张'
+                myType='thumb'
               />
             </div>
           </div>
 
-          {editInfo.txt === "查看" ? <br /> : null}
+          {editInfo.txt === '查看' ? <br /> : null}
 
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
-              {topType === "Magazines" ? "正文" : "附件"}:
+              {topType === 'Magazines' ? '正文' : '附件'}:
             </div>
-            <div className="formRight">
-              {topType === "Magazines" ? (
+            <div className='formRight'>
+              {topType === 'Magazines' ? (
                 <ZRichTexts
                   check={fileCheck}
                   dirCode={dirCode}
-                  isLook={editInfo.txt === "查看"}
+                  isLook={editInfo.txt === '查看'}
                   ref={ZRichTextRef}
-                  myUrl="cms/publish/upload"
+                  myUrl='cms/publish/upload'
                   isOne={true}
                   upAudioBtnNone={true}
                 />
               ) : (
                 <ZupOne
                   ref={ZupPdfRef}
-                  isLook={editInfo.txt === "查看"}
+                  isLook={editInfo.txt === '查看'}
                   fileCheck={fileCheck}
                   size={10}
                   dirCode={dirCode}
-                  myUrl="cms/publish/upload"
-                  format={["application/pdf"]}
-                  formatTxt="pdf"
-                  checkTxt="请上传pdf附件!"
-                  upTxt="最多1个"
-                  myType="pdf"
+                  myUrl='cms/publish/upload'
+                  format={['application/pdf']}
+                  formatTxt='pdf'
+                  checkTxt='请上传pdf附件!'
+                  upTxt='最多1个'
+                  myType='pdf'
                 />
               )}
             </div>
           </div>
 
           <Form.Item
-            label="发布日期"
-            name="myTime"
-            rules={[{ required: true, message: "请选择发布日期!" }]}
+            label='发布日期'
+            name='myTime'
+            rules={[{ required: true, message: '请选择发布日期!' }]}
           >
             <DatePicker />
           </Form.Item>
 
-          <div className="A5fromRow">
+          <div className='A5fromRow'>
             <Form.Item
-              label="排序值"
-              name="sort"
-              rules={[{ required: true, message: "请输入排序值!" }]}
+              label='排序值'
+              name='sort'
+              rules={[{ required: true, message: '请输入排序值!' }]}
             >
-              <InputNumber
-                min={1}
-                max={999}
-                precision={0}
-                placeholder="请输入"
-              />
+              <InputNumber min={1} max={999} precision={0} placeholder='请输入' />
             </Form.Item>
-            <div className="A5_6Frow" hidden={editInfo.txt === "查看"}>
+            <div className='A5_6Frow' hidden={editInfo.txt === '查看'}>
               请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
             </div>
           </div>
 
           <Form.Item
-            label="状态"
-            name="display"
-            rules={[{ required: true, message: "请选择状态!" }]}
+            label='状态'
+            name='display'
+            rules={[{ required: true, message: '请选择状态!' }]}
           >
             <Select
-              placeholder="请选择状态"
+              placeholder='请选择状态'
               style={{ width: 149 }}
               options={[
-                { value: 1, label: "发布" },
-                { value: 0, label: "不发布" },
+                { value: 1, label: '发布' },
+                { value: 0, label: '不发布' }
               ]}
             />
           </Form.Item>
 
           {/* 确定和取消按钮 */}
-          <Form.Item className="A5Ebtn">
-            {editInfo.txt === "查看" ? (
+          <Form.Item className='A5Ebtn'>
+            {editInfo.txt === '查看' ? (
               <Button onClick={closeFu}>返回</Button>
             ) : (
               <>
-                <Button type="primary" htmlType="submit">
+                <Button type='primary' htmlType='submit'>
                   提交
                 </Button>
                 <br />
                 <br />
-                <MyPopconfirm txtK="取消" onConfirm={closeFu} />
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
               </>
             )}
           </Form.Item>
         </Form>
       </div>
     </div>
-  );
+  )
 }
 
-const MemoA5add = React.memo(A5add);
+const MemoA5add = React.memo(A5add)
 
-export default MemoA5add;
+export default MemoA5add

+ 73 - 90
src/pages/A5publish/index.tsx

@@ -1,130 +1,120 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import { useDispatch, useSelector } from "react-redux";
-import { A5_APIdel, A5_APIgetList } from "@/store/action/A5publish";
-import { RootState } from "@/store";
-import { MessageFu } from "@/utils/message";
-import { A5tableType } from "@/types";
-import { Button, Input, Select } from "antd";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import { A1EditInfoType, A1Selct } from "../A1event/data";
-import MyTable from "@/components/MyTable";
-import { A5tableCFu } from "@/utils/tableData";
-import { A5FromDataType, A5topBtnArr } from "./data";
-import A5add from "./A5add";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A5_APIdel, A5_APIgetList } from '@/store/action/A5publish'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { A5tableType } from '@/types'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A1EditInfoType, A1Selct } from '../A1event/data'
+import MyTable from '@/components/MyTable'
+import { A5tableCFu } from '@/utils/tableData'
+import { A5FromDataType, A5topBtnArr } from './data'
+import A5add from './A5add'
 function A5publish() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   const [fromData, setFromData] = useState<A5FromDataType>({
     pageNum: 1,
     pageSize: 10,
-    searchKey: "",
-    type: "Magazines",
-    display: "",
-  });
+    searchKey: '',
+    type: 'Magazines',
+    display: ''
+  })
   const getListFu = useCallback(() => {
-    dispatch(A5_APIgetList(fromData));
-  }, [dispatch, fromData]);
+    dispatch(A5_APIgetList(fromData))
+  }, [dispatch, fromData])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu]);
+    getListFu()
+  }, [getListFu])
 
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
 
   // 标题的输入
-  const timeRef = useRef(-1);
+  const timeRef = useRef(-1)
   const fromKeyChangeFu = useCallback(
-    (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey") => {
-      clearTimeout(timeRef.current);
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey') => {
+      clearTimeout(timeRef.current)
       timeRef.current = window.setTimeout(() => {
-        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 });
-      }, 500);
+        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 })
+      }, 500)
     },
     [fromData]
-  );
+  )
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setInputKey(Date.now());
+    setInputKey(Date.now())
     setFromData({
       pageNum: 1,
       pageSize: 10,
-      searchKey: "",
+      searchKey: '',
       type: fromData.type,
-      display: "",
-    });
-  }, [fromData.type]);
+      display: ''
+    })
+  }, [fromData.type])
 
-  const tableInfo = useSelector(
-    (state: RootState) => state.A5publish.tableInfo
-  );
+  const tableInfo = useSelector((state: RootState) => state.A5publish.tableInfo)
 
   const delTableFu = useCallback(
     async (id: number) => {
-      const res = await A5_APIdel(id);
+      const res = await A5_APIdel(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
-        title: "操作",
+        title: '操作',
         render: (item: A5tableType) => (
           <>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "查看" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '查看' })}
             >
               查看
             </Button>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setEditInfo({ id: item.id, txt: "编辑" })}
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '编辑' })}
             >
               编辑
             </Button>
-            <MyPopconfirm txtK="删除" onConfirm={() => delTableFu(item.id)} />
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
           </>
-        ),
-      },
-    ];
-  }, [delTableFu]);
+        )
+      }
+    ]
+  }, [delTableFu])
 
   //查看、新增、编辑
   const [editInfo, setEditInfo] = useState<A1EditInfoType>({
     id: 0,
-    txt: "",
-  });
+    txt: ''
+  })
   return (
     <div className={styles.A5publish}>
-      <div className="pageTitle">
-        出版物管理{editInfo.id ? ` - ${editInfo.txt} ${fromData.type}` : ""}
+      <div className='pageTitle'>
+        出版物管理{editInfo.id ? ` - ${editInfo.txt} ${fromData.type}` : ''}
       </div>
       {/* 顶部筛选 */}
-      <div className="A5top">
-        <div className="A5topLeft">
+      <div className='A5top'>
+        <div className='A5topLeft'>
           <div>
-            {A5topBtnArr.map((val) => (
+            {A5topBtnArr.map(val => (
               <Button
                 key={val}
-                type={val === fromData.type ? "primary" : "default"}
-                onClick={() =>
-                  setFromData({ ...fromData, type: val, pageNum: 1 })
-                }
+                type={val === fromData.type ? 'primary' : 'default'}
+                onClick={() => setFromData({ ...fromData, type: val, pageNum: 1 })}
               >
                 {val}
               </Button>
@@ -135,34 +125,29 @@ function A5publish() {
             <span>标题:</span>
             <Input
               key={inputKey}
-              maxLength={100}
+              maxLength={200}
               showCount
               style={{ width: 300 }}
-              placeholder="请输入关键字"
+              placeholder='请输入关键字'
               allowClear
-              onChange={(e) => fromKeyChangeFu(e, "searchKey")}
+              onChange={e => fromKeyChangeFu(e, 'searchKey')}
             />
           </div>
 
           <div>
             <span>状态:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               style={{ width: 100 }}
               value={fromData.display}
-              onChange={(e) =>
-                setFromData({ ...fromData, pageNum: 1, display: e })
-              }
+              onChange={e => setFromData({ ...fromData, pageNum: 1, display: e })}
               options={A1Selct}
             />
           </div>
         </div>
 
         <div>
-          <Button
-            type="primary"
-            onClick={() => setEditInfo({ id: -1, txt: "新增" })}
-          >
+          <Button type='primary' onClick={() => setEditInfo({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
@@ -171,7 +156,7 @@ function A5publish() {
       </div>
 
       {/* 表格主体 */}
-      <div className="A5tableBox">
+      <div className='A5tableBox'>
         <MyTable
           yHeight={625}
           list={tableInfo.list}
@@ -180,9 +165,7 @@ function A5publish() {
           pageNum={fromData.pageNum}
           pageSize={fromData.pageSize}
           total={tableInfo.total}
-          onChange={(pageNum, pageSize) =>
-            setFromData({ ...fromData, pageNum, pageSize })
-          }
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
         />
       </div>
 
@@ -191,15 +174,15 @@ function A5publish() {
         <A5add
           topType={fromData.type}
           editInfo={editInfo}
-          closeFu={() => setEditInfo({ id: 0, txt: "" })}
+          closeFu={() => setEditInfo({ id: 0, txt: '' })}
           editTableFu={() => getListFu()}
           addTableFu={() => resetSelectFu()}
         />
       ) : null}
     </div>
-  );
+  )
 }
 
-const MemoA5publish = React.memo(A5publish);
+const MemoA5publish = React.memo(A5publish)
 
-export default MemoA5publish;
+export default MemoA5publish

+ 47 - 51
src/utils/http.ts

@@ -1,90 +1,86 @@
-import axios from "axios";
-import history from "./history";
-import { getTokenInfo, removeTokenInfo } from "./storage";
-import store from "@/store";
-import { MessageFu } from "./message";
-import { domShowFu } from "./domShow";
+import axios from 'axios'
+import history from './history'
+import { getTokenInfo, removeTokenInfo } from './storage'
+import store from '@/store'
+import { MessageFu } from './message'
+import { domShowFu } from './domShow'
 
-const envFlag = process.env.NODE_ENV === "development";
+const envFlag = process.env.NODE_ENV === 'development'
 
-const baseUrlTemp = "https://sit-shoubov2.4dage.com"; // 测试环境
+const baseUrlTemp = 'https://sit-shoubov2.4dage.com' // 测试环境
 // const baseUrlTemp = "http://192.168.20.61:8070"; // 线下环境
 
-const baseFlag = baseUrlTemp.includes("https://");
+const baseFlag = baseUrlTemp.includes('https://')
 
 // 请求基地址
-export const baseURL = envFlag
-  ? `${baseUrlTemp}${baseFlag ? "" : "/api/"}`
-  : "";
+export const baseURL = envFlag ? `${baseUrlTemp}${baseFlag ? '' : '/api/'}` : ''
 
 // 处理  类型“AxiosResponse<any, any>”上不存在属性“code”
-declare module "axios" {
+declare module 'axios' {
   interface AxiosResponse {
-    code: number;
-    timestamp: string;
+    code: number
+    timestamp: string
     // 这里追加你的参数
   }
 }
 
 // 创建 axios 实例
 const http = axios.create({
-  baseURL: `${baseURL}${baseFlag ? "/api/" : ""}`,
-  timeout: 10000,
-});
+  baseURL: `${baseURL}${baseFlag ? '/api/' : ''}`,
+  timeout: 10000
+})
 
-let axajInd = 0;
+let axajInd = 0
 
 // 请求拦截器
 http.interceptors.request.use(
   function (config: any) {
     // 发请求前打开加载提示
-    domShowFu("#AsyncSpinLoding", true);
+    domShowFu('#AsyncSpinLoding', true)
 
-    axajInd++;
+    axajInd++
 
-    const { token } = getTokenInfo();
-    if (token) config.headers.token = token;
-    return config;
+    const { token } = getTokenInfo()
+    if (token) config.headers.token = token
+    return config
   },
   function (err) {
-    return Promise.reject(err);
+    return Promise.reject(err)
   }
-);
+)
 
-let timeId = -1;
+let timeId = -1
 
 // 响应拦截器
 http.interceptors.response.use(
   function (response) {
     // 请求回来的关闭加载提示
-    axajInd--;
+    axajInd--
     if (axajInd === 0) {
-      domShowFu("#AsyncSpinLoding", false);
+      domShowFu('#AsyncSpinLoding', false)
     }
     if (response.data.code === 5001 || response.data.code === 5002) {
-      removeTokenInfo();
-      history.push("/login");
-      clearTimeout(timeId);
+      removeTokenInfo()
+      history.push('/login')
+      clearTimeout(timeId)
       timeId = window.setTimeout(() => {
-        MessageFu.warning("登录失效!");
-      }, 200);
+        MessageFu.warning('登录失效!')
+      }, 200)
     } else if (response.data.code === 0) {
       // MessageFu.success(response.data.msg);
-    } else if (response.data.code !== 3014)
-      MessageFu.warning(response.data.msg);
+    } else if (response.data.code !== 3014) MessageFu.warning(response.data.msg)
 
-    return response.data;
+    return response.data
   },
   async function (err) {
-    clearTimeout(timeId);
+    clearTimeout(timeId)
     timeId = window.setTimeout(() => {
-      axajInd = 0;
-      domShowFu("#AsyncSpinLoding", false);
+      axajInd = 0
+      domShowFu('#AsyncSpinLoding', false)
       // 如果因为网络原因,response没有,给提示消息
       if (!err.response) {
-        if (store.getState().A0Layout.closeUpFile.state)
-          MessageFu.warning("取消上传!");
-        else MessageFu.error("网络繁忙,请稍后重试!");
+        if (store.getState().A0Layout.closeUpFile.state) MessageFu.warning('取消上传!')
+        else MessageFu.error('网络繁忙,请稍后重试!')
       } else {
         if (
           err.response &&
@@ -92,19 +88,19 @@ http.interceptors.response.use(
           err.response.data.msg &&
           err.response.data.msg.length < 30
         ) {
-          MessageFu.error(err.response.data.msg);
+          MessageFu.error(err.response.data.msg)
           // 没有权限
           if (err.response.data.code === 5003) {
-            removeTokenInfo();
-            history.push("/login");
+            removeTokenInfo()
+            history.push('/login')
           }
-        } else MessageFu.error("响应错误,请联系管理员!");
+        } else MessageFu.error('响应错误,请联系管理员!')
       }
-    }, 100);
+    }, 100)
 
-    return Promise.reject(err);
+    return Promise.reject(err)
   }
-);
+)
 
 // 导出 axios 实例
-export default http;
+export default http

+ 82 - 82
src/utils/tableData.ts

@@ -8,116 +8,116 @@
 // export const A1tableCFu = (type: "video" | "poster") => {
 //   return [
 //     ["index", "序号"],
-//     ["txt", "标题", "name"],
+//     ["txt", "标题", "name"]
 //     ["img", type === "video" ? "视频封面" : "海报", "thumb"],
 //     ["txtChange", "自动播放", "display", { 0: "否", 1: "是" }],
 //     ["text", "创建日期",'description', 50,A],
 //   ];
 
-import { A5topType } from "@/pages/A5publish/data";
+import { A5topType } from '@/pages/A5publish/data'
 
 // };
 export const A1tableC = [
-  ["txt", "标题", "name"],
-  ["img", "PC端封面", "thumb"],
-  ["img", "移动端封面", "thumbApp"],
-  ["txt", "活动日期", "activityTime"],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-  ["txt", "排序值", "sort"],
-  ["txtChange", "状态", "display", { 0: "不发布", 1: "发布" }],
-];
+  ['text', '标题', 'name', 100],
+  ['img', 'PC端封面', 'thumb'],
+  ['img', '移动端封面', 'thumbApp'],
+  ['txt', '活动日期', 'activityTime'],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['txt', '排序值', 'sort'],
+  ['txtChange', '状态', 'display', { 0: '不发布', 1: '发布' }]
+]
 
 export const A2tableC = [
-  ["txt", "标题", "name"],
-  ["img", "封面", "thumb"],
-  ["txtChange", "展览地址", "addrType", { inland: "国内", foreign: "国外" }],
-  ["txtChange", "展览时间", "type", { temp: "临时展览", long: "常设展览" }],
-  ["txt", "活动日期", "activityTime"],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-  ["txt", "排序值", "sort"],
-  ["txtChange", "状态", "display", { 0: "不发布", 1: "发布" }],
-];
+  ['text', '标题', 'name', 100],
+  ['img', '封面', 'thumb'],
+  ['txtChange', '展览地址', 'addrType', { inland: '国内', foreign: '国外' }],
+  ['txtChange', '展览时间', 'type', { temp: '临时展览', long: '常设展览' }],
+  ['txt', '活动日期', 'activityTime'],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['txt', '排序值', 'sort'],
+  ['txtChange', '状态', 'display', { 0: '不发布', 1: '发布' }]
+]
 
 export const A3tableC = [
-  ["txt", "名称", "name"],
-  ["txt", "类别", "type"],
-  ["txt", "年代", "dictAge"],
-  ["text", "摘要", "digest", 50],
-  ["img", "封面", "thumb"],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-  ["txt", "排序值", "sort"],
-  ["txtChange", "状态", "display", { 0: "不发布", 1: "发布" }],
-];
+  ['txt', '名称', 'name'],
+  ['txt', '类别', 'type'],
+  ['txt', '年代', 'dictAge'],
+  ['text', '摘要', 'digest', 50],
+  ['img', '封面', 'thumb'],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['txt', '排序值', 'sort'],
+  ['txtChange', '状态', 'display', { 0: '不发布', 1: '发布' }]
+]
 
 export const A4tableC = [
-  ["txt", "标题", "name"],
-  ["txt", "板块", "type"],
-  ["img", "封面", "thumb"],
-  ["text", "地点", "address", 50],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-  ["txt", "排序值", "sort"],
-  ["txtChange", "状态", "display", { 0: "不发布", 1: "发布" }],
-];
+  ['text', '标题', 'name', 100],
+  ['txt', '板块', 'type'],
+  ['img', '封面', 'thumb'],
+  ['text', '地点', 'address', 50],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['txt', '排序值', 'sort'],
+  ['txtChange', '状态', 'display', { 0: '不发布', 1: '发布' }]
+]
 
 export const A5tableCFu = (val: A5topType) => {
   const arr = [
-    ["txt", "标题", "name"],
-    ["txt", "年份", "year"],
-    ["img", "封面", "thumb"],
-    ["txt", "最近编辑日期", "updateTime"],
-    ["txt", "编辑人", "creatorName"],
-    ["txt", "排序值", "sort"],
-    ["txtChange", "状态", "display", { 0: "不发布", 1: "发布" }],
-  ];
+    ['text', '标题', 'name', 100],
+    ['txt', '年份', 'year'],
+    ['img', '封面', 'thumb'],
+    ['txt', '最近编辑日期', 'updateTime'],
+    ['txt', '编辑人', 'creatorName'],
+    ['txt', '排序值', 'sort'],
+    ['txtChange', '状态', 'display', { 0: '不发布', 1: '发布' }]
+  ]
 
-  if (val === "Exhibition") {
+  if (val === 'Exhibition') {
     // 删除年份
-    arr.splice(1, 1);
+    arr.splice(1, 1)
   }
 
-  return arr;
-};
+  return arr
+}
 
 export const A6tableC = [
-  ["img", "PC端封面", "thumbPc"],
-  ["img", "移动端封面", "thumbApp"],
-  ["text", "链接", "link", 50, "A"],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-  ["txt", "排序值", "sort"],
-];
+  ['img', 'PC端封面', 'thumbPc'],
+  ['img', '移动端封面', 'thumbApp'],
+  ['text', '链接', 'link', 50, 'A'],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['txt', '排序值', 'sort']
+]
 
 export const A7tableC = [
-  ["txt", "板块", "name"],
-  ["img", "PC端封面", "thumbPc"],
-  ["img", "移动端封面", "thumbApp"],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-];
+  ['txt', '板块', 'name'],
+  ['img', 'PC端封面', 'thumbPc'],
+  ['img', '移动端封面', 'thumbApp'],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName']
+]
 
 export const A8tableC = [
-  ["txt", "字典值", "name"],
-  ["txt", "最近编辑日期", "updateTime"],
-  ["txt", "编辑人", "creatorName"],
-  ["txt", "排序值", "sort"],
-];
+  ['txt', '字典值', 'name'],
+  ['txt', '最近编辑日期', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['txt', '排序值', 'sort']
+]
 
 export const Z1tableC = [
-  ["txt", "用户名", "userName"],
-  ["txtChange", "角色", "isAdmin", { 1: "管理员", 0: "普通成员" }],
-  ["txt", "真实姓名", "realName"],
-  ["txt", "创建日期", "createTime"],
-];
+  ['txt', '用户名', 'userName'],
+  ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],
+  ['txt', '真实姓名', 'realName'],
+  ['txt', '创建日期', 'createTime']
+]
 
 export const Z2tableC = [
-  ["index", "序号"],
-  ["txt", "账号", "userName"],
-  ["txt", "操作日期", "createTime"],
-  ["txt", "IP记录", "ip"],
-  ["txt", "操作模块", "type"],
-  ["txt", "操作事件", "description"],
-];
+  ['index', '序号'],
+  ['txt', '账号', 'userName'],
+  ['txt', '操作日期', 'createTime'],
+  ['txt', 'IP记录', 'ip'],
+  ['txt', '操作模块', 'type'],
+  ['txt', '操作事件', 'description']
+]