소스 검색

🐛,兼容360浏览器的样式和自己封装antd轻提示

shaogen1995 2 년 전
부모
커밋
98e928f5dd
43개의 변경된 파일487개의 추가작업 그리고 217개의 파일을 삭제
  1. 17 18
      package-lock.json
  2. 1 0
      package.json
  3. 4 0
      src/App.tsx
  4. 45 74
      src/assets/styles/base.css
  5. 163 0
      src/assets/styles/base.less
  6. 2 2
      src/components/AuthRoute/index.tsx
  7. 29 0
      src/components/Message/index.tsx
  8. 9 9
      src/components/ObjectAdd/index.tsx
  9. 13 2
      src/index.tsx
  10. 2 1
      src/pages/Home/index.tsx
  11. 3 2
      src/pages/Layout/index.tsx
  12. 5 4
      src/pages/Login/index.tsx
  13. 6 5
      src/pages/ObjectSon/Object1/AddObject1/index.tsx
  14. 4 3
      src/pages/ObjectSon/Object1/AuditObject1/index.tsx
  15. 2 2
      src/pages/ObjectSon/Object1/index.tsx
  16. 8 5
      src/pages/ObjectSon/Object2/LookObject2/index.tsx
  17. 3 2
      src/pages/ObjectSon/Object2/index.tsx
  18. 7 6
      src/pages/ObjectSon/Object3/AddObject3/GoodsAll.tsx
  19. 6 5
      src/pages/ObjectSon/Object3/AddObject3/index.tsx
  20. 4 3
      src/pages/ObjectSon/Object3/AuditObject3/index.tsx
  21. 3 2
      src/pages/ObjectSon/Object3/index.tsx
  22. 7 6
      src/pages/ObjectSon/Object4/AddObject4/GoodsAll.tsx
  23. 5 4
      src/pages/ObjectSon/Object4/AddObject4/index.tsx
  24. 4 3
      src/pages/ObjectSon/Object4/AuditObject4/index.tsx
  25. 3 2
      src/pages/ObjectSon/Object4/LookObject4/index.tsx
  26. 3 2
      src/pages/ObjectSon/Object4/index.tsx
  27. 4 3
      src/pages/ObjectSon/Object5/AuditObject5/index.tsx
  28. 3 2
      src/pages/ObjectSon/Object5/index.tsx
  29. 7 6
      src/pages/ObjectSon/Object6/AddObject6/GoodsAll.tsx
  30. 4 3
      src/pages/ObjectSon/Object6/AddObject6/index.tsx
  31. 4 3
      src/pages/ObjectSon/Object6/AuditObject6/index.tsx
  32. 3 2
      src/pages/ObjectSon/Object6/index.tsx
  33. 6 5
      src/pages/StoresSon/Stores1/index.tsx
  34. 3 2
      src/pages/StoresSon/Stores2/index.tsx
  35. 4 3
      src/pages/StoresSon/Stores3/AuditStores3/index.tsx
  36. 3 2
      src/pages/StoresSon/Stores3/index.tsx
  37. 6 5
      src/pages/SystemSon/System1/UserModal.tsx
  38. 4 3
      src/pages/SystemSon/System1/index.tsx
  39. 5 5
      src/pages/SystemSon/System2/index.tsx
  40. 3 3
      src/store/action/object1.ts
  41. 13 1
      src/store/reducer/login.ts
  42. 7 7
      src/utils/http.ts
  43. 50 0
      src/utils/message.ts

+ 17 - 18
package-lock.json

@@ -8,6 +8,7 @@
       "name": "demo",
       "version": "0.1.0",
       "dependencies": {
+        "@ant-design/cssinjs": "^1.5.6",
         "@testing-library/jest-dom": "^5.16.5",
         "@testing-library/react": "^13.4.0",
         "@testing-library/user-event": "^13.5.0",
@@ -69,16 +70,16 @@
       }
     },
     "node_modules/@ant-design/cssinjs": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.1.1.tgz",
-      "integrity": "sha512-GtgALFUwwkOAwc8JundzcdLDckyrc+tgxpx4RGZQTDNOuh5VnngybpRfwvug8znt5/Zy9uNkzrSUPO05kBivcg==",
+      "version": "1.5.6",
+      "resolved": "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.5.6.tgz",
+      "integrity": "sha512-1S7LUPC9BMyQ/CUYgzfePJJwEfsbVHJe3Tpd9zhujTxRM/6LYpN9N4FTaPHVqpnPazm0S2vG0WBkh2T5Erwuug==",
       "dependencies": {
         "@babel/runtime": "^7.11.1",
         "@emotion/hash": "^0.8.0",
         "@emotion/unitless": "^0.7.5",
         "classnames": "^2.3.1",
         "csstype": "^3.0.10",
-        "rc-util": "^5.24.2",
+        "rc-util": "^5.27.0",
         "stylis": "^4.0.13"
       },
       "peerDependencies": {
@@ -13947,13 +13948,12 @@
       }
     },
     "node_modules/rc-util": {
-      "version": "5.25.2",
-      "resolved": "https://registry.npmmirror.com/rc-util/-/rc-util-5.25.2.tgz",
-      "integrity": "sha512-OyCO675K/rh4zG3e+LYaHw54WQFEYGV9ibkGawQxqCvf0G0PzUrLQjgZ6SfoHORdbEKN7eQMFn3hHQyA/P8Y5Q==",
+      "version": "5.27.2",
+      "resolved": "https://registry.npmmirror.com/rc-util/-/rc-util-5.27.2.tgz",
+      "integrity": "sha512-8XHRbeJOWlTR2Hk1K2xLaPOf7lZu+3taskAGuqOPccA676vB3ygrz3ZgdrA3wml40CzR9RlIEHDWwI7FZT3wBQ==",
       "dependencies": {
         "@babel/runtime": "^7.18.3",
-        "react-is": "^16.12.0",
-        "shallowequal": "^1.1.0"
+        "react-is": "^16.12.0"
       },
       "peerDependencies": {
         "react": ">=16.9.0",
@@ -17141,16 +17141,16 @@
       }
     },
     "@ant-design/cssinjs": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.1.1.tgz",
-      "integrity": "sha512-GtgALFUwwkOAwc8JundzcdLDckyrc+tgxpx4RGZQTDNOuh5VnngybpRfwvug8znt5/Zy9uNkzrSUPO05kBivcg==",
+      "version": "1.5.6",
+      "resolved": "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.5.6.tgz",
+      "integrity": "sha512-1S7LUPC9BMyQ/CUYgzfePJJwEfsbVHJe3Tpd9zhujTxRM/6LYpN9N4FTaPHVqpnPazm0S2vG0WBkh2T5Erwuug==",
       "requires": {
         "@babel/runtime": "^7.11.1",
         "@emotion/hash": "^0.8.0",
         "@emotion/unitless": "^0.7.5",
         "classnames": "^2.3.1",
         "csstype": "^3.0.10",
-        "rc-util": "^5.24.2",
+        "rc-util": "^5.27.0",
         "stylis": "^4.0.13"
       }
     },
@@ -27581,13 +27581,12 @@
       }
     },
     "rc-util": {
-      "version": "5.25.2",
-      "resolved": "https://registry.npmmirror.com/rc-util/-/rc-util-5.25.2.tgz",
-      "integrity": "sha512-OyCO675K/rh4zG3e+LYaHw54WQFEYGV9ibkGawQxqCvf0G0PzUrLQjgZ6SfoHORdbEKN7eQMFn3hHQyA/P8Y5Q==",
+      "version": "5.27.2",
+      "resolved": "https://registry.npmmirror.com/rc-util/-/rc-util-5.27.2.tgz",
+      "integrity": "sha512-8XHRbeJOWlTR2Hk1K2xLaPOf7lZu+3taskAGuqOPccA676vB3ygrz3ZgdrA3wml40CzR9RlIEHDWwI7FZT3wBQ==",
       "requires": {
         "@babel/runtime": "^7.18.3",
-        "react-is": "^16.12.0",
-        "shallowequal": "^1.1.0"
+        "react-is": "^16.12.0"
       },
       "dependencies": {
         "react-is": {

+ 1 - 0
package.json

@@ -3,6 +3,7 @@
   "version": "0.1.0",
   "private": true,
   "dependencies": {
+    "@ant-design/cssinjs": "^1.5.6",
     "@testing-library/jest-dom": "^5.16.5",
     "@testing-library/react": "^13.4.0",
     "@testing-library/user-event": "^13.5.0",

+ 4 - 0
src/App.tsx

@@ -10,6 +10,7 @@ import { Image } from "antd";
 import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "./store";
 import UpAsyncLoding from "./components/UpAsyncLoding";
+import MessageCom from "./components/Message";
 const Layout = React.lazy(() => import("./pages/Layout"));
 const Login = React.lazy(() => import("./pages/Login"));
 
@@ -53,6 +54,9 @@ export default function App() {
 
       {/* 上传附件的进度条元素 */}
       <UpAsyncLoding />
+
+      {/* antd 轻提示 ---兼容360浏览器 */}
+      <MessageCom />
     </>
   );
 }

+ 45 - 74
src/assets/styles/base.css

@@ -3,147 +3,118 @@
   padding: 0;
   box-sizing: border-box;
 }
-
 html {
   height: 100%;
   font-size: 14px;
   user-select: none;
 }
-
 body {
   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: #333;
 }
-
 a {
   text-decoration: none;
   color: #333;
   outline: none;
 }
-
 i {
   font-style: normal;
 }
-
 img {
   max-width: 100%;
   max-height: 100%;
   vertical-align: middle;
+  object-fit: cover;
 }
-
 ul {
   list-style: none;
 }
-
-#root {
-  width: 100vw;
-  height: 100vh;
-  min-width: 1600px;
-  min-height: 900px;
-  overflow-y: auto;
-
-}
 body {
   overflow-y: overlay;
 }
-
 /* 文本域取消下拉 */
 textarea {
   resize: none !important;
 }
-
 /* 主题色 */
 :root {
-  --themeColor: #9F1927
+  --themeColor: #9F1927;
 }
-
 a {
   color: var(--themeColor);
 }
-
-/* 按钮的危险颜色 */
-.ant-btn-text.ant-btn-dangerous {
+[hidden] {
+  display: none !important;
+}
+/* 兼容360浏览器的下拉框 */
+.ant-select-selector {
+  position: relative;
+  background-color: #ffffff;
+  border: 1px solid #d9d9d9;
+  transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
+}
+#root {
+  width: 100vw;
+  height: 100vh;
+  min-width: 1600px;
+  min-height: 900px;
+  overflow-y: auto;
+  /* 按钮的危险颜色 */
+  /* antd分页器样式 */
+  /* antd图片预览组件 */
+}
+#root .ant-btn-text.ant-btn-dangerous {
   color: var(--themeColor);
 }
-
-/* antd分页器样式 */
-.ant-pagination .ant-pagination-item {
+#root .ant-pagination .ant-pagination-item {
   border-radius: 50%;
   border: 1px solid #999;
-  background-color: transparent !important;
+  background-color: transparent;
 }
-
-.ant-pagination .ant-pagination-item-active {
-  background-color: var(--themeColor) !important;
+#root .ant-pagination .ant-pagination-item-active {
+  background-color: var(--themeColor);
 }
-
-
-.ant-pagination .ant-pagination-item-active a {
-  color: #fff !important;
+#root .ant-pagination .ant-pagination-item-active a {
+  color: #fff;
 }
-
-.ant-pagination .ant-pagination-item:hover {
-  background-color: var(--themeColor) !important;
+#root .ant-pagination .ant-pagination-item:hover {
+  background-color: var(--themeColor);
 }
-
-.ant-pagination .ant-pagination-item:hover a {
-  color: #fff !important;
+#root .ant-pagination .ant-pagination-item:hover a {
+  color: #fff;
 }
-
-.ant-pagination-prev {
-  border-radius: 50% !important;
+#root .ant-pagination-prev {
+  border-radius: 50%;
   border: 1px solid #999;
 }
-
-.ant-pagination-prev:hover {
+#root .ant-pagination-prev:hover {
   background-color: var(--themeColor);
 }
-
-.ant-pagination-prev:hover button {
+#root .ant-pagination-prev:hover button {
   color: #fff;
 }
-
-
-
-.ant-pagination-next {
-  border-radius: 50% !important;
+#root .ant-pagination-next {
+  border-radius: 50%;
   border: 1px solid #999;
 }
-
-
-.ant-pagination-next:hover {
+#root .ant-pagination-next:hover {
   background-color: var(--themeColor);
 }
-
-.ant-pagination-next:hover button {
+#root .ant-pagination-next:hover button {
   color: #fff;
 }
-
-.ant-pagination-disabled {
+#root .ant-pagination-disabled {
   border: 1px solid #ccc;
 }
-
-.ant-pagination-disabled:hover {
+#root .ant-pagination-disabled:hover {
   background-color: transparent;
 }
-
-img {
-  object-fit: cover;
-}
-
-[hidden] {
+#root .ant-image {
   display: none !important;
 }
-
-
 /* 找不到页面 */
 .noFindPage {
   opacity: 0;
-  transition: opacity .5s;
+  transition: opacity 0.5s;
 }
-
-/* antd图片预览组件 */
-.ant-image{
-  display: none;
-}

+ 163 - 0
src/assets/styles/base.less

@@ -0,0 +1,163 @@
+* {
+  margin: 0;
+  padding: 0;
+  box-sizing: border-box;
+}
+
+html {
+  height: 100%;
+  font-size: 14px;
+  user-select: none;
+}
+
+body {
+  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: #333;
+}
+
+a {
+  text-decoration: none;
+  color: #333;
+  outline: none;
+}
+
+i {
+  font-style: normal;
+}
+
+img {
+  max-width: 100%;
+  max-height: 100%;
+  vertical-align: middle;
+  object-fit: cover;
+}
+
+ul {
+  list-style: none;
+}
+
+body {
+  overflow-y: overlay;
+}
+
+/* 文本域取消下拉 */
+textarea {
+  resize: none !important;
+}
+
+/* 主题色 */
+:root {
+  --themeColor: #9F1927;
+}
+
+a {
+  color: var(--themeColor);
+}
+
+[hidden] {
+  display: none !important;
+}
+
+
+/* 兼容360浏览器的下拉框 */
+.ant-select-selector {
+  position: relative;
+  background-color: #ffffff;
+  border: 1px solid #d9d9d9;
+  transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
+}
+
+// antd的样式覆盖
+
+#root {
+  width: 100vw;
+  height: 100vh;
+  min-width: 1600px;
+  min-height: 900px;
+  overflow-y: auto;
+
+  /* 按钮的危险颜色 */
+  .ant-btn-text.ant-btn-dangerous {
+    color: var(--themeColor);
+  }
+
+
+
+  /* antd分页器样式 */
+  .ant-pagination .ant-pagination-item {
+    border-radius: 50%;
+    border: 1px solid #999;
+    background-color: transparent;
+  }
+
+  .ant-pagination .ant-pagination-item-active {
+    background-color: var(--themeColor);
+  }
+
+
+  .ant-pagination .ant-pagination-item-active a {
+    color: #fff;
+  }
+
+  .ant-pagination .ant-pagination-item:hover {
+    background-color: var(--themeColor);
+  }
+
+  .ant-pagination .ant-pagination-item:hover a {
+    color: #fff;
+  }
+
+  .ant-pagination-prev {
+    border-radius: 50%;
+    border: 1px solid #999;
+  }
+
+  .ant-pagination-prev:hover {
+    background-color: var(--themeColor);
+  }
+
+  .ant-pagination-prev:hover button {
+    color: #fff;
+  }
+
+
+
+  .ant-pagination-next {
+    border-radius: 50%;
+    border: 1px solid #999;
+  }
+
+
+  .ant-pagination-next:hover {
+    background-color: var(--themeColor);
+  }
+
+  .ant-pagination-next:hover button {
+    color: #fff;
+  }
+
+  .ant-pagination-disabled {
+    border: 1px solid #ccc;
+  }
+
+  .ant-pagination-disabled:hover {
+    background-color: transparent;
+  }
+
+  /* antd图片预览组件 */
+  .ant-image {
+    display: none !important;
+  }
+}
+
+
+
+
+
+
+/* 找不到页面 */
+.noFindPage {
+  opacity: 0;
+  transition: opacity .5s;
+}

+ 2 - 2
src/components/AuthRoute/index.tsx

@@ -1,5 +1,5 @@
 import { hasToken } from "@//utils/storage";
-import { message } from "antd";
+import { MessageFu } from "@/utils/message";
 import React from "react";
 import { Redirect, Route } from "react-router-dom";
 
@@ -17,7 +17,7 @@ export default function AuthRoute({ path, component: Com, ...rest }: AtahType) {
       render={() => {
         if (hasToken()) return <Com />;
         else {
-          message.warning("登录失效!");
+          MessageFu.warning("登录失效!");
           return (
             <Redirect
               to={{

+ 29 - 0
src/components/Message/index.tsx

@@ -0,0 +1,29 @@
+import React, { useEffect } from "react";
+import { message } from "antd";
+import { useSelector } from "react-redux";
+import { RootState } from "@/store";
+
+function MessageCom() {
+  // 从仓库中获取 antd 轻提示信息
+  const messageReducerInfo = useSelector(
+    (state: RootState) => state.loginStore.message
+  );
+
+  const [messageApi, contextHolder] = message.useMessage();
+
+  useEffect(() => {
+    if (messageReducerInfo.txt) {
+      messageApi.open({
+        type: messageReducerInfo.type,
+        content: messageReducerInfo.txt,
+        duration: messageReducerInfo.duration,
+      });
+    }
+  }, [messageApi, messageReducerInfo]);
+
+  return <>{contextHolder}</>;
+}
+
+const MemoMessage = React.memo(MessageCom);
+
+export default MemoMessage;

+ 9 - 9
src/components/ObjectAdd/index.tsx

@@ -4,7 +4,6 @@ import {
   Form,
   Input,
   InputNumber,
-  message,
   Modal,
   Popconfirm,
   Select,
@@ -33,6 +32,7 @@ import {
 } from "@/store/action/object1";
 import { goodsChangeObj } from "@/utils/dataChange";
 import { editObj2GoodsAPI } from "@/store/action/object2";
+import { MessageFu } from "@/utils/message";
 const { Option } = Select;
 
 type Props = {
@@ -49,7 +49,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
   // 没有通过校验
   const onFinishFailed = () => {
     setTitSelect("tit1");
-    return message.warning("有表单不符号规则!");
+    return MessageFu.warning("有表单不符号规则!");
   };
 
   // --------通过校验之后发送请求----------点击确定
@@ -131,7 +131,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
         }
       }
       if (JSON.stringify(before) === "{}")
-        return message.warning("没有改变藏品的信息!");
+        return MessageFu.warning("没有改变藏品的信息!");
 
       const editData = {
         afterJson: after,
@@ -141,7 +141,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
 
       const res: any = await editObj2GoodsAPI(editData);
       if (res.code === 0) {
-        message.success("编辑成功!");
+        MessageFu.success("编辑成功!");
         // 通知父组件更新页面
         upInfoAPIFu();
         // 真正的删除 ----在藏品总账里面修改的时候不能删除
@@ -389,12 +389,12 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
       const type = ["image/jpeg", "image/png"];
       if (!type.includes(filesInfo.type)) {
         e.target.value = "";
-        return message.warning("只支持jpg、png格式!");
+        return MessageFu.warning("只支持jpg、png格式!");
       }
       // 校验大小
       if (filesInfo.size > 10 * 1024 * 1024) {
         e.target.value = "";
-        return message.warning("最大支持10M!");
+        return MessageFu.warning("最大支持10M!");
       }
       // 创建FormData对象
       const fd = new FormData();
@@ -407,7 +407,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
 
       const res: any = await object1AddUpFileAPI(fd);
       if (res.code === 0) {
-        message.success("上传成功!");
+        MessageFu.success("上传成功!");
         setCover(res.data.filePath);
       }
       UpAsyncLodingDom.style.opacity = 0;
@@ -454,7 +454,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
           // 校验格式
           if (!type.includes(filesInfo.type)) {
             e.target.value = "";
-            return message.warning(tit);
+            return MessageFu.warning(tit);
           }
         }
 
@@ -468,7 +468,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode, upInfoAPIFu }: Props) {
 
         const res: any = await object1AddUpFileAPI(fd);
         if (res.code === 0) {
-          message.success("上传成功!");
+          MessageFu.success("上传成功!");
           if (upFileFlagRef.current) {
             // 重新上传
             const id = upFileFlagRef.current;

+ 13 - 2
src/index.tsx

@@ -7,7 +7,13 @@ import { Provider } from "react-redux";
 import { createRoot } from "react-dom/client";
 
 import { ConfigProvider } from "antd";
-// import dayjs from "dayjs";
+
+// 兼容360浏览器
+import {
+  StyleProvider,
+  legacyLogicalPropertiesTransformer,
+} from "@ant-design/cssinjs";
+
 import "dayjs/locale/zh-cn";
 import locale from "antd/locale/zh_CN";
 
@@ -24,7 +30,12 @@ root.render(
     }}
   >
     <Provider store={store}>
-      <App />
+      <StyleProvider
+        hashPriority="high"
+        transformers={[legacyLogicalPropertiesTransformer]}
+      >
+        <App />
+      </StyleProvider>
     </Provider>
   </ConfigProvider>
 );

+ 2 - 1
src/pages/Home/index.tsx

@@ -13,6 +13,7 @@ import { getStores2API1 } from "@/store/action/stores1";
 import { getHomeNumsAPI } from "@/store/action/login";
 import { useSelector } from "react-redux";
 import { RootState } from "@/store";
+import { MessageFu } from "@/utils/message";
 
 echarts.use([TooltipComponent, GridComponent, BarChart, CanvasRenderer]);
 
@@ -67,7 +68,7 @@ export default function Home() {
 
   // 点击头部右侧和下面右侧
   const toPageFu = useCallback((path: string, flag: boolean) => {
-    if (flag) return message.warning("没有该模块权限!");
+    if (flag) return MessageFu.warning("没有该模块权限!");
     history.push(path);
   }, []);
 

+ 3 - 2
src/pages/Layout/index.tsx

@@ -17,6 +17,7 @@ import {
 } from "@/store/action/login";
 import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "@/store";
+import { MessageFu } from "@/utils/message";
 
 const NotFound = React.lazy(() => import("../../components/NotFound"));
 
@@ -138,14 +139,14 @@ function Layout() {
   const onFinish = async (values: any) => {
     // 通过校验之后发送请求
     if (values.oldPassword === values.newPassword)
-      return message.warning("新旧密码不能相同!");
+      return MessageFu.warning("新旧密码不能相同!");
     const obj = {
       oldPassword: encodeStr(Base64.encode(values.oldPassword)),
       newPassword: encodeStr(Base64.encode(values.newPassword)),
     };
     const res: any = await passWordEditAPI(obj);
     if (res.code === 0) {
-      message.success("修改成功!");
+      MessageFu.success("修改成功!");
       loginExit();
     }
   };

+ 5 - 4
src/pages/Login/index.tsx

@@ -1,6 +1,6 @@
 import styles from "./index.module.scss";
 
-import { Input, Button, message } from "antd";
+import { Input, Button } from "antd";
 import { UserOutlined, LockOutlined } from "@ant-design/icons";
 import { useEffect, useState } from "react";
 import { Base64 } from "js-base64";
@@ -9,6 +9,7 @@ import { userLoginAPI } from "@/store/action/login";
 import { setTokenInfo } from "@/utils/storage";
 import history from "@/utils/history";
 import { useDispatch } from "react-redux";
+import { MessageFu } from "@/utils/message";
 
 export default function Login() {
   const dispatch = useDispatch();
@@ -29,15 +30,15 @@ export default function Login() {
   // 点击登录
   const loginClickFu = async () => {
     // 非空判断
-    if (userName === "") return message.warning("请填写用户账号!");
-    else if (passWord === "") return message.warning("请填写登录密码!");
+    if (userName === "") return MessageFu.warning("请填写用户账号!");
+    else if (passWord === "") return MessageFu.warning("请填写登录密码!");
     const obj = {
       userName,
       passWord: encodeStr(Base64.encode(passWord)),
     };
     const res: any = await userLoginAPI(obj);
     if (res.code === 0) {
-      message.success("登录成功");
+      MessageFu.success("登录成功");
       // 用户信息存到本地
       setTokenInfo(res.data);
       history.push("/");

+ 6 - 5
src/pages/ObjectSon/Object1/AddObject1/index.tsx

@@ -1,6 +1,6 @@
 import BreadTit from "@/components/BreadTit";
 import history, { urlParameter } from "@/utils/history";
-import { Input, message, Select, Table, Popconfirm, Button } from "antd";
+import { Input, Select, Table, Popconfirm, Button } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -22,6 +22,7 @@ import {
   object1infoOutAPI,
 } from "@/store/action/object1";
 import _ from "lodash";
+import { MessageFu } from "@/utils/message";
 function AddObject1() {
   const dispatch = useDispatch();
 
@@ -88,7 +89,7 @@ function AddObject1() {
     console.log("多个删除", tableSelectList);
     const data = _.differenceBy(results, tableSelectList, "id");
     dispatch({ type: "login/setGoodsSonList", payload: data });
-    setTableSelectList(data)
+    setTableSelectList(data);
 
     // 删除的id存起来
     tableSelectList.forEach((v: any) => {
@@ -191,7 +192,7 @@ function AddObject1() {
   const submitFu = useCallback(
     async (val: number) => {
       if (results.length === 0)
-        return message.warning("至少需要添加一条藏品信息!");
+        return MessageFu.warning("至少需要添加一条藏品信息!");
       const obj = {
         ...addInfoTop,
         status: val,
@@ -202,11 +203,11 @@ function AddObject1() {
         if (delIds.current.length) {
           const res2: any = await delInTablesAPI(delIds.current.join(","));
           if (res2.code === 0) {
-            message.success("操作成功!");
+            MessageFu.success("操作成功!");
             cancelFu();
           }
         } else {
-          message.success("操作成功!");
+          MessageFu.success("操作成功!");
           cancelFu();
         }
       }

+ 4 - 3
src/pages/ObjectSon/Object1/AuditObject1/index.tsx

@@ -8,7 +8,8 @@ import {
 } from "@/store/action/object1";
 import { statusObj } from "@/utils/dataChange";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Select } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Select } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, { useCallback, useEffect, useRef, useState } from "react";
 import { useDispatch, useSelector } from "react-redux";
@@ -66,14 +67,14 @@ function AuditObject1() {
   // 点击确定
   const btnOkFu = async () => {
     const txt = value2.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("审核说明不能为空!");
+    if (txt === "") return MessageFu.warning("审核说明不能为空!");
     const res: any = await auditObject1API({
       id: Number(urlParamRef.current.id),
       reason: value2,
       status: value,
     });
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   };

+ 2 - 2
src/pages/ObjectSon/Object1/index.tsx

@@ -9,7 +9,6 @@ import {
   Table,
   Button,
   Popconfirm,
-  message,
 } from "antd";
 import AuthButton from "@/components/AuthButton";
 import history from "@/utils/history";
@@ -21,6 +20,7 @@ import {
   getObject1ListNum,
   object1DelAPI,
 } from "@/store/action/object1";
+import { MessageFu } from "@/utils/message";
 
 const { RangePicker } = DatePicker;
 
@@ -145,7 +145,7 @@ export default function Object1() {
   const delOne = async (id: number) => {
     const res: any = await object1DelAPI(id);
     if (res.code === 0) {
-      message.success("删除成功!");
+      MessageFu.success("删除成功!");
       getList();
       dispatch(getObject1ListNum());
     }

+ 8 - 5
src/pages/ObjectSon/Object2/LookObject2/index.tsx

@@ -4,7 +4,7 @@ import ImageLazy from "@/components/ImageLazy";
 import ObjectAdd from "@/components/ObjectAdd";
 import { RootState } from "@/store";
 import history, { urlParameter } from "@/utils/history";
-import { Button, Cascader, message, Modal, Select, Table } from "antd";
+import { Button, Cascader, Modal, Select, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -22,6 +22,7 @@ import classNames from "classnames";
 import { editObj2StoresAPI, getObj2InfoInAPI } from "@/store/action/object2";
 import { obj3InStorage, storageStatusObj } from "@/utils/dataChange";
 import { getStores1ListAPI } from "@/store/action/stores1";
+import { MessageFu } from "@/utils/message";
 
 function LookObject2() {
   const dispatch = useDispatch();
@@ -199,8 +200,8 @@ function LookObject2() {
   const moveBtnOk = useCallback(async () => {
     const oldLoc = info.storageAncestor;
     const newLoc = moveLoc.join(",");
-    if (!newLoc) return message.warning("请选择移库位置!");
-    if (oldLoc === newLoc) return message.warning("位置不能相同!");
+    if (!newLoc) return MessageFu.warning("请选择移库位置!");
+    if (oldLoc === newLoc) return MessageFu.warning("位置不能相同!");
     const obj = {
       beforeJson: { id: oldLoc, name: obj3InStorage(info.storageAncestor) },
       afterJson: { id: newLoc, name: moveLocRef.current },
@@ -209,7 +210,7 @@ function LookObject2() {
 
     const res: any = await editObj2StoresAPI(obj);
     if (res.code === 0) {
-      message.success("申请移库成功!");
+      MessageFu.success("申请移库成功!");
       // 更新页面
       getObj2InfoInAPIFu();
       setTitCut("");
@@ -270,7 +271,9 @@ function LookObject2() {
                   <>
                     <AuthButton
                       id={205}
-                      disabled={info.tempMove !== 0||info.storageStatus==='out'}
+                      disabled={
+                        info.tempMove !== 0 || info.storageStatus === "out"
+                      }
                       size="small"
                       type="primary"
                       onClick={() => titCutFu("2")}

+ 3 - 2
src/pages/ObjectSon/Object2/index.tsx

@@ -1,6 +1,6 @@
 import BreadTit from "@/components/BreadTit";
 import { RootState } from "@/store";
-import { Button, Input, message, Pagination, Select, Table } from "antd";
+import { Button, Input, Pagination, Select, Table } from "antd";
 import { useCallback, useEffect, useMemo, useRef, useState } from "react";
 import { useDispatch, useSelector } from "react-redux";
 import styles from "./index.module.scss";
@@ -15,6 +15,7 @@ import { getObject2List } from "@/store/action/object2";
 import http from "@/utils/http";
 import { Empty } from "antd";
 import { obj3InStorage } from "@/utils/dataChange";
+import { MessageFu } from "@/utils/message";
 const { Option } = Select;
 export default function Object2() {
   const dispatch = useDispatch();
@@ -184,7 +185,7 @@ export default function Object2() {
   // 点击导出
   const deriveFu = useCallback(async () => {
     if (results.list.length === 0)
-      return message.warning("当前搜索条件没有数据!");
+      return MessageFu.warning("当前搜索条件没有数据!");
     const name = dayjs(new Date()).format("YYYYMMDDHHmmss");
     const res = await http.post("cms/ledger/pageList", {
       ...tableSelect,

+ 7 - 6
src/pages/ObjectSon/Object3/AddObject3/GoodsAll.tsx

@@ -1,4 +1,4 @@
-import { Button, Input, message, Modal, Table } from "antd";
+import { Button, Input, Modal, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -12,6 +12,7 @@ import { getGoodsListAllAPI } from "@/store/action/object3";
 import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "@/store";
 import ImageLazy from "@/components/ImageLazy";
+import { MessageFu } from "@/utils/message";
 
 type Props = {
   colsePage: any;
@@ -93,15 +94,15 @@ function GoodsAll({ colsePage }: Props) {
   const btnOkFu = useCallback(() => {
     dispatch({
       type: "object3/getGoodsTableList",
-      payload: tableSelectList.map((v:any)=>{
+      payload: tableSelectList.map((v: any) => {
         return {
           ...v,
-          storageAncestor:'',
-          storageAncestorName:''
-        }
+          storageAncestor: "",
+          storageAncestorName: "",
+        };
       }),
     });
-    message.success("添加成功!");
+    MessageFu.success("添加成功!");
     colsePage();
   }, [colsePage, dispatch, tableSelectList]);
 

+ 6 - 5
src/pages/ObjectSon/Object3/AddObject3/index.tsx

@@ -1,7 +1,7 @@
 import BreadTit from "@/components/BreadTit";
 import { object3AddAPI, object3infoOutAPI } from "@/store/action/object3";
 import history, { urlParameter } from "@/utils/history";
-import { Button, Cascader, Input, message, Popconfirm, Table } from "antd";
+import { Button, Cascader, Input, Popconfirm, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -20,6 +20,7 @@ import GoodsAll from "./GoodsAll";
 import LookModal from "@/components/LookObjTable/LookModal";
 import { getStores1ListAPI } from "@/store/action/stores1";
 import { obj3InStorage } from "@/utils/dataChange";
+import { MessageFu } from "@/utils/message";
 function AddObject3() {
   const dispatch = useDispatch();
 
@@ -81,7 +82,7 @@ function AddObject3() {
         res.data.child.forEach((v: any) => {
           storesLocArr.current[v.id] = {
             ids: v.storageAncestor,
-            names:obj3InStorage(v.storageAncestor),
+            names: obj3InStorage(v.storageAncestor),
           };
         });
       }
@@ -112,10 +113,10 @@ function AddObject3() {
   // 点击提交
   const submitFu = useCallback(async () => {
     if (results.length === 0)
-      return message.warning("至少需要添加一条藏品信息!");
+      return MessageFu.warning("至少需要添加一条藏品信息!");
 
     const objLength = Object.keys(storesLocArr.current).length;
-    if (objLength < results.length) return message.warning("请选择藏品位置!");
+    if (objLength < results.length) return MessageFu.warning("请选择藏品位置!");
 
     const obj = {
       description: addInfoTop.description,
@@ -126,7 +127,7 @@ function AddObject3() {
 
     const res: any = await object3AddAPI(obj);
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [addInfoTop.description, addInfoTop.id, cancelFu, results]);

+ 4 - 3
src/pages/ObjectSon/Object3/AuditObject3/index.tsx

@@ -5,7 +5,8 @@ import { RootState } from "@/store";
 import { auditObject3API, object3infoOutAPI } from "@/store/action/object3";
 import { obj3InStorage, statusObj } from "@/utils/dataChange";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Select, Table } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Select, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -79,14 +80,14 @@ function AuditObject3() {
   // 点击确定
   const btnOkFu = useCallback(async () => {
     const txt = value2.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("审核说明不能为空!");
+    if (txt === "") return MessageFu.warning("审核说明不能为空!");
     const res: any = await auditObject3API({
       id: Number(urlParamRef.current.id),
       reason: value2,
       status: value,
     });
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [cancelFu, value, value2]);

+ 3 - 2
src/pages/ObjectSon/Object3/index.tsx

@@ -2,7 +2,7 @@ import BreadTit from "@/components/BreadTit";
 import classNames from "classnames";
 import { useEffect, useMemo, useRef, useState } from "react";
 import styles from "./index.module.scss";
-import { Input, DatePicker, Table, Button, Popconfirm, message } from "antd";
+import { Input, DatePicker, Table, Button, Popconfirm } from "antd";
 import AuthButton from "@/components/AuthButton";
 import history from "@/utils/history";
 import { useLocation } from "react-router-dom";
@@ -13,6 +13,7 @@ import {
   getObject3ListNum,
   object3DelAPI,
 } from "@/store/action/object3";
+import { MessageFu } from "@/utils/message";
 
 const { RangePicker } = DatePicker;
 
@@ -128,7 +129,7 @@ export default function Object3() {
   const delOne = async (id: number) => {
     const res: any = await object3DelAPI(id);
     if (res.code === 0) {
-      message.success("删除成功!");
+      MessageFu.success("删除成功!");
       getList();
       dispatch(getObject3ListNum());
     }

+ 7 - 6
src/pages/ObjectSon/Object4/AddObject4/GoodsAll.tsx

@@ -1,4 +1,4 @@
-import { Button, Input, message, Modal, Table } from "antd";
+import { Button, Input, Modal, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -11,7 +11,8 @@ import { getGoodsListAllAPI } from "@/store/action/object4";
 import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "@/store";
 import ImageLazy from "@/components/ImageLazy";
-import '../../Object3/AddObject3/GoodsAll.css'
+import "../../Object3/AddObject3/GoodsAll.css";
+import { MessageFu } from "@/utils/message";
 
 type Props = {
   colsePage: any;
@@ -93,14 +94,14 @@ function GoodsAll({ colsePage }: Props) {
   const btnOkFu = useCallback(() => {
     dispatch({
       type: "object4/getGoodsTableList",
-      payload: tableSelectList.map((v:any)=>{
+      payload: tableSelectList.map((v: any) => {
         return {
           ...v,
-          outLocation:'',
-        }
+          outLocation: "",
+        };
       }),
     });
-    message.success("添加成功!");
+    MessageFu.success("添加成功!");
     colsePage();
   }, [colsePage, dispatch, tableSelectList]);
 

+ 5 - 4
src/pages/ObjectSon/Object4/AddObject4/index.tsx

@@ -1,7 +1,7 @@
 import BreadTit from "@/components/BreadTit";
 import { object4AddAPI, object4infoOutAPI } from "@/store/action/object4";
 import history, { urlParameter } from "@/utils/history";
-import { Button, Input, message, Popconfirm, Select, Table } from "antd";
+import { Button, Input, Popconfirm, Select, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -18,6 +18,7 @@ import { RootState } from "@/store";
 import ImageLazy from "@/components/ImageLazy";
 import GoodsAll from "./GoodsAll";
 import LookModal from "@/components/LookObjTable/LookModal";
+import { MessageFu } from "@/utils/message";
 function AddObject4() {
   const dispatch = useDispatch();
 
@@ -104,10 +105,10 @@ function AddObject4() {
   // 点击提交
   const submitFu = useCallback(async () => {
     if (results.length === 0)
-      return message.warning("至少需要添加一条藏品信息!");
+      return MessageFu.warning("至少需要添加一条藏品信息!");
 
     const objLength = Object.keys(inputInfoRef.current).length;
-    if (objLength < results.length) return message.warning("请输入出库位置!");
+    if (objLength < results.length) return MessageFu.warning("请输入出库位置!");
 
     const obj = {
       description: addInfoTop.description,
@@ -119,7 +120,7 @@ function AddObject4() {
 
     const res: any = await object4AddAPI(obj);
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [

+ 4 - 3
src/pages/ObjectSon/Object4/AuditObject4/index.tsx

@@ -5,7 +5,8 @@ import { RootState } from "@/store";
 import { auditObject4API, object4infoOutAPI } from "@/store/action/object4";
 import { statusObj } from "@/utils/dataChange";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Select, Table } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Select, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -79,14 +80,14 @@ function AuditObject4() {
   // 点击确定
   const btnOkFu = useCallback(async () => {
     const txt = value2.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("审核说明不能为空!");
+    if (txt === "") return MessageFu.warning("审核说明不能为空!");
     const res: any = await auditObject4API({
       id: Number(urlParamRef.current.id),
       reason: value2,
       status: value,
     });
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [cancelFu, value, value2]);

+ 3 - 2
src/pages/ObjectSon/Object4/LookObject4/index.tsx

@@ -6,7 +6,8 @@ import { RootState } from "@/store";
 import { object4infoOutAPI, returnObject4API } from "@/store/action/object4";
 import { statusObjCK2 } from "@/utils/dataChange";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Popconfirm, Table } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Popconfirm, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -146,7 +147,7 @@ function LookObject4() {
     };
     const res: any = await returnObject4API(obj);
     if (res.code === 0) {
-      message.success("归还成功!");
+      MessageFu.success("归还成功!");
       // 清空表格选中状态和数据
       setTableSelectList([]);
       getInfo();

+ 3 - 2
src/pages/ObjectSon/Object4/index.tsx

@@ -2,7 +2,7 @@ import BreadTit from "@/components/BreadTit";
 import classNames from "classnames";
 import { useEffect, useMemo, useRef, useState } from "react";
 import styles from "./index.module.scss";
-import { Input, DatePicker, Table, Button, Popconfirm, message } from "antd";
+import { Input, DatePicker, Table, Button, Popconfirm } from "antd";
 import AuthButton from "@/components/AuthButton";
 import history from "@/utils/history";
 import { useLocation } from "react-router-dom";
@@ -13,6 +13,7 @@ import {
   getObject4ListNum,
   object4DelAPI,
 } from "@/store/action/object4";
+import { MessageFu } from "@/utils/message";
 
 const { RangePicker } = DatePicker;
 
@@ -128,7 +129,7 @@ export default function Object4() {
   const delOne = async (id: number) => {
     const res: any = await object4DelAPI(id);
     if (res.code === 0) {
-      message.success("删除成功!");
+      MessageFu.success("删除成功!");
       getList();
       dispatch(getObject4ListNum());
     }

+ 4 - 3
src/pages/ObjectSon/Object5/AuditObject5/index.tsx

@@ -5,7 +5,8 @@ import { RootState } from "@/store";
 import { auditObject5API, object5infoOutAPI } from "@/store/action/object5";
 import { goodsChangeObj, statusObj } from "@/utils/dataChange";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Select, Table } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Select, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -110,14 +111,14 @@ function AuditObject5() {
   // 点击确定
   const btnOkFu = useCallback(async () => {
     const txt = value2.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("审核说明不能为空!");
+    if (txt === "") return MessageFu.warning("审核说明不能为空!");
     const res: any = await auditObject5API({
       id: Number(urlParamRef.current.id),
       reason: value2,
       status: value,
     });
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [cancelFu, value, value2]);

+ 3 - 2
src/pages/ObjectSon/Object5/index.tsx

@@ -2,7 +2,7 @@ import BreadTit from "@/components/BreadTit";
 import classNames from "classnames";
 import { useEffect, useMemo, useRef, useState } from "react";
 import styles from "./index.module.scss";
-import { Input, DatePicker, Table, Button, Popconfirm, message } from "antd";
+import { Input, DatePicker, Table, Button, Popconfirm } from "antd";
 import AuthButton from "@/components/AuthButton";
 import history from "@/utils/history";
 import { useLocation } from "react-router-dom";
@@ -13,6 +13,7 @@ import {
   getObject5ListNum,
   object5DelAPI,
 } from "@/store/action/object5";
+import { MessageFu } from "@/utils/message";
 
 const { RangePicker } = DatePicker;
 
@@ -126,7 +127,7 @@ export default function Object5() {
   const delOne = async (id: number) => {
     const res: any = await object5DelAPI(id);
     if (res.code === 0) {
-      message.success("删除成功!");
+      MessageFu.success("删除成功!");
       getList();
       dispatch(getObject5ListNum());
     }

+ 7 - 6
src/pages/ObjectSon/Object6/AddObject6/GoodsAll.tsx

@@ -1,4 +1,4 @@
-import { Button, Input, message, Modal, Table } from "antd";
+import { Button, Input, Modal, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -12,6 +12,7 @@ import { getGoodsListAllAPI } from "@/store/action/object6";
 import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "@/store";
 import ImageLazy from "@/components/ImageLazy";
+import { MessageFu } from "@/utils/message";
 
 type Props = {
   colsePage: any;
@@ -93,15 +94,15 @@ function GoodsAll({ colsePage }: Props) {
   const btnOkFu = useCallback(() => {
     dispatch({
       type: "object6/getGoodsTableList",
-      payload: tableSelectList.map((v:any)=>{
+      payload: tableSelectList.map((v: any) => {
         return {
           ...v,
-          storageAncestor:'',
-          storageAncestorName:''
-        }
+          storageAncestor: "",
+          storageAncestorName: "",
+        };
       }),
     });
-    message.success("添加成功!");
+    MessageFu.success("添加成功!");
     colsePage();
   }, [colsePage, dispatch, tableSelectList]);
 

+ 4 - 3
src/pages/ObjectSon/Object6/AddObject6/index.tsx

@@ -1,7 +1,7 @@
 import BreadTit from "@/components/BreadTit";
 import { object6AddAPI, object6infoOutAPI } from "@/store/action/object6";
 import history, { urlParameter } from "@/utils/history";
-import { Button, Input, message, Popconfirm, Table } from "antd";
+import { Button, Input, Popconfirm, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -18,6 +18,7 @@ import { RootState } from "@/store";
 import ImageLazy from "@/components/ImageLazy";
 import GoodsAll from "./GoodsAll";
 import LookModal from "@/components/LookObjTable/LookModal";
+import { MessageFu } from "@/utils/message";
 function AddObject6() {
   const dispatch = useDispatch();
 
@@ -77,7 +78,7 @@ function AddObject6() {
   // 点击提交
   const submitFu = useCallback(async () => {
     if (results.length === 0)
-      return message.warning("至少需要添加一条藏品信息!");
+      return MessageFu.warning("至少需要添加一条藏品信息!");
 
     const obj = {
       description: addInfoTop.description,
@@ -87,7 +88,7 @@ function AddObject6() {
 
     const res: any = await object6AddAPI(obj);
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [addInfoTop.description, addInfoTop.id, cancelFu, results]);

+ 4 - 3
src/pages/ObjectSon/Object6/AuditObject6/index.tsx

@@ -5,7 +5,8 @@ import { RootState } from "@/store";
 import { auditObject6API, object6infoOutAPI } from "@/store/action/object6";
 import { statusObj } from "@/utils/dataChange";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Select, Table } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Select, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -79,14 +80,14 @@ function AuditObject6() {
   // 点击确定
   const btnOkFu = useCallback(async () => {
     const txt = value2.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("审核说明不能为空!");
+    if (txt === "") return MessageFu.warning("审核说明不能为空!");
     const res: any = await auditObject6API({
       id: Number(urlParamRef.current.id),
       reason: value2,
       status: value,
     });
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [cancelFu, value, value2]);

+ 3 - 2
src/pages/ObjectSon/Object6/index.tsx

@@ -2,7 +2,7 @@ import BreadTit from "@/components/BreadTit";
 import classNames from "classnames";
 import { useEffect, useMemo, useRef, useState } from "react";
 import styles from "./index.module.scss";
-import { Input, DatePicker, Table, Button, Popconfirm, message } from "antd";
+import { Input, DatePicker, Table, Button, Popconfirm } from "antd";
 import AuthButton from "@/components/AuthButton";
 import history from "@/utils/history";
 import { useLocation } from "react-router-dom";
@@ -13,6 +13,7 @@ import {
   getObject6ListNum,
   object6DelAPI,
 } from "@/store/action/object6";
+import { MessageFu } from "@/utils/message";
 
 const { RangePicker } = DatePicker;
 
@@ -128,7 +129,7 @@ export default function Object6() {
   const delOne = async (id: number) => {
     const res: any = await object6DelAPI(id);
     if (res.code === 0) {
-      message.success("删除成功!");
+      MessageFu.success("删除成功!");
       getList();
       dispatch(getObject6ListNum());
     }

+ 6 - 5
src/pages/StoresSon/Stores1/index.tsx

@@ -1,5 +1,5 @@
 import BreadTit from "@/components/BreadTit";
-import { Button, Input, message, Modal, Popconfirm, Table } from "antd";
+import { Button, Input, Modal, Popconfirm, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -27,6 +27,7 @@ import {
 import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "@/store";
 import AuthButton from "@/components/AuthButton";
+import { MessageFu } from "@/utils/message";
 
 function Stores1() {
   const powerInfo = useSelector(
@@ -57,7 +58,7 @@ function Stores1() {
     async (id: number) => {
       const res: any = await stores1DelAPI(id);
       if (res.code === 0) {
-        message.success("删除成功!");
+        MessageFu.success("删除成功!");
         getStores1ListAPIFu();
       }
     },
@@ -123,9 +124,9 @@ function Stores1() {
 
   // 点击提交
   const btnOk = useCallback(async () => {
-    if (val1 === "") return message.warning("不能为空!");
+    if (val1 === "") return MessageFu.warning("不能为空!");
     if (addType.current !== "1" && val2 === "")
-      return message.warning("不能为空!");
+      return MessageFu.warning("不能为空!");
     const obj = {
       name: val1,
       num: val2 ? val2 : "",
@@ -138,7 +139,7 @@ function Stores1() {
     if (editIdRef.current) obj.id = editIdRef.current;
     const res: any = await stores1AddAPI(obj);
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       getStores1ListAPIFu();
       setOpen(false);
     }

+ 3 - 2
src/pages/StoresSon/Stores2/index.tsx

@@ -18,7 +18,7 @@ import {
 import { PieChart } from "echarts/charts";
 import { LabelLayout } from "echarts/features";
 import { CanvasRenderer } from "echarts/renderers";
-import { Button, message, Table } from "antd";
+import { Button, Table } from "antd";
 import {
   getStores2API1,
   getStores2API2,
@@ -26,6 +26,7 @@ import {
   getStores2API4,
 } from "@/store/action/stores1";
 import ExportJsonExcel from "js-export-excel";
+import { MessageFu } from "@/utils/message";
 
 echarts.use([
   TitleComponent,
@@ -160,7 +161,7 @@ function Stores2() {
   // 点击导出
   const deriveFu = useCallback((ref: string, name: string) => {
     const data = dataRef.current[ref];
-    if (data && data.length === 0) return message.warning("当前没有数据!");
+    if (data && data.length === 0) return MessageFu.warning("当前没有数据!");
     const option = {
       fileName: name,
       datas: [

+ 4 - 3
src/pages/StoresSon/Stores3/AuditStores3/index.tsx

@@ -3,7 +3,8 @@ import LookModal from "@/components/LookObjTable/LookModal";
 import { RootState } from "@/store";
 import { auditStores3API, stores3infoOutAPI } from "@/store/action/stores3";
 import history, { urlParameter } from "@/utils/history";
-import { Button, message, Select, Table } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Select, Table } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import React, {
   useCallback,
@@ -86,14 +87,14 @@ function AuditStores3() {
   // 点击确定
   const btnOkFu = useCallback(async () => {
     const txt = value2.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("审核说明不能为空!");
+    if (txt === "") return MessageFu.warning("审核说明不能为空!");
     const res: any = await auditStores3API({
       id: Number(urlParamRef.current.id),
       reason: value2,
       status: value,
     });
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       cancelFu();
     }
   }, [cancelFu, value, value2]);

+ 3 - 2
src/pages/StoresSon/Stores3/index.tsx

@@ -2,7 +2,7 @@ import BreadTit from "@/components/BreadTit";
 import classNames from "classnames";
 import { useEffect, useMemo, useRef, useState } from "react";
 import styles from "./index.module.scss";
-import { Input, DatePicker, Table, Button, Popconfirm, message } from "antd";
+import { Input, DatePicker, Table, Button, Popconfirm } from "antd";
 import AuthButton from "@/components/AuthButton";
 import history from "@/utils/history";
 import { useLocation } from "react-router-dom";
@@ -13,6 +13,7 @@ import {
   getStores3ListNum,
   stores3DelAPI,
 } from "@/store/action/stores3";
+import { MessageFu } from "@/utils/message";
 
 const { RangePicker } = DatePicker;
 
@@ -126,7 +127,7 @@ export default function Stores3() {
   const delOne = async (id: number) => {
     const res: any = await stores3DelAPI(id);
     if (res.code === 0) {
-      message.success("删除成功!");
+      MessageFu.success("删除成功!");
       getList();
       dispatch(getStores3ListNum());
     }

+ 6 - 5
src/pages/SystemSon/System1/UserModal.tsx

@@ -4,7 +4,8 @@ import {
   getUserInfoAPI,
   userGetRoleAPI,
 } from "@/store/action/system";
-import { Button, Input, message, Modal, Select } from "antd";
+import { MessageFu } from "@/utils/message";
+import { Button, Input, Modal, Select } from "antd";
 import React, { useCallback, useEffect, useState } from "react";
 import { useDispatch, useSelector } from "react-redux";
 
@@ -64,10 +65,10 @@ function UserModal({ id, closeFu, btnOkSuccFu }: Props) {
 
   // 点击提交
   const btnOkFu = useCallback(async () => {
-    if (userName.length <= 4) return message.warning("用户账号长度为4-15位!");
+    if (userName.length <= 4) return MessageFu.warning("用户账号长度为4-15位!");
     var reg: any = new RegExp(/^1[3-9]\d{9}$/);
-    if (!reg.test(phone)) return message.warning("请输入正确格式的手机号!");
-    if (realName === "") return message.warning("真实姓名不能为空!");
+    if (!reg.test(phone)) return MessageFu.warning("请输入正确格式的手机号!");
+    if (realName === "") return MessageFu.warning("真实姓名不能为空!");
     const obj = {
       ...userInfo,
       phone,
@@ -77,7 +78,7 @@ function UserModal({ id, closeFu, btnOkSuccFu }: Props) {
     };
     const res: any = await addUserAPI(obj);
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       btnOkSuccFu();
     }
   }, [btnOkSuccFu, phone, realName, roleId, userInfo, userName]);

+ 4 - 3
src/pages/SystemSon/System1/index.tsx

@@ -6,7 +6,7 @@ import {
   userEditStatusAPI,
   userResetPassAPI,
 } from "@/store/action/system";
-import { Button, Input, message, Popconfirm, Switch, Table } from "antd";
+import { Button, Input, Popconfirm, Switch, Table } from "antd";
 import React, {
   useCallback,
   useEffect,
@@ -18,6 +18,7 @@ import { useDispatch, useSelector } from "react-redux";
 import styles from "./index.module.scss";
 import "./index.css";
 import UserModal from "./UserModal";
+import { MessageFu } from "@/utils/message";
 function System1() {
   const dispatch = useDispatch();
 
@@ -57,7 +58,7 @@ function System1() {
     async (id: number) => {
       const res: any = await delUserAPI(id);
       if (res.code === 0) {
-        message.success("删除成功!");
+        MessageFu.success("删除成功!");
         // 重新发请求更新页面
         dispatch(getUserListAPI(tableSelect));
       }
@@ -68,7 +69,7 @@ function System1() {
   // 点击重置按钮
   const resetPassFu = useCallback(async (id: number) => {
     const res: any = await userResetPassAPI(id);
-    if (res.code === 0) message.success("重置成功!");
+    if (res.code === 0) MessageFu.success("重置成功!");
   }, []);
 
   // ---------关于表格

+ 5 - 5
src/pages/SystemSon/System2/index.tsx

@@ -11,7 +11,6 @@ import {
   Button,
   Checkbox,
   Input,
-  message,
   Modal,
   Popconfirm,
   Switch,
@@ -29,6 +28,7 @@ import { useDispatch, useSelector } from "react-redux";
 import styles from "./index.module.scss";
 import classNames from "classnames";
 import "../System1/index.css";
+import { MessageFu } from "@/utils/message";
 
 function System2() {
   const dispatch = useDispatch();
@@ -169,7 +169,7 @@ function System2() {
     async (id: number) => {
       const res: any = await delRoleAPI(id);
       if (res.code === 0) {
-        message.success("删除成功!");
+        MessageFu.success("删除成功!");
         // 重新发请求更新页面
         dispatch(getRoleListAPI(tableSelect));
       }
@@ -291,9 +291,9 @@ function System2() {
 
   // 点击提交
   const btnOkFu = useCallback(async () => {
-    if (roleName === "") return message.warning("角色名称不能为空!");
+    if (roleName === "") return MessageFu.warning("角色名称不能为空!");
     const txt = roleDesc.replaceAll(" ", "").replaceAll("\n", "");
-    if (txt === "") return message.warning("描述不能为空!");
+    if (txt === "") return MessageFu.warning("描述不能为空!");
     const resources = [] as any;
     roleArr.forEach((v: any) => {
       if (v.authority) resources.push(v.id);
@@ -309,7 +309,7 @@ function System2() {
     };
     const res: any = await addRoleAPI(obj);
     if (res.code === 0) {
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       setOpen(false);
       // 重新发请求更新页面
       dispatch(getRoleListAPI(tableSelect));

+ 3 - 3
src/store/action/object1.ts

@@ -1,6 +1,6 @@
 import { statusObj } from "@/utils/dataChange";
 import http from "@/utils/http";
-import { message } from "antd";
+import { MessageFu } from "@/utils/message";
 import store, { AppDispatch } from "..";
 
 /**
@@ -22,7 +22,7 @@ export const object1AddUpFileAPI = (data: any) => {
   UpAsyncLodingDom.style.opacity = 1;
 
   return http.post("cms/register/goods/file/upload", data, {
-    timeout:30000,
+    timeout: 30000,
     // 显示进度条
     onUploadProgress: (e: any) => {
       const complete = (e.loaded / e.total) * 100 || 0;
@@ -40,7 +40,7 @@ export const goodsSonAddAPI = (data: any, id: any) => {
 
     if (res.code === 0) {
       const oldData = store.getState().loginStore.goodsTableList;
-      message.success("操作成功!");
+      MessageFu.success("操作成功!");
       let newData;
       if (id) {
         // 是编辑 覆盖之前的数据

+ 13 - 1
src/store/reducer/login.ts

@@ -1,3 +1,5 @@
+import { MessageType } from "@/utils/message";
+
 // 初始化状态应用注解
 const initState = {
   // 所有下拉数据
@@ -34,6 +36,12 @@ const initState = {
   },
   // 加载请求的loding
   asyncLoding: false,
+  // antd轻提示(兼容360浏览器)
+  message: {
+    txt: "",
+    type: "info",
+    duration: 3,
+  } as MessageType,
 };
 
 type LoginActionType =
@@ -43,7 +51,8 @@ type LoginActionType =
   | { type: "login/setAuthButtonArr"; payload: any }
   | { type: "login/setAuthPageArr"; payload: any }
   | { type: "login/lookBigImg"; payload: any }
-  | { type: "login/asyncLoding"; payload: any };
+  | { type: "login/asyncLoding"; payload: any }
+  | { type: "login/message"; payload: MessageType };
 // 频道 reducer
 export default function loginReducer(
   state = initState,
@@ -71,6 +80,9 @@ export default function loginReducer(
     // 加载请求的loding
     case "login/asyncLoding":
       return { ...state, asyncLoding: action.payload };
+    // antd轻提示(兼容360浏览器)
+    case "login/message":
+      return { ...state, message: action.payload };
     default:
       return state;
   }

+ 7 - 7
src/utils/http.ts

@@ -1,8 +1,8 @@
 import axios from "axios";
 import history from "./history";
 import { getTokenInfo, removeTokenInfo } from "./storage";
-import { message } from "antd";
 import store from "@/store";
+import { MessageFu } from "./message";
 // 请求基地址
 export const baseURL =
   // 线下的图片地址需要加上/api/
@@ -54,14 +54,14 @@ http.interceptors.response.use(
       clearTimeout(timeId);
       timeId = window.setTimeout(() => {
         removeTokenInfo();
-        message.warning("登录失效!");
+        MessageFu.warning("登录失效!");
         history.push("/login");
       }, 200);
     } else if (response.data.code === 0) {
-      // message.success(response.data.msg);
+      // MessageFu.success(response.data.msg);
     } else if (response.data.code === 3014)
-      message.warning("用户名或密码不正确!");
-    else message.warning(response.data.msg);
+      MessageFu.warning("用户名或密码不正确!");
+    else MessageFu.warning(response.data.msg);
     return response.data;
   },
   async function (err) {
@@ -73,9 +73,9 @@ http.interceptors.response.use(
 
     // 如果因为网络原因,response没有,给提示消息
     if (!err.response) {
-      message.warning("网络繁忙,请稍后重试!");
+      MessageFu.warning("网络繁忙,请稍后重试!");
     } else {
-      message.warning("错误!");
+      MessageFu.warning("错误!");
     }
     // 响应错误也要取消 上传文件的进度条
     UpAsyncLodingDom.style.opacity = 0;

+ 50 - 0
src/utils/message.ts

@@ -0,0 +1,50 @@
+import store from "@/store";
+
+export type MessageType = {
+  txt: string;
+  type: "info" | "success" | "error" | "warning";
+  duration: number;
+};
+
+export const MessageFu = {
+  info: (txt: string, duration?: number) => {
+    store.dispatch({
+      type: "login/message",
+      payload: {
+        txt,
+        type: "info",
+        duration: duration === undefined ? 3 : duration,
+      },
+    });
+  },
+  success: (txt: string, duration?: number) => {
+    store.dispatch({
+      type: "login/message",
+      payload: {
+        txt,
+        type: "success",
+        duration: duration === undefined ? 3 : duration,
+      },
+    });
+  },
+  error: (txt: string, duration?: number) => {
+    store.dispatch({
+      type: "login/message",
+      payload: {
+        txt,
+        type: "error",
+        duration: duration === undefined ? 3 : duration,
+      },
+    });
+  },
+  warning: (txt: string, duration?: number) => {
+    store.dispatch({
+      type: "login/message",
+      payload: {
+        txt,
+        type: "warning",
+        duration: duration === undefined ? 3 : duration,
+      },
+    });
+  },
+};