Browse Source

添加代码规范格式化

shaogen1995 1 year ago
parent
commit
319ec564ce

+ 12 - 0
.editorconfig

@@ -0,0 +1,12 @@
+root = true # 控制配置文件 .editorconfig 是否生效的字段
+ 
+[**] # 匹配全部文件
+indent_style = space # 缩进风格,可选space|tab
+indent_size = 2 # 缩进的空格数
+charset = utf-8 # 设置字符集
+trim_trailing_whitespace = true # 删除一行中的前后空格
+insert_final_newline = true # 设为true表示使文件以一个空白行结尾
+end_of_line = lf
+ 
+[**.md] # 匹配md文件
+trim_trailing_whitespace = false

+ 11 - 0
.prettierrc.js

@@ -0,0 +1,11 @@
+module.exports = {
+  printWidth: 100, // 一行的字符数,如果超过会进行换行
+  tabWidth: 2, // 一个tab代表几个空格数,默认就是2
+  useTabs: false, // 是否启用tab取代空格符缩进,.editorconfig设置空格缩进,所以设置为false
+  semi: false, // 行尾是否使用分号,默认为true
+  singleQuote: true, // 字符串是否使用单引号
+  trailingComma: "none", // 对象或数组末尾是否添加逗号 none| es5| all
+  jsxSingleQuote: true, // 在jsx里是否使用单引号,你看着办
+  bracketSpacing: true, // 对象大括号直接是否有空格,默认为true,效果:{ foo: bar }
+  arrowParens: "avoid", // 箭头函数如果只有一个参数则省略括号
+};

+ 39 - 0
.vscode/settings.json

@@ -0,0 +1,39 @@
+{
+  "search.exclude": {
+    "/node_modules": true,
+    "dist": true,
+    "pnpm-lock.sh": true
+  },
+  "editor.formatOnSave": true,
+  "[javascript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[javascriptreact]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescriptreact]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[json]": {
+    "editor.defaultFormatter": "vscode.json-language-features"
+  },
+  "[html]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[markdown]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[css]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[less]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[scss]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "liveServer.settings.port": 5502
+}

+ 1 - 1
src/assets/styles/base.css

@@ -35,7 +35,7 @@ textarea {
 }
 /* 主题色 */
 :root {
-  --themeColor: #CC1424;
+  --themeColor: #cc1424;
   --themeColor2: #272727;
 }
 /* 找不到页面 */

+ 6 - 24
src/assets/styles/base.less

@@ -11,13 +11,12 @@ html {
 }
 
 body {
-  font: 1em/1.4 'Microsoft Yahei', 'PingFang SC', 'Avenir', 'Segoe UI', 'Hiragino Sans GB', 'STHeiti', 'Microsoft Sans Serif', 'WenQuanYi Micro Hei', sans-serif;
+  font: 1em/1.4 'Microsoft Yahei', 'PingFang SC', 'Avenir', 'Segoe UI', 'Hiragino Sans GB',
+    'STHeiti', 'Microsoft Sans Serif', 'WenQuanYi Micro Hei', sans-serif;
   height: 100%;
   color: black;
 }
 
-
-
 i {
   font-style: normal;
 }
@@ -46,21 +45,16 @@ textarea {
 
 /* 主题色 */
 :root {
-  --themeColor: #CC1424;
+  --themeColor: #cc1424;
   --themeColor2: #272727;
 }
 
-
-
-
-
 /* 找不到页面 */
 .noFindPage {
   opacity: 0;
-  transition: opacity .5s;
+  transition: opacity 0.5s;
 }
 
-
 /* 兼容360浏览器的下拉框 */
 .ant-select-selector {
   position: relative;
@@ -137,7 +131,6 @@ textarea {
   //   background-color: var(--themeColor) !important;
   // }
 
-
   // .ant-pagination .ant-pagination-item-active a {
   //   color: #fff !important;
   // }
@@ -163,14 +156,11 @@ textarea {
   //   color: #fff;
   // }
 
-
-
   // .ant-pagination-next {
   //   border-radius: 50% !important;
   //   border: 1px solid #999;
   // }
 
-
   // .ant-pagination-next:hover {
   //   background-color: var(--themeColor);
   // }
@@ -187,7 +177,6 @@ textarea {
   //   background-color: transparent;
   // }
 
-
   /* 表格的图片居中 */
   .tableImgAuto {
     display: flex;
@@ -205,7 +194,6 @@ textarea {
     text-align: center !important;
   }
 
-
   // 树型 表格 定制化
   #A2Table3 {
     .ant-table-row-expand-icon {
@@ -218,18 +206,12 @@ textarea {
       justify-content: flex-start;
     }
   }
-
-
 }
 
-
-
 [hidden] {
   display: none !important;
 }
 
-
-
 #upInput {
   display: none;
 }
@@ -285,6 +267,6 @@ textarea {
   border-radius: 10px;
   background: transparent;
 }
-.ant-image-preview-operations{
+.ant-image-preview-operations {
   background-color: rgba(0, 0, 0, 0.8) !important;
-}
+}

+ 3 - 13
src/components/ZupTypes/index.module.scss

@@ -2,9 +2,6 @@
   padding-top: 3px;
 
   :global {
-
-
-
     .ZTboxTit {
       margin-left: 10px;
       font-size: 14px;
@@ -22,7 +19,7 @@
         top: 3px;
         width: 60px;
 
-        &>span {
+        & > span {
           color: #ff4d4f;
         }
       }
@@ -34,7 +31,6 @@
         font-size: 16px;
         align-items: center;
 
-
         .ZTbox2Look {
           margin-left: 20px;
           cursor: pointer;
@@ -50,8 +46,6 @@
           margin-left: 15px;
         }
       }
-
-
     }
 
     // 图片
@@ -66,7 +60,7 @@
           top: 3px;
           width: 60px;
 
-          &>span {
+          & > span {
             color: #ff4d4f;
           }
         }
@@ -88,8 +82,6 @@
             display: flex;
             justify-content: center;
             align-items: center;
-
-
           }
 
           .ZTbox1ImgRow {
@@ -170,7 +162,6 @@
               align-items: center;
             }
           }
-
         }
       }
     }
@@ -191,7 +182,6 @@
   }
 }
 
-
 // 查看情况
 .ZupTypesLook {
   :global {
@@ -222,4 +212,4 @@
       text-align: center;
     }
   }
-}
+}

+ 3 - 9
src/pages/A2exhibition/A2add/index.module.scss

@@ -15,7 +15,6 @@
       height: 100%;
       overflow-y: auto;
 
-
       .A2fromRow {
         position: relative;
         width: 800px;
@@ -44,7 +43,6 @@
           color: #999;
           font-size: 12px;
         }
-
       }
 
       .ant-form {
@@ -62,7 +60,7 @@
             width: 100px;
             text-align: right;
 
-            &>span {
+            & > span {
               color: #ff4d4f;
             }
           }
@@ -71,11 +69,10 @@
             width: calc(100% - 100px);
           }
 
-
           .formRight5Tit {
             position: relative;
             top: -10px;
-            transition: top .2s;
+            transition: top 0.2s;
             margin: 5px 0;
             color: #ff4d4f;
             opacity: 0;
@@ -88,7 +85,6 @@
           }
         }
 
-
         .A2Ebtn {
           position: absolute;
           z-index: 10;
@@ -99,10 +95,8 @@
       }
     }
 
-
     // 从查看进入
     .A2eMainLook {
-
       // 左边的 label 也不让选中
       label {
         pointer-events: none;
@@ -129,4 +123,4 @@
       }
     }
   }
-}
+}

+ 210 - 232
src/pages/A2exhibition/A2add/index.tsx

@@ -1,213 +1,201 @@
-import React, { useCallback, useEffect, useRef, useState } from "react";
-import styles from "./index.module.scss";
-import {
-  Button,
-  DatePicker,
-  Form,
-  FormInstance,
-  Input,
-  InputNumber,
-  Radio,
-  Select,
-} from "antd";
-import { A1EditInfoType } from "@/pages/A1event/data";
-import { A2_APIgetInfo, A2_APIsave } from "@/store/action/A2exhibition";
-import dayjs from "dayjs";
-import { MessageFu } from "@/utils/message";
-import classNames from "classnames";
-import ZupAudio from "@/components/ZupAudio";
-import ZupOne from "@/components/ZupOne";
-import MyPopconfirm from "@/components/MyPopconfirm";
-import ZRichTexts from "@/components/ZRichTexts";
-import TextArea from "antd/es/input/TextArea";
-import ZupTypes from "@/components/ZupTypes";
-
-const { RangePicker } = DatePicker;
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, DatePicker, Form, FormInstance, Input, InputNumber, Radio, Select } from 'antd'
+import { A1EditInfoType } from '@/pages/A1event/data'
+import { A2_APIgetInfo, A2_APIsave } from '@/store/action/A2exhibition'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import classNames from 'classnames'
+import ZupAudio from '@/components/ZupAudio'
+import ZupOne from '@/components/ZupOne'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import ZRichTexts from '@/components/ZRichTexts'
+import TextArea from 'antd/es/input/TextArea'
+import ZupTypes from '@/components/ZupTypes'
+
+const { RangePicker } = DatePicker
 
 type Props = {
-  editInfo: A1EditInfoType;
-  closeFu: () => void;
-  editTableFu: () => void;
-  addTableFu: () => void;
-};
+  editInfo: A1EditInfoType
+  closeFu: () => void
+  editTableFu: () => void
+  addTableFu: () => void
+}
 
 function A2add({ 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)
 
   // PC海报图的ref
-  const ZupPcImgRef = useRef<any>(null);
+  const ZupPcImgRef = useRef<any>(null)
 
   // 富文本的ref
-  const ZRichTextRef = useRef<any>(null);
+  const ZRichTextRef = useRef<any>(null)
 
   // 展品的ref
-  const ZupFilesRef1 = useRef<any>(null);
+  const ZupFilesRef1 = useRef<any>(null)
 
   // 展馆的ref
-  const ZupFilesRef2 = useRef<any>(null);
+  const ZupFilesRef2 = useRef<any>(null)
 
   // 标题的音频
   const [nameAudio, setNameAudio] = useState({
-    fileName: "",
-    filePath: "",
-  });
+    fileName: '',
+    filePath: ''
+  })
 
   // 编辑/查看 进入页面 获取信息
   const getInfoFu = useCallback(async (id: number) => {
-    const res = await A2_APIgetInfo(id);
+    const res = await A2_APIgetInfo(id)
     if (res.code === 0) {
-      const data = res.data;
+      const data = res.data
 
-      setDirCode(data.dirCode);
+      setDirCode(data.dirCode)
 
       // 展示展品
       ZupFilesRef1.current?.setFileComFileFu({
-        type: "img",
-        fileList: data.exhibitsFile || [],
-      });
+        type: 'img',
+        fileList: data.exhibitsFile || []
+      })
 
       // 展示展馆
       ZupFilesRef2.current?.setFileComFileFu({
-        type: "img",
-        fileList: data.exhibitionFile || [],
-      });
+        type: 'img',
+        fileList: data.exhibitionFile || []
+      })
 
       // 设置 临时展览 / 常设展览
-      setTimeType(data.type);
+      setTimeType(data.type)
 
       // 设置 常设展览描述
-      setTimeVal(data.typeRemark);
+      setTimeVal(data.typeRemark)
 
       // 设置 临时展览 时间
       if (data.dateStart && data.dateEnd) {
-        setTimeArr([dayjs(data.dateStart), dayjs(data.dateEnd)]);
+        setTimeArr([dayjs(data.dateStart), dayjs(data.dateEnd)])
       }
 
       // 设置地址
       setAddrType({
         key: data.addrType,
-        txt: data.address,
-      });
+        txt: data.address
+      })
 
       // 设置标题的 音频
       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)
 
       // 设置封面图
       ZupThumbRef.current?.setFileComFileFu({
-        fileName: "",
-        filePath: data.thumb,
-      });
+        fileName: '',
+        filePath: data.thumb
+      })
 
       // 设置Pc海报
       ZupPcImgRef.current?.setFileComFileFu({
-        fileName: "",
-        filePath: data.thumbPc,
-      });
+        fileName: '',
+        filePath: data.thumbPc
+      })
     }
-  }, []);
+  }, [])
 
   // 临时展览 常设展览的切换
-  const [timeType, setTimeType] = useState("long");
-  const [timeVal, setTimeVal] = useState("");
+  const [timeType, setTimeType] = useState('long')
+  const [timeVal, setTimeVal] = useState('')
   // 格式为dayjs的格式,需要转换
-  const [timeArr, setTimeArr] = useState<any>(null);
+  const [timeArr, setTimeArr] = useState<any>(null)
 
   // 地址
   const [addrType, setAddrType] = useState({
-    key: "inland",
-    txt: "",
-  });
+    key: 'inland',
+    txt: ''
+  })
 
   const addrTypeChangeFu = useCallback(
-    (key: "key" | "txt", val: string) => {
-      setAddrType({ ...addrType, [key]: val });
+    (key: 'key' | 'txt', val: string) => {
+      setAddrType({ ...addrType, [key]: val })
     },
     [addrType]
-  );
+  )
 
   // 附件 是否 已经点击过确定
-  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')
 
       // 临时展览的时候要判断
-      if (timeType === "temp") {
-        if (!timeArr || !timeArr[0])
-          return MessageFu.warning("请选择临时展览时间!");
+      if (timeType === 'temp') {
+        if (!timeArr || !timeArr[0]) return MessageFu.warning('请选择临时展览时间!')
       }
       // 地址校验
-      if (!addrType.txt) return MessageFu.warning("请输入地址!");
+      if (!addrType.txt) return MessageFu.warning('请输入地址!')
 
-      let dateStart = "";
-      let dateEnd = "";
+      let dateStart = ''
+      let dateEnd = ''
       if (timeArr && timeArr[0] && timeArr[1]) {
-        dateStart = dayjs(timeArr[0]).format("YYYY-MM-DD");
-        dateEnd = dayjs(timeArr[1]).format("YYYY-MM-DD");
+        dateStart = dayjs(timeArr[0]).format('YYYY-MM-DD')
+        dateEnd = dayjs(timeArr[1]).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('请输入完整正文!')
 
       // 展品的校验
-      const { sonFileIds: exhibitsFileIds } =
-        ZupFilesRef1.current?.fileComFileResFu();
+      const { sonFileIds: exhibitsFileIds } = ZupFilesRef1.current?.fileComFileResFu()
 
       if (exhibitsFileIds.length <= 0) {
-        return MessageFu.warning("请最少上传一个展品!");
+        return MessageFu.warning('请最少上传一个展品!')
       }
 
       // 展馆的校验
-      const { sonFileIds: exhibitionFileIds } =
-        ZupFilesRef2.current?.fileComFileResFu();
+      const { sonFileIds: exhibitionFileIds } = ZupFilesRef2.current?.fileComFileResFu()
 
       if (exhibitionFileIds.length <= 0) {
-        return MessageFu.warning("请最少上传一个展馆!");
+        return MessageFu.warning('请最少上传一个展馆!')
       }
 
       // pc海报
-      const coverUrl2 = ZupPcImgRef.current?.fileComFileResFu();
+      const coverUrl2 = ZupPcImgRef.current?.fileComFileResFu()
 
       // 富文本标题集合
-      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 = {
@@ -216,7 +204,7 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
         datePublish,
         thumb: coverUrl1.filePath,
         thumbPc: coverUrl2.filePath,
-        rtf: JSON.stringify(rtf.val || ""),
+        rtf: JSON.stringify(rtf.val || ''),
         fileName: nameAudio.fileName,
         filePath: nameAudio.filePath,
         type: timeType,
@@ -224,24 +212,24 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
         dateEnd,
         addrType: addrType.key,
         address: addrType.txt,
-        exhibitsFileIds: exhibitsFileIds.join(","),
-        exhibitionFileIds: exhibitionFileIds.join(","),
+        exhibitsFileIds: exhibitsFileIds.join(','),
+        exhibitionFileIds: exhibitionFileIds.join(','),
         dirCode,
         typeRemark: timeVal,
-        rtfTitle: JSON.stringify(rtfNameArr),
-      };
+        rtfTitle: JSON.stringify(rtfNameArr)
+      }
 
       // if (obj) {
       //   console.log(123, obj);
       //   return;
       // }
 
-      const res = await A2_APIsave(obj);
+      const res = await A2_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()
       }
     },
     [
@@ -257,165 +245,160 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
       nameAudio.fileName,
       nameAudio.filePath,
       timeArr,
-      timeType,
+      timeType
     ]
-  );
+  )
 
   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.A2add}>
-      <div
-        className={classNames(
-          "A2eMain",
-          editInfo.txt === "查看" ? "A2eMainLook" : ""
-        )}
-      >
+      <div className={classNames('A2eMain', editInfo.txt === '查看' ? 'A2eMainLook' : '')}>
         <Form
           ref={FormBoxRef}
-          name="basic"
+          name='basic'
           labelCol={{ span: 3 }}
           onFinish={onFinish}
           onFinishFailed={onFinishFailed}
-          autoComplete="off"
+          autoComplete='off'
           scrollToFirstError
         >
-          <div className="A2fromRow">
+          <div className='A2fromRow'>
             <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" }}
+                readOnly={editInfo.txt === '查看'}
+                style={{ width: '500px' }}
                 maxLength={100}
                 showCount
-                placeholder="请输入内容"
+                placeholder='请输入内容'
               />
             </Form.Item>
             {/* 标题的无障碍音频 */}
-            <div className="A2_1Frow">
+            <div className='A2_1Frow'>
               <ZupAudio
                 fileInfo={nameAudio}
-                upDataFu={(info) => setNameAudio(info)}
-                delFu={() => setNameAudio({ fileName: "", filePath: "" })}
+                upDataFu={info => setNameAudio(info)}
+                delFu={() => setNameAudio({ fileName: '', filePath: '' })}
                 dirCode={dirCode}
-                myUrl="cms/exhibition/upload"
-                isLook={editInfo.txt === "查看"}
+                myUrl='cms/exhibition/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'>
               <ZupOne
                 ref={ZupThumbRef}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 fileCheck={fileCheck}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/exhibition/upload"
-                format={["image/jpeg", "image/png"]}
-                formatTxt="png、jpg和jpeg"
-                checkTxt="请上传封面图!"
-                upTxt="最多1张"
-                myType="thumb"
+                myUrl='cms/exhibition/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面图!'
+                upTxt='最多1张'
+                myType='thumb'
               />
             </div>
           </div>
 
           {/* PC海报 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span> </span>
               PC海报:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <ZupOne
                 ref={ZupPcImgRef}
-                isLook={editInfo.txt === "查看"}
+                isLook={editInfo.txt === '查看'}
                 fileCheck={false}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/exhibition/upload"
-                format={["image/jpeg", "image/png"]}
-                formatTxt="png、jpg和jpeg"
-                checkTxt="请上传封面图!"
-                upTxt="最多1张"
-                myType="thumb"
+                myUrl='cms/exhibition/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}
 
-          <Form.Item label="摘要" name="digest">
+          <Form.Item label='摘要' name='digest'>
             <TextArea
-              readOnly={editInfo.txt === "查看"}
-              placeholder="请输入内容"
+              readOnly={editInfo.txt === '查看'}
+              placeholder='请输入内容'
               maxLength={1000}
               showCount
             />
           </Form.Item>
 
           {/* 时间 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               时间:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <div>
                 <Select
                   value={timeType}
-                  onChange={(e) => setTimeType(e)}
+                  onChange={e => setTimeType(e)}
                   style={{ width: 150 }}
                   options={[
-                    { value: "long", label: "常设展览" },
-                    { value: "temp", label: "临时展览" },
+                    { value: 'long', label: '常设展览' },
+                    { value: 'temp', label: '临时展览' }
                   ]}
                 />
                 &emsp;
-                {timeType === "long" ? (
+                {timeType === 'long' ? (
                   <Input
                     style={{ width: 536 }}
                     maxLength={100}
                     showCount
                     value={timeVal}
-                    onChange={(e) => setTimeVal(e.target.value)}
-                    placeholder="在此填入时间备注(选填),如9:00 - 17:00 (closed on Mondays)"
+                    onChange={e => setTimeVal(e.target.value)}
+                    placeholder='在此填入时间备注(选填),如9:00 - 17:00 (closed on Mondays)'
                   />
                 ) : (
                   <RangePicker
                     value={timeArr && timeArr[0] ? timeArr : null}
-                    onChange={(val) => setTimeArr(val)}
+                    onChange={val => setTimeArr(val)}
                   />
                 )}
               </div>
               <div
                 className={classNames(
-                  "formRight5Tit",
-                  fileCheck && timeType === "temp" && (!timeArr || !timeArr[0])
-                    ? "formRight5TitErr"
-                    : ""
+                  'formRight5Tit',
+                  fileCheck && timeType === 'temp' && (!timeArr || !timeArr[0])
+                    ? 'formRight5TitErr'
+                    : ''
                 )}
               >
                 请选择时间!
@@ -424,40 +407,40 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
           </div>
 
           {/* 地址 */}
-          <div className="formRow">
-            <div className="formLeft">
+          <div className='formRow'>
+            <div className='formLeft'>
               <span>* </span>
               地址:
             </div>
-            <div className="formRight">
+            <div className='formRight'>
               <div>
                 {[
-                  { name: "国内", key: "inland" },
-                  { name: "国外", key: "foreign" },
-                ].map((item) => (
+                  { name: '国内', key: 'inland' },
+                  { name: '国外', key: 'foreign' }
+                ].map(item => (
                   <Radio
                     key={item.name}
                     checked={addrType.key === item.key}
-                    onClick={() => addrTypeChangeFu("key", item.key)}
+                    onClick={() => addrTypeChangeFu('key', item.key)}
                   >
                     {item.name}
                   </Radio>
                 ))}
                 &emsp;
                 <Input
-                  readOnly={editInfo.txt === "查看"}
+                  readOnly={editInfo.txt === '查看'}
                   style={{ width: 536, marginLeft: 14 }}
                   maxLength={100}
                   showCount
                   value={addrType.txt}
-                  onChange={(e) => addrTypeChangeFu("txt", e.target.value)}
-                  placeholder="请输入内容"
+                  onChange={e => addrTypeChangeFu('txt', e.target.value)}
+                  placeholder='请输入内容'
                 />
               </div>
               <div
                 className={classNames(
-                  "formRight5Tit",
-                  fileCheck && !addrType.txt ? "formRight5TitErr" : ""
+                  'formRight5Tit',
+                  fileCheck && !addrType.txt ? 'formRight5TitErr' : ''
                 )}
               >
                 请输入地址!
@@ -466,36 +449,36 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
           </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/exhibition/upload"
+                myUrl='cms/exhibition/upload'
               />
             </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={ZupFilesRef1}
-                selecFlag="图片"
+                selecFlag='图片'
                 fileCheck={fileCheck}
                 dirCode={dirCode}
-                myUrl="cms/exhibition/upload"
-                isLook={editInfo.txt === "查看"}
+                myUrl='cms/exhibition/upload'
+                isLook={editInfo.txt === '查看'}
                 imgLength={30}
                 isTypeShow={true}
                 isUpName={true}
@@ -504,19 +487,19 @@ function A2add({ editInfo, closeFu, editTableFu, addTableFu }: Props) {
           </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/exhibition/upload"
-                isLook={editInfo.txt === "查看"}
+                myUrl='cms/exhibition/upload'
+                isLook={editInfo.txt === '查看'}
                 imgLength={30}
                 isTypeShow={true}
               />
@@ -524,67 +507,62 @@ function A2add({ 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="A2fromRow">
+          <div className='A2fromRow'>
             <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="A2_6Frow" hidden={editInfo.txt === "查看"}>
+            <div className='A2_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="A2Ebtn">
-            {editInfo.txt === "查看" ? (
+          <Form.Item className='A2Ebtn'>
+            {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 MemoA2add = React.memo(A2add);
+const MemoA2add = React.memo(A2add)
 
-export default MemoA2add;
+export default MemoA2add

+ 15 - 15
src/store/action/A8dict.ts

@@ -1,5 +1,5 @@
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  *字典-列表
@@ -7,31 +7,31 @@ import { AppDispatch } from "..";
 
 export const A8_APIgetList = (): any => {
   return async (dispatch: AppDispatch) => {
-    const res = await http.get("cms/dict/getList?type=dict");
+    const res = await http.get('cms/dict/getList?type=dict')
     if (res.code === 0) {
       dispatch({
-        type: "A8/getList",
+        type: 'A8/getList',
         payload: res.data.map((v: any) => ({
           ...v,
-          updateTime: v.id === 30 ? " - " : v.updateTime,
-          creatorName: v.id === 30 ? " - " : v.creatorName,
-          sort: v.id === 30 ? " - " : v.sort,
-        })),
-      });
+          updateTime: v.id === 30 ? ' - ' : v.updateTime,
+          creatorName: v.id === 30 ? ' - ' : v.creatorName,
+          sort: v.id === 30 ? ' - ' : v.sort
+        }))
+      })
     }
-  };
-};
+  }
+}
 
 /**
  * 字典-删除
  */
 export const A8_APIdel = (id: number) => {
-  return http.get(`cms/dict/removes/${id}`);
-};
+  return http.get(`cms/dict/removes/${id}`)
+}
 
 /**
  * 字典-新增、编辑
  */
 export const A8_APIsave = (data: any) => {
-  return http.post("cms/dict/save", data);
-};
+  return http.post('cms/dict/save', data)
+}