outaozhen hace 5 años
padre
commit
10bac85e1a
Se han modificado 95 ficheros con 1071 adiciones y 1040 borrados
  1. 9 9
      .eslintrc.js
  2. 7 6
      .prettierrc.js
  3. 14 2
      .stylelintrc.js
  4. 2 2
      package.json
  5. 9 9
      src/components/Authorized/Authorized.jsx
  6. 6 6
      src/components/Authorized/AuthorizedRoute.jsx
  7. 20 20
      src/components/Authorized/CheckPermissions.jsx
  8. 26 26
      src/components/Authorized/PromiseRender.jsx
  9. 21 21
      src/components/Authorized/Secured.jsx
  10. 8 8
      src/components/Authorized/index.jsx
  11. 8 8
      src/components/Authorized/renderAuthorize.js
  12. 20 20
      src/components/GlobalHeader/AvatarDropdown.jsx
  13. 43 43
      src/components/GlobalHeader/NoticeIconView.jsx
  14. 16 16
      src/components/GlobalHeader/RightContent.jsx
  15. 6 6
      src/components/HeaderDropdown/index.jsx
  16. 26 26
      src/components/HeaderSearch/index.jsx
  17. 14 14
      src/components/NoticeIcon/NoticeList.jsx
  18. 41 41
      src/components/NoticeIcon/index.jsx
  19. 2 2
      src/components/PageLoading/index.jsx
  20. 37 37
      src/components/PopContactForm/index.jsx
  21. 8 0
      src/components/SvgIcon/index.jsx
  22. 12 0
      src/components/SvgIcon/index.less
  23. 1 1
      src/e2e/__mocks__/antd-pro-merge-less.js
  24. 33 33
      src/e2e/baseLayout.e2e.js
  25. 43 43
      src/global.jsx
  26. 42 42
      src/layouts/BasicLayout.jsx
  27. 3 3
      src/layouts/BlankLayout.jsx
  28. 20 20
      src/layouts/SecurityLayout.jsx
  29. 20 20
      src/layouts/UserLayout.jsx
  30. 9 9
      src/locales/en-US.js
  31. 2 2
      src/locales/en-US/component.js
  32. 2 2
      src/locales/en-US/globalHeader.js
  33. 2 2
      src/locales/en-US/menu.js
  34. 2 2
      src/locales/en-US/pages.js
  35. 2 2
      src/locales/en-US/pwa.js
  36. 2 2
      src/locales/en-US/settingDrawer.js
  37. 2 2
      src/locales/en-US/settings.js
  38. 8 8
      src/locales/id-ID.js
  39. 2 2
      src/locales/id-ID/component.js
  40. 2 2
      src/locales/id-ID/globalHeader.js
  41. 2 2
      src/locales/id-ID/menu.js
  42. 2 2
      src/locales/id-ID/pwa.js
  43. 2 2
      src/locales/id-ID/settingDrawer.js
  44. 2 2
      src/locales/id-ID/settings.js
  45. 8 8
      src/locales/pt-BR.js
  46. 2 2
      src/locales/pt-BR/component.js
  47. 2 2
      src/locales/pt-BR/globalHeader.js
  48. 2 2
      src/locales/pt-BR/menu.js
  49. 2 2
      src/locales/pt-BR/pwa.js
  50. 2 2
      src/locales/pt-BR/settingDrawer.js
  51. 2 2
      src/locales/pt-BR/settings.js
  52. 9 9
      src/locales/zh-CN.js
  53. 2 2
      src/locales/zh-CN/component.js
  54. 2 2
      src/locales/zh-CN/globalHeader.js
  55. 2 2
      src/locales/zh-CN/menu.js
  56. 2 2
      src/locales/zh-CN/pages.js
  57. 2 2
      src/locales/zh-CN/pwa.js
  58. 2 2
      src/locales/zh-CN/settingDrawer.js
  59. 2 2
      src/locales/zh-CN/settings.js
  60. 8 8
      src/locales/zh-TW.js
  61. 2 2
      src/locales/zh-TW/component.js
  62. 2 2
      src/locales/zh-TW/globalHeader.js
  63. 2 2
      src/locales/zh-TW/menu.js
  64. 2 2
      src/locales/zh-TW/pwa.js
  65. 2 2
      src/locales/zh-TW/settingDrawer.js
  66. 2 2
      src/locales/zh-TW/settings.js
  67. 11 11
      src/models/contact.js
  68. 42 42
      src/models/global.js
  69. 31 31
      src/models/login.js
  70. 12 12
      src/models/setting.js
  71. 19 19
      src/models/user.js
  72. 5 5
      src/pages/404.jsx
  73. 8 8
      src/pages/Admin.jsx
  74. 5 6
      src/pages/Customer/company.jsx
  75. 19 19
      src/pages/Customer/contact.jsx
  76. 6 6
      src/pages/ListTableList/components/CreateForm.jsx
  77. 24 24
      src/pages/ListTableList/components/UpdateForm.jsx
  78. 90 90
      src/pages/ListTableList/index.jsx
  79. 9 9
      src/pages/ListTableList/service.js
  80. 4 4
      src/pages/Product/Cloud/build.jsx
  81. 3 3
      src/pages/Product/Cloud/curing.jsx
  82. 5 5
      src/pages/Product/Lock/lockcount.jsx
  83. 5 5
      src/pages/Product/Lock/lockstore.jsx
  84. 8 8
      src/pages/Welcome.jsx
  85. 5 5
      src/pages/Workbench/workbench.jsx
  86. 33 33
      src/pages/user/login/index.jsx
  87. 19 19
      src/service-worker.js
  88. 2 2
      src/services/contact.js
  89. 3 4
      src/services/login.js
  90. 4 4
      src/services/user.js
  91. 8 8
      src/utils/Authorized.js
  92. 11 11
      src/utils/authority.js
  93. 16 16
      src/utils/request.js
  94. 11 11
      src/utils/utils.js
  95. 30 30
      src/utils/utils.test.js

+ 9 - 9
.eslintrc.js

@@ -4,14 +4,14 @@ module.exports = {
     ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
     ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
     page: true,
     page: true,
     REACT_APP_ENV: true
     REACT_APP_ENV: true
+  },
+  rules: {
+    'semi': ['error', 'never'],
+    'no-multiple-empty-lines': [1, { max: 2 }], // 空行最多不能超过2行
+    'comma-dangle': [2, 'never'],
+    'react/prop-types': 0,
+    'spaced-comment': 'error', // 注释前面必须有空格
+    'array-bracket-spacing': ['error', 'always'],
+    'object-curly-spacing': ['error', 'always']
   }
   }
-  // rules: {
-  //   "semi": ["error", "never"],
-  // "no-multiple-empty-lines": [1, { "max": 2 }], //空行最多不能超过2行
-  // "comma-dangle": [2, "never"],
-  // "react/prop-types": 0,
-  // "array-bracket-spacing": ["error", "always"],
-  // "object-curly-spacing": ["error", "always"],
-  // "react-hooks/rules-of-hooks": "error"
-  // }
 }
 }

+ 7 - 6
.prettierrc.js

@@ -1,13 +1,14 @@
-const fabric = require('@umijs/fabric');
+const fabric = require("@umijs/fabric")
 
 
 module.exports = {
 module.exports = {
   ...fabric.prettier,
   ...fabric.prettier,
-  'prettier.eslintIntegration': true,
   eslintIntegration: true,
   eslintIntegration: true,
   stylelintIntegration: true,
   stylelintIntegration: true,
   semi: false,
   semi: false,
-  quoteProps: 'consistent',
-  htmlWhitespaceSensitivity: 'ignore',
-  arrowParens: 'avoid',
+  quoteProps: "consistent",
+  htmlWhitespaceSensitivity: "ignore",
   jsxBracketSameLine: true,
   jsxBracketSameLine: true,
-};
+  trailingComma: "none",
+  bracketSpacing: true,
+  arrowParens: "avoid"
+}

+ 14 - 2
.stylelintrc.js

@@ -1,5 +1,17 @@
-const fabric = require('@umijs/fabric');
+const fabric = require('@umijs/fabric')
 
 
 module.exports = {
 module.exports = {
   ...fabric.stylelint,
   ...fabric.stylelint,
-};
+  'indentation': 2,
+  'block-no-empty': null,
+  'color-no-invalid-hex': true,
+  'declaration-colon-space-after': 'always',
+  'max-empty-lines': 2,
+  'rule-empty-line-before': null,
+  'unit-no-unknown': null,
+  'unit-whitelist': ['px', 'em', 'rem', 's', '%', 'vw', 'vh', 'deg'],
+  'selector-max-compound-selectors': 5,
+  'color-hex-length': 'long',
+  'at-rule-no-unknown': null,
+  'selector-pseudo-class-no-unknown': [true, { ignorePseudoClasses: ['global'] }],
+}

+ 2 - 2
package.json

@@ -88,7 +88,7 @@
     "cross-port-killer": "^1.1.1",
     "cross-port-killer": "^1.1.1",
     "detect-installer": "^1.0.1",
     "detect-installer": "^1.0.1",
     "enzyme": "^3.11.0",
     "enzyme": "^3.11.0",
-    "eslint": "^7.1.0",
+    "eslint": "^7.18.0",
     "express": "^4.17.1",
     "express": "^4.17.1",
     "gh-pages": "^3.0.0",
     "gh-pages": "^3.0.0",
     "jsdom-global": "^3.0.2",
     "jsdom-global": "^3.0.2",
@@ -97,7 +97,7 @@
     "prettier": "^2.2.1",
     "prettier": "^2.2.1",
     "pro-download": "1.0.1",
     "pro-download": "1.0.1",
     "puppeteer-core": "^5.0.0",
     "puppeteer-core": "^5.0.0",
-    "stylelint": "^13.0.0",
+    "stylelint": "^13.9.0",
     "typescript": "^4.0.3"
     "typescript": "^4.0.3"
   },
   },
   "engines": {
   "engines": {

+ 9 - 9
src/components/Authorized/Authorized.jsx

@@ -1,6 +1,6 @@
-import React from 'react';
-import { Result } from 'antd';
-import check from './CheckPermissions';
+import React from 'react'
+import { Result } from 'antd'
+import check from './CheckPermissions'
 
 
 const Authorized = ({
 const Authorized = ({
   children,
   children,
@@ -11,11 +11,11 @@ const Authorized = ({
       title="403"
       title="403"
       subTitle="Sorry, you are not authorized to access this page."
       subTitle="Sorry, you are not authorized to access this page."
     />
     />
-  ),
+  )
 }) => {
 }) => {
-  const childrenRender = typeof children === 'undefined' ? null : children;
-  const dom = check(authority, childrenRender, noMatch);
-  return <>{dom}</>;
-};
+  const childrenRender = typeof children === 'undefined' ? null : children
+  const dom = check(authority, childrenRender, noMatch)
+  return <>{dom}</>
+}
 
 
-export default Authorized;
+export default Authorized

+ 6 - 6
src/components/Authorized/AuthorizedRoute.jsx

@@ -1,6 +1,6 @@
-import { Redirect, Route } from 'umi';
-import React from 'react';
-import Authorized from './Authorized';
+import { Redirect, Route } from 'umi'
+import React from 'react'
+import Authorized from './Authorized'
 
 
 const AuthorizedRoute = ({ component: Component, render, authority, redirectPath, ...rest }) => (
 const AuthorizedRoute = ({ component: Component, render, authority, redirectPath, ...rest }) => (
   <Authorized
   <Authorized
@@ -11,7 +11,7 @@ const AuthorizedRoute = ({ component: Component, render, authority, redirectPath
         render={() => (
         render={() => (
           <Redirect
           <Redirect
             to={{
             to={{
-              pathname: redirectPath,
+              pathname: redirectPath
             }}
             }}
           />
           />
         )}
         )}
@@ -20,6 +20,6 @@ const AuthorizedRoute = ({ component: Component, render, authority, redirectPath
   >
   >
     <Route {...rest} render={(props) => (Component ? <Component {...props} /> : render(props))} />
     <Route {...rest} render={(props) => (Component ? <Component {...props} /> : render(props))} />
   </Authorized>
   </Authorized>
-);
+)
 
 
-export default AuthorizedRoute;
+export default AuthorizedRoute

+ 20 - 20
src/components/Authorized/CheckPermissions.jsx

@@ -1,7 +1,7 @@
-import React from 'react';
-import { CURRENT } from './renderAuthorize'; // eslint-disable-next-line import/no-cycle
+import React from 'react'
+import { CURRENT } from './renderAuthorize' // eslint-disable-next-line import/no-cycle
 
 
-import PromiseRender from './PromiseRender';
+import PromiseRender from './PromiseRender'
 
 
 /**
 /**
  * 通用权限检查方法
  * 通用权限检查方法
@@ -15,58 +15,58 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
   // 没有判定权限.默认查看所有
   // 没有判定权限.默认查看所有
   // Retirement authority, return target;
   // Retirement authority, return target;
   if (!authority) {
   if (!authority) {
-    return target;
+    return target
   } // 数组处理
   } // 数组处理
 
 
   if (Array.isArray(authority)) {
   if (Array.isArray(authority)) {
     if (Array.isArray(currentAuthority)) {
     if (Array.isArray(currentAuthority)) {
       if (currentAuthority.some((item) => authority.includes(item))) {
       if (currentAuthority.some((item) => authority.includes(item))) {
-        return target;
+        return target
       }
       }
     } else if (authority.includes(currentAuthority)) {
     } else if (authority.includes(currentAuthority)) {
-      return target;
+      return target
     }
     }
 
 
-    return Exception;
+    return Exception
   } // string 处理
   } // string 处理
 
 
   if (typeof authority === 'string') {
   if (typeof authority === 'string') {
     if (Array.isArray(currentAuthority)) {
     if (Array.isArray(currentAuthority)) {
       if (currentAuthority.some((item) => authority === item)) {
       if (currentAuthority.some((item) => authority === item)) {
-        return target;
+        return target
       }
       }
     } else if (authority === currentAuthority) {
     } else if (authority === currentAuthority) {
-      return target;
+      return target
     }
     }
 
 
-    return Exception;
+    return Exception
   } // Promise 处理
   } // Promise 处理
 
 
   if (authority instanceof Promise) {
   if (authority instanceof Promise) {
-    return <PromiseRender ok={target} error={Exception} promise={authority} />;
+    return <PromiseRender ok={target} error={Exception} promise={authority} />
   } // Function 处理
   } // Function 处理
 
 
   if (typeof authority === 'function') {
   if (typeof authority === 'function') {
-    const bool = authority(currentAuthority); // 函数执行后返回值是 Promise
+    const bool = authority(currentAuthority) // 函数执行后返回值是 Promise
 
 
     if (bool instanceof Promise) {
     if (bool instanceof Promise) {
-      return <PromiseRender ok={target} error={Exception} promise={bool} />;
+      return <PromiseRender ok={target} error={Exception} promise={bool} />
     }
     }
 
 
     if (bool) {
     if (bool) {
-      return target;
+      return target
     }
     }
 
 
-    return Exception;
+    return Exception
   }
   }
 
 
-  throw new Error('unsupported parameters');
-};
+  throw new Error('unsupported parameters')
+}
 
 
-export { checkPermissions };
+export { checkPermissions }
 
 
 function check(authority, target, Exception) {
 function check(authority, target, Exception) {
-  return checkPermissions(authority, CURRENT, target, Exception);
+  return checkPermissions(authority, CURRENT, target, Exception)
 }
 }
 
 
-export default check;
+export default check

+ 26 - 26
src/components/Authorized/PromiseRender.jsx

@@ -1,43 +1,43 @@
-import React from 'react';
-import { Spin } from 'antd';
-import isEqual from 'lodash/isEqual';
-import { isComponentClass } from './Secured'; // eslint-disable-next-line import/no-cycle
+import React from 'react'
+import { Spin } from 'antd'
+import isEqual from 'lodash/isEqual'
+import { isComponentClass } from './Secured' // eslint-disable-next-line import/no-cycle
 
 
 export default class PromiseRender extends React.Component {
 export default class PromiseRender extends React.Component {
   state = {
   state = {
-    component: () => null,
+    component: () => null
   };
   };
 
 
   componentDidMount() {
   componentDidMount() {
-    this.setRenderComponent(this.props);
+    this.setRenderComponent(this.props)
   }
   }
 
 
   shouldComponentUpdate = (nextProps, nextState) => {
   shouldComponentUpdate = (nextProps, nextState) => {
-    const { component } = this.state;
+    const { component } = this.state
 
 
     if (!isEqual(nextProps, this.props)) {
     if (!isEqual(nextProps, this.props)) {
-      this.setRenderComponent(nextProps);
+      this.setRenderComponent(nextProps)
     }
     }
 
 
-    if (nextState.component !== component) return true;
-    return false;
+    if (nextState.component !== component) return true
+    return false
   }; // set render Component : ok or error
   }; // set render Component : ok or error
 
 
   setRenderComponent(props) {
   setRenderComponent(props) {
-    const ok = this.checkIsInstantiation(props.ok);
-    const error = this.checkIsInstantiation(props.error);
+    const ok = this.checkIsInstantiation(props.ok)
+    const error = this.checkIsInstantiation(props.error)
     props.promise
     props.promise
       .then(() => {
       .then(() => {
         this.setState({
         this.setState({
-          component: ok,
-        });
-        return true;
+          component: ok
+        })
+        return true
       })
       })
       .catch(() => {
       .catch(() => {
         this.setState({
         this.setState({
-          component: error,
-        });
-      });
+          component: error
+        })
+      })
   } // Determine whether the incoming component has been instantiated
   } // Determine whether the incoming component has been instantiated
   // AuthorizedRoute is already instantiated
   // AuthorizedRoute is already instantiated
   // Authorized  render is already instantiated, children is no instantiated
   // Authorized  render is already instantiated, children is no instantiated
@@ -45,20 +45,20 @@ export default class PromiseRender extends React.Component {
 
 
   checkIsInstantiation = (target) => {
   checkIsInstantiation = (target) => {
     if (isComponentClass(target)) {
     if (isComponentClass(target)) {
-      const Target = target;
-      return (props) => <Target {...props} />;
+      const Target = target
+      return (props) => <Target {...props} />
     }
     }
 
 
     if (React.isValidElement(target)) {
     if (React.isValidElement(target)) {
-      return (props) => React.cloneElement(target, props);
+      return (props) => React.cloneElement(target, props)
     }
     }
 
 
-    return () => target;
+    return () => target
   };
   };
 
 
   render() {
   render() {
-    const { component: Component } = this.state;
-    const { ok, error, promise, ...rest } = this.props;
+    const { component: Component } = this.state
+    const { ok, error, promise, ...rest } = this.props
     return Component ? (
     return Component ? (
       <Component {...rest} />
       <Component {...rest} />
     ) : (
     ) : (
@@ -68,11 +68,11 @@ export default class PromiseRender extends React.Component {
           height: '100%',
           height: '100%',
           margin: 'auto',
           margin: 'auto',
           paddingTop: 50,
           paddingTop: 50,
-          textAlign: 'center',
+          textAlign: 'center'
         }}
         }}
       >
       >
         <Spin size="large" />
         <Spin size="large" />
       </div>
       </div>
-    );
+    )
   }
   }
 }
 }

+ 21 - 21
src/components/Authorized/Secured.jsx

@@ -1,34 +1,34 @@
-import React from 'react';
-import CheckPermissions from './CheckPermissions';
+import React from 'react'
+import CheckPermissions from './CheckPermissions'
 /**
 /**
  * 默认不能访问任何页面
  * 默认不能访问任何页面
  * default is "NULL"
  * default is "NULL"
  */
  */
 
 
-const Exception403 = () => 403;
+const Exception403 = () => 403
 
 
 export const isComponentClass = (component) => {
 export const isComponentClass = (component) => {
-  if (!component) return false;
-  const proto = Object.getPrototypeOf(component);
-  if (proto === React.Component || proto === Function.prototype) return true;
-  return isComponentClass(proto);
-}; // Determine whether the incoming component has been instantiated
+  if (!component) return false
+  const proto = Object.getPrototypeOf(component)
+  if (proto === React.Component || proto === Function.prototype) return true
+  return isComponentClass(proto)
+} // Determine whether the incoming component has been instantiated
 // AuthorizedRoute is already instantiated
 // AuthorizedRoute is already instantiated
 // Authorized  render is already instantiated, children is no instantiated
 // Authorized  render is already instantiated, children is no instantiated
 // Secured is not instantiated
 // Secured is not instantiated
 
 
 const checkIsInstantiation = (target) => {
 const checkIsInstantiation = (target) => {
   if (isComponentClass(target)) {
   if (isComponentClass(target)) {
-    const Target = target;
-    return (props) => <Target {...props} />;
+    const Target = target
+    return (props) => <Target {...props} />
   }
   }
 
 
   if (React.isValidElement(target)) {
   if (React.isValidElement(target)) {
-    return (props) => React.cloneElement(target, props);
+    return (props) => React.cloneElement(target, props)
   }
   }
 
 
-  return () => target;
-};
+  return () => target
+}
 /**
 /**
  * 用于判断是否拥有权限访问此 view 权限
  * 用于判断是否拥有权限访问此 view 权限
  * authority 支持传入 string, () => boolean | Promise
  * authority 支持传入 string, () => boolean | Promise
@@ -51,20 +51,20 @@ const authorize = (authority, error) => {
    * 防止传入字符串时找不到staticContext造成报错
    * 防止传入字符串时找不到staticContext造成报错
    * String parameters can cause staticContext not found error
    * String parameters can cause staticContext not found error
    */
    */
-  let classError = false;
+  let classError = false
 
 
   if (error) {
   if (error) {
-    classError = () => error;
+    classError = () => error
   }
   }
 
 
   if (!authority) {
   if (!authority) {
-    throw new Error('authority is required');
+    throw new Error('authority is required')
   }
   }
 
 
   return function decideAuthority(target) {
   return function decideAuthority(target) {
-    const component = CheckPermissions(authority, target, classError || Exception403);
-    return checkIsInstantiation(component);
-  };
-};
+    const component = CheckPermissions(authority, target, classError || Exception403)
+    return checkIsInstantiation(component)
+  }
+}
 
 
-export default authorize;
+export default authorize

+ 8 - 8
src/components/Authorized/index.jsx

@@ -1,9 +1,9 @@
-import Authorized from './Authorized';
-import Secured from './Secured';
-import check from './CheckPermissions';
-import renderAuthorize from './renderAuthorize';
+import Authorized from './Authorized'
+import Secured from './Secured'
+import check from './CheckPermissions'
+import renderAuthorize from './renderAuthorize'
 
 
-Authorized.Secured = Secured;
-Authorized.check = check;
-const RenderAuthorize = renderAuthorize(Authorized);
-export default RenderAuthorize;
+Authorized.Secured = Secured
+Authorized.check = check
+const RenderAuthorize = renderAuthorize(Authorized)
+export default RenderAuthorize

+ 8 - 8
src/components/Authorized/renderAuthorize.js

@@ -1,7 +1,7 @@
 /* eslint-disable eslint-comments/disable-enable-pair */
 /* eslint-disable eslint-comments/disable-enable-pair */
 
 
 /* eslint-disable import/no-mutable-exports */
 /* eslint-disable import/no-mutable-exports */
-let CURRENT = 'NULL';
+let CURRENT = 'NULL'
 
 
 /**
 /**
  * use  authority or getAuthority
  * use  authority or getAuthority
@@ -10,21 +10,21 @@ let CURRENT = 'NULL';
 const renderAuthorize = (Authorized) => (currentAuthority) => {
 const renderAuthorize = (Authorized) => (currentAuthority) => {
   if (currentAuthority) {
   if (currentAuthority) {
     if (typeof currentAuthority === 'function') {
     if (typeof currentAuthority === 'function') {
-      CURRENT = currentAuthority();
+      CURRENT = currentAuthority()
     }
     }
 
 
     if (
     if (
       Object.prototype.toString.call(currentAuthority) === '[object String]' ||
       Object.prototype.toString.call(currentAuthority) === '[object String]' ||
       Array.isArray(currentAuthority)
       Array.isArray(currentAuthority)
     ) {
     ) {
-      CURRENT = currentAuthority;
+      CURRENT = currentAuthority
     }
     }
   } else {
   } else {
-    CURRENT = 'NULL';
+    CURRENT = 'NULL'
   }
   }
 
 
-  return Authorized;
-};
+  return Authorized
+}
 
 
-export { CURRENT };
-export default (Authorized) => renderAuthorize(Authorized);
+export { CURRENT }
+export default (Authorized) => renderAuthorize(Authorized)

+ 20 - 20
src/components/GlobalHeader/AvatarDropdown.jsx

@@ -1,37 +1,37 @@
-import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons';
-import { Avatar, Menu, Spin } from 'antd';
-import React from 'react';
-import { history, connect } from 'umi';
-import HeaderDropdown from '../HeaderDropdown';
-import styles from './index.less';
+import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'
+import { Avatar, Menu, Spin } from 'antd'
+import React from 'react'
+import { history, connect } from 'umi'
+import HeaderDropdown from '../HeaderDropdown'
+import styles from './index.less'
 
 
 class AvatarDropdown extends React.Component {
 class AvatarDropdown extends React.Component {
   onMenuClick = (event) => {
   onMenuClick = (event) => {
-    const { key } = event;
+    const { key } = event
 
 
     if (key === 'logout') {
     if (key === 'logout') {
-      const { dispatch } = this.props;
+      const { dispatch } = this.props
 
 
       if (dispatch) {
       if (dispatch) {
         dispatch({
         dispatch({
-          type: 'login/logout',
-        });
+          type: 'login/logout'
+        })
       }
       }
 
 
-      return;
+      return
     }
     }
 
 
-    history.push(`/account/${key}`);
+    history.push(`/account/${key}`)
   };
   };
 
 
   render() {
   render() {
     const {
     const {
       currentUser = {
       currentUser = {
         avatar: '',
         avatar: '',
-        name: '',
+        name: ''
       },
       },
-      menu,
-    } = this.props;
+      menu
+    } = this.props
     const menuHeaderDropdown = (
     const menuHeaderDropdown = (
       <Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
       <Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
         {menu && (
         {menu && (
@@ -53,7 +53,7 @@ class AvatarDropdown extends React.Component {
           退出登录
           退出登录
         </Menu.Item>
         </Menu.Item>
       </Menu>
       </Menu>
-    );
+    )
     return currentUser && currentUser.name ? (
     return currentUser && currentUser.name ? (
       <HeaderDropdown overlay={menuHeaderDropdown}>
       <HeaderDropdown overlay={menuHeaderDropdown}>
         <span className={`${styles.action} ${styles.account}`}>
         <span className={`${styles.action} ${styles.account}`}>
@@ -67,14 +67,14 @@ class AvatarDropdown extends React.Component {
           size="small"
           size="small"
           style={{
           style={{
             marginLeft: 8,
             marginLeft: 8,
-            marginRight: 8,
+            marginRight: 8
           }}
           }}
         />
         />
       </span>
       </span>
-    );
+    )
   }
   }
 }
 }
 
 
 export default connect(({ user }) => ({
 export default connect(({ user }) => ({
-  currentUser: user.currentUser,
-}))(AvatarDropdown);
+  currentUser: user.currentUser
+}))(AvatarDropdown)

+ 43 - 43
src/components/GlobalHeader/NoticeIconView.jsx

@@ -1,62 +1,62 @@
-import React, { Component } from 'react';
-import { connect } from 'umi';
-import { Tag, message } from 'antd';
-import groupBy from 'lodash/groupBy';
-import moment from 'moment';
-import NoticeIcon from '../NoticeIcon';
-import styles from './index.less';
+import React, { Component } from 'react'
+import { connect } from 'umi'
+import { Tag, message } from 'antd'
+import groupBy from 'lodash/groupBy'
+import moment from 'moment'
+import NoticeIcon from '../NoticeIcon'
+import styles from './index.less'
 
 
 class GlobalHeaderRight extends Component {
 class GlobalHeaderRight extends Component {
   componentDidMount() {
   componentDidMount() {
-    const { dispatch } = this.props;
+    const { dispatch } = this.props
 
 
     if (dispatch) {
     if (dispatch) {
       dispatch({
       dispatch({
-        type: 'global/fetchNotices',
-      });
+        type: 'global/fetchNotices'
+      })
     }
     }
   }
   }
 
 
   changeReadState = (clickedItem) => {
   changeReadState = (clickedItem) => {
-    const { id } = clickedItem;
-    const { dispatch } = this.props;
+    const { id } = clickedItem
+    const { dispatch } = this.props
 
 
     if (dispatch) {
     if (dispatch) {
       dispatch({
       dispatch({
         type: 'global/changeNoticeReadState',
         type: 'global/changeNoticeReadState',
-        payload: id,
-      });
+        payload: id
+      })
     }
     }
   };
   };
 
 
   handleNoticeClear = (title, key) => {
   handleNoticeClear = (title, key) => {
-    const { dispatch } = this.props;
-    message.success(`${'清空了'} ${title}`);
+    const { dispatch } = this.props
+    message.success(`${'清空了'} ${title}`)
 
 
     if (dispatch) {
     if (dispatch) {
       dispatch({
       dispatch({
         type: 'global/clearNotices',
         type: 'global/clearNotices',
-        payload: key,
-      });
+        payload: key
+      })
     }
     }
   };
   };
 
 
   getNoticeData = () => {
   getNoticeData = () => {
-    const { notices = [] } = this.props;
+    const { notices = [] } = this.props
 
 
     if (!notices || notices.length === 0 || !Array.isArray(notices)) {
     if (!notices || notices.length === 0 || !Array.isArray(notices)) {
-      return {};
+      return {}
     }
     }
 
 
     const newNotices = notices.map((notice) => {
     const newNotices = notices.map((notice) => {
-      const newNotice = { ...notice };
+      const newNotice = { ...notice }
 
 
       if (newNotice.datetime) {
       if (newNotice.datetime) {
-        newNotice.datetime = moment(notice.datetime).fromNow();
+        newNotice.datetime = moment(notice.datetime).fromNow()
       }
       }
 
 
       if (newNotice.id) {
       if (newNotice.id) {
-        newNotice.key = newNotice.id;
+        newNotice.key = newNotice.id
       }
       }
 
 
       if (newNotice.extra && newNotice.status) {
       if (newNotice.extra && newNotice.status) {
@@ -64,51 +64,51 @@ class GlobalHeaderRight extends Component {
           todo: '',
           todo: '',
           processing: 'blue',
           processing: 'blue',
           urgent: 'red',
           urgent: 'red',
-          doing: 'gold',
-        }[newNotice.status];
+          doing: 'gold'
+        }[newNotice.status]
         newNotice.extra = (
         newNotice.extra = (
           <Tag
           <Tag
             color={color}
             color={color}
             style={{
             style={{
-              marginRight: 0,
+              marginRight: 0
             }}
             }}
           >
           >
             {newNotice.extra}
             {newNotice.extra}
           </Tag>
           </Tag>
-        );
+        )
       }
       }
 
 
-      return newNotice;
-    });
-    return groupBy(newNotices, 'type');
+      return newNotice
+    })
+    return groupBy(newNotices, 'type')
   };
   };
 
 
   getUnreadData = (noticeData) => {
   getUnreadData = (noticeData) => {
-    const unreadMsg = {};
+    const unreadMsg = {}
     Object.keys(noticeData).forEach((key) => {
     Object.keys(noticeData).forEach((key) => {
-      const value = noticeData[key];
+      const value = noticeData[key]
 
 
       if (!unreadMsg[key]) {
       if (!unreadMsg[key]) {
-        unreadMsg[key] = 0;
+        unreadMsg[key] = 0
       }
       }
 
 
       if (Array.isArray(value)) {
       if (Array.isArray(value)) {
-        unreadMsg[key] = value.filter((item) => !item.read).length;
+        unreadMsg[key] = value.filter((item) => !item.read).length
       }
       }
-    });
-    return unreadMsg;
+    })
+    return unreadMsg
   };
   };
 
 
   render() {
   render() {
-    const { currentUser, fetchingNotices, onNoticeVisibleChange } = this.props;
-    const noticeData = this.getNoticeData();
-    const unreadMsg = this.getUnreadData(noticeData);
+    const { currentUser, fetchingNotices, onNoticeVisibleChange } = this.props
+    const noticeData = this.getNoticeData()
+    const unreadMsg = this.getUnreadData(noticeData)
     return (
     return (
       <NoticeIcon
       <NoticeIcon
         className={styles.action}
         className={styles.action}
         count={currentUser && currentUser.unreadCount}
         count={currentUser && currentUser.unreadCount}
         onItemClick={(item) => {
         onItemClick={(item) => {
-          this.changeReadState(item);
+          this.changeReadState(item)
         }}
         }}
         loading={fetchingNotices}
         loading={fetchingNotices}
         clearText="清空"
         clearText="清空"
@@ -143,7 +143,7 @@ class GlobalHeaderRight extends Component {
           showViewMore
           showViewMore
         />
         />
       </NoticeIcon>
       </NoticeIcon>
-    );
+    )
   }
   }
 }
 }
 
 
@@ -152,5 +152,5 @@ export default connect(({ user, global, loading }) => ({
   collapsed: global.collapsed,
   collapsed: global.collapsed,
   fetchingMoreNotices: loading.effects['global/fetchMoreNotices'],
   fetchingMoreNotices: loading.effects['global/fetchMoreNotices'],
   fetchingNotices: loading.effects['global/fetchNotices'],
   fetchingNotices: loading.effects['global/fetchNotices'],
-  notices: global.notices,
-}))(GlobalHeaderRight);
+  notices: global.notices
+}))(GlobalHeaderRight)

+ 16 - 16
src/components/GlobalHeader/RightContent.jsx

@@ -1,23 +1,23 @@
-import { Tooltip, Tag } from 'antd';
-import { QuestionCircleOutlined } from '@ant-design/icons';
-import React from 'react';
-import { connect, SelectLang } from 'umi';
-import Avatar from './AvatarDropdown';
-import HeaderSearch from '../HeaderSearch';
-import styles from './index.less';
+import { Tooltip, Tag } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
+import React from 'react'
+import { connect, SelectLang } from 'umi'
+import Avatar from './AvatarDropdown'
+import HeaderSearch from '../HeaderSearch'
+import styles from './index.less'
 
 
 const ENVTagColor = {
 const ENVTagColor = {
   dev: 'orange',
   dev: 'orange',
   test: 'green',
   test: 'green',
-  pre: '#87d068',
-};
+  pre: '#87d068'
+}
 
 
 const GlobalHeaderRight = (props) => {
 const GlobalHeaderRight = (props) => {
-  const { theme, layout } = props;
-  let className = styles.right;
+  const { theme, layout } = props
+  let className = styles.right
 
 
   if (theme === 'dark' && layout === 'top') {
   if (theme === 'dark' && layout === 'top') {
-    className = `${styles.right}  ${styles.dark}`;
+    className = `${styles.right}  ${styles.dark}`
   }
   }
 
 
   return (
   return (
@@ -68,10 +68,10 @@ const GlobalHeaderRight = (props) => {
       )}
       )}
       {/* <SelectLang className={styles.action} /> */}
       {/* <SelectLang className={styles.action} /> */}
     </div>
     </div>
-  );
-};
+  )
+}
 
 
 export default connect(({ settings }) => ({
 export default connect(({ settings }) => ({
   theme: settings.navTheme,
   theme: settings.navTheme,
-  layout: settings.layout,
-}))(GlobalHeaderRight);
+  layout: settings.layout
+}))(GlobalHeaderRight)

+ 6 - 6
src/components/HeaderDropdown/index.jsx

@@ -1,10 +1,10 @@
-import { Dropdown } from 'antd';
-import React from 'react';
-import classNames from 'classnames';
-import styles from './index.less';
+import { Dropdown } from 'antd'
+import React from 'react'
+import classNames from 'classnames'
+import styles from './index.less'
 
 
 const HeaderDropdown = ({ overlayClassName: cls, ...restProps }) => (
 const HeaderDropdown = ({ overlayClassName: cls, ...restProps }) => (
   <Dropdown overlayClassName={classNames(styles.container, cls)} {...restProps} />
   <Dropdown overlayClassName={classNames(styles.container, cls)} {...restProps} />
-);
+)
 
 
-export default HeaderDropdown;
+export default HeaderDropdown

+ 26 - 26
src/components/HeaderSearch/index.jsx

@@ -1,9 +1,9 @@
-import { SearchOutlined } from '@ant-design/icons';
-import { AutoComplete, Input } from 'antd';
-import useMergeValue from 'use-merge-value';
-import React, { useRef } from 'react';
-import classNames from 'classnames';
-import styles from './index.less';
+import { SearchOutlined } from '@ant-design/icons'
+import { AutoComplete, Input } from 'antd'
+import useMergeValue from 'use-merge-value'
+import React, { useRef } from 'react'
+import classNames from 'classnames'
+import styles from './index.less'
 
 
 const HeaderSearch = (props) => {
 const HeaderSearch = (props) => {
   const {
   const {
@@ -14,33 +14,33 @@ const HeaderSearch = (props) => {
     open,
     open,
     defaultOpen,
     defaultOpen,
     ...restProps
     ...restProps
-  } = props;
-  const inputRef = useRef(null);
-  const [value, setValue] = useMergeValue(defaultValue, {
+  } = props
+  const inputRef = useRef(null)
+  const [ value, setValue ] = useMergeValue(defaultValue, {
     value: props.value,
     value: props.value,
-    onChange: props.onChange,
-  });
-  const [searchMode, setSearchMode] = useMergeValue(defaultOpen || false, {
+    onChange: props.onChange
+  })
+  const [ searchMode, setSearchMode ] = useMergeValue(defaultOpen || false, {
     value: props.open,
     value: props.open,
-    onChange: onVisibleChange,
-  });
+    onChange: onVisibleChange
+  })
   const inputClass = classNames(styles.input, {
   const inputClass = classNames(styles.input, {
-    [styles.show]: searchMode,
-  });
+    [styles.show]: searchMode
+  })
   return (
   return (
     <div
     <div
       className={classNames(className, styles.headerSearch)}
       className={classNames(className, styles.headerSearch)}
       onClick={() => {
       onClick={() => {
-        setSearchMode(true);
+        setSearchMode(true)
 
 
         if (searchMode && inputRef.current) {
         if (searchMode && inputRef.current) {
-          inputRef.current.focus();
+          inputRef.current.focus()
         }
         }
       }}
       }}
       onTransitionEnd={({ propertyName }) => {
       onTransitionEnd={({ propertyName }) => {
         if (propertyName === 'width' && !searchMode) {
         if (propertyName === 'width' && !searchMode) {
           if (onVisibleChange) {
           if (onVisibleChange) {
-            onVisibleChange(searchMode);
+            onVisibleChange(searchMode)
           }
           }
         }
         }
       }}
       }}
@@ -48,7 +48,7 @@ const HeaderSearch = (props) => {
       <SearchOutlined
       <SearchOutlined
         key="Icon"
         key="Icon"
         style={{
         style={{
-          cursor: 'pointer',
+          cursor: 'pointer'
         }}
         }}
       />
       />
       <AutoComplete
       <AutoComplete
@@ -57,7 +57,7 @@ const HeaderSearch = (props) => {
         value={value}
         value={value}
         style={{
         style={{
           height: 28,
           height: 28,
-          marginTop: -6,
+          marginTop: -6
         }}
         }}
         options={restProps.options}
         options={restProps.options}
         onChange={setValue}
         onChange={setValue}
@@ -70,17 +70,17 @@ const HeaderSearch = (props) => {
           onKeyDown={(e) => {
           onKeyDown={(e) => {
             if (e.key === 'Enter') {
             if (e.key === 'Enter') {
               if (restProps.onSearch) {
               if (restProps.onSearch) {
-                restProps.onSearch(value);
+                restProps.onSearch(value)
               }
               }
             }
             }
           }}
           }}
           onBlur={() => {
           onBlur={() => {
-            setSearchMode(false);
+            setSearchMode(false)
           }}
           }}
         />
         />
       </AutoComplete>
       </AutoComplete>
     </div>
     </div>
-  );
-};
+  )
+}
 
 
-export default HeaderSearch;
+export default HeaderSearch

+ 14 - 14
src/components/NoticeIcon/NoticeList.jsx

@@ -1,7 +1,7 @@
-import { Avatar, List } from 'antd';
-import React from 'react';
-import classNames from 'classnames';
-import styles from './NoticeList.less';
+import { Avatar, List } from 'antd'
+import React from 'react'
+import classNames from 'classnames'
+import styles from './NoticeList.less'
 
 
 const NoticeList = ({
 const NoticeList = ({
   data = [],
   data = [],
@@ -13,7 +13,7 @@ const NoticeList = ({
   showClear = true,
   showClear = true,
   clearText,
   clearText,
   viewMoreText,
   viewMoreText,
-  showViewMore = false,
+  showViewMore = false
 }) => {
 }) => {
   if (!data || data.length === 0) {
   if (!data || data.length === 0) {
     return (
     return (
@@ -24,7 +24,7 @@ const NoticeList = ({
         />
         />
         <div>{emptyText}</div>
         <div>{emptyText}</div>
       </div>
       </div>
-    );
+    )
   }
   }
 
 
   return (
   return (
@@ -34,8 +34,8 @@ const NoticeList = ({
         dataSource={data}
         dataSource={data}
         renderItem={(item, i) => {
         renderItem={(item, i) => {
           const itemCls = classNames(styles.item, {
           const itemCls = classNames(styles.item, {
-            [styles.read]: item.read,
-          }); // eslint-disable-next-line no-nested-ternary
+            [styles.read]: item.read
+          }) // eslint-disable-next-line no-nested-ternary
 
 
           const leftIcon = item.avatar ? (
           const leftIcon = item.avatar ? (
             typeof item.avatar === 'string' ? (
             typeof item.avatar === 'string' ? (
@@ -43,7 +43,7 @@ const NoticeList = ({
             ) : (
             ) : (
               <span className={styles.iconElement}>{item.avatar}</span>
               <span className={styles.iconElement}>{item.avatar}</span>
             )
             )
-          ) : null;
+          ) : null
           return (
           return (
             <List.Item
             <List.Item
               className={itemCls}
               className={itemCls}
@@ -67,7 +67,7 @@ const NoticeList = ({
                 }
                 }
               />
               />
             </List.Item>
             </List.Item>
-          );
+          )
         }}
         }}
       />
       />
       <div className={styles.bottomBar}>
       <div className={styles.bottomBar}>
@@ -80,7 +80,7 @@ const NoticeList = ({
           <div
           <div
             onClick={(e) => {
             onClick={(e) => {
               if (onViewMore) {
               if (onViewMore) {
-                onViewMore(e);
+                onViewMore(e)
               }
               }
             }}
             }}
           >
           >
@@ -89,7 +89,7 @@ const NoticeList = ({
         ) : null}
         ) : null}
       </div>
       </div>
     </div>
     </div>
-  );
-};
+  )
+}
 
 
-export default NoticeList;
+export default NoticeList

+ 41 - 41
src/components/NoticeIcon/index.jsx

@@ -1,13 +1,13 @@
-import { BellOutlined } from '@ant-design/icons';
-import { Badge, Spin, Tabs } from 'antd';
-import useMergeValue from 'use-merge-value';
-import React from 'react';
-import classNames from 'classnames';
-import NoticeList from './NoticeList';
-import HeaderDropdown from '../HeaderDropdown';
-import styles from './index.less';
+import { BellOutlined } from '@ant-design/icons'
+import { Badge, Spin, Tabs } from 'antd'
+import useMergeValue from 'use-merge-value'
+import React from 'react'
+import classNames from 'classnames'
+import NoticeList from './NoticeList'
+import HeaderDropdown from '../HeaderDropdown'
+import styles from './index.less'
 
 
-const { TabPane } = Tabs;
+const { TabPane } = Tabs
 
 
 const NoticeIcon = (props) => {
 const NoticeIcon = (props) => {
   const getNotificationBox = () => {
   const getNotificationBox = () => {
@@ -19,23 +19,23 @@ const NoticeIcon = (props) => {
       onItemClick,
       onItemClick,
       onViewMore,
       onViewMore,
       clearText,
       clearText,
-      viewMoreText,
-    } = props;
+      viewMoreText
+    } = props
 
 
     if (!children) {
     if (!children) {
-      return null;
+      return null
     }
     }
 
 
-    const panes = [];
+    const panes = []
     React.Children.forEach(children, (child) => {
     React.Children.forEach(children, (child) => {
       if (!child) {
       if (!child) {
-        return;
+        return
       }
       }
 
 
-      const { list, title, count, tabKey, showClear, showViewMore } = child.props;
-      const len = list && list.length ? list.length : 0;
-      const msgCount = count || count === 0 ? count : len;
-      const tabTitle = msgCount > 0 ? `${title} (${msgCount})` : title;
+      const { list, title, count, tabKey, showClear, showViewMore } = child.props
+      const len = list && list.length ? list.length : 0
+      const msgCount = count || count === 0 ? count : len
+      const tabTitle = msgCount > 0 ? `${title} (${msgCount})` : title
       panes.push(
       panes.push(
         <TabPane tab={tabTitle} key={tabKey}>
         <TabPane tab={tabTitle} key={tabKey}>
           <NoticeList
           <NoticeList
@@ -50,46 +50,46 @@ const NoticeIcon = (props) => {
             showViewMore={showViewMore}
             showViewMore={showViewMore}
             title={title}
             title={title}
           />
           />
-        </TabPane>,
-      );
-    });
+        </TabPane>
+      )
+    })
     return (
     return (
       <Spin spinning={loading} delay={300}>
       <Spin spinning={loading} delay={300}>
         <Tabs className={styles.tabs} onChange={onTabChange}>
         <Tabs className={styles.tabs} onChange={onTabChange}>
           {panes}
           {panes}
         </Tabs>
         </Tabs>
       </Spin>
       </Spin>
-    );
-  };
+    )
+  }
 
 
-  const { className, count, bell } = props;
-  const [visible, setVisible] = useMergeValue(false, {
+  const { className, count, bell } = props
+  const [ visible, setVisible ] = useMergeValue(false, {
     value: props.popupVisible,
     value: props.popupVisible,
-    onChange: props.onPopupVisibleChange,
-  });
-  const noticeButtonClass = classNames(className, styles.noticeButton);
-  const notificationBox = getNotificationBox();
-  const NoticeBellIcon = bell || <BellOutlined className={styles.icon} />;
+    onChange: props.onPopupVisibleChange
+  })
+  const noticeButtonClass = classNames(className, styles.noticeButton)
+  const notificationBox = getNotificationBox()
+  const NoticeBellIcon = bell || <BellOutlined className={styles.icon} />
   const trigger = (
   const trigger = (
     <span
     <span
       className={classNames(noticeButtonClass, {
       className={classNames(noticeButtonClass, {
-        opened: visible,
+        opened: visible
       })}
       })}
     >
     >
       <Badge
       <Badge
         count={count}
         count={count}
         style={{
         style={{
-          boxShadow: 'none',
+          boxShadow: 'none'
         }}
         }}
         className={styles.badge}
         className={styles.badge}
       >
       >
         {NoticeBellIcon}
         {NoticeBellIcon}
       </Badge>
       </Badge>
     </span>
     </span>
-  );
+  )
 
 
   if (!notificationBox) {
   if (!notificationBox) {
-    return trigger;
+    return trigger
   }
   }
 
 
   return (
   return (
@@ -97,17 +97,17 @@ const NoticeIcon = (props) => {
       placement="bottomRight"
       placement="bottomRight"
       overlay={notificationBox}
       overlay={notificationBox}
       overlayClassName={styles.popover}
       overlayClassName={styles.popover}
-      trigger={['click']}
+      trigger={[ 'click' ]}
       visible={visible}
       visible={visible}
       onVisibleChange={setVisible}
       onVisibleChange={setVisible}
     >
     >
       {trigger}
       {trigger}
     </HeaderDropdown>
     </HeaderDropdown>
-  );
-};
+  )
+}
 
 
 NoticeIcon.defaultProps = {
 NoticeIcon.defaultProps = {
-  emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg',
-};
-NoticeIcon.Tab = NoticeList;
-export default NoticeIcon;
+  emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg'
+}
+NoticeIcon.Tab = NoticeList
+export default NoticeIcon

+ 2 - 2
src/components/PageLoading/index.jsx

@@ -1,4 +1,4 @@
-import { PageLoading } from '@ant-design/pro-layout'; // loading components from code split
+import { PageLoading } from '@ant-design/pro-layout' // loading components from code split
 // https://umijs.org/plugin/umi-plugin-react.html#dynamicimport
 // https://umijs.org/plugin/umi-plugin-react.html#dynamicimport
 
 
-export default PageLoading;
+export default PageLoading

+ 37 - 37
src/components/PopContactForm/index.jsx

@@ -4,7 +4,7 @@ import styles from './index.less'
 
 
 const Popcontactform = props => {
 const Popcontactform = props => {
   // 浏览器实际宽度
   // 浏览器实际宽度
-  const [clientWidth, setClientWidth] = useState(document.body.clientWidth * 0.75)
+  const [ clientWidth, setClientWidth ] = useState(document.body.clientWidth * 0.75)
   useEffect(() => {
   useEffect(() => {
     window.addEventListener('resize', () => {
     window.addEventListener('resize', () => {
       setClientWidth(document.body.clientWidth * 0.7)
       setClientWidth(document.body.clientWidth * 0.7)
@@ -14,10 +14,10 @@ const Popcontactform = props => {
     }
     }
   }, [])
   }, [])
   const { visible, onClose, onCreate } = props
   const { visible, onClose, onCreate } = props
-  const [form] = Form.useForm()
-  const { TabPane } = Tabs;
+  const [ form ] = Form.useForm()
+  const { TabPane } = Tabs
   function callback(key) {
   function callback(key) {
-    console.log(key);
+    console.log(key)
   }
   }
   const residences = [
   const residences = [
     {
     {
@@ -30,11 +30,11 @@ const Popcontactform = props => {
           children: [
           children: [
             {
             {
               value: '香洲区',
               value: '香洲区',
-              label: '香洲区',
-            },
-          ],
-        },
-      ],
+              label: '香洲区'
+            }
+          ]
+        }
+      ]
     },
     },
     {
     {
       value: '安徽省',
       value: '安徽省',
@@ -46,20 +46,20 @@ const Popcontactform = props => {
           children: [
           children: [
             {
             {
               value: '庐阳区',
               value: '庐阳区',
-              label: '庐阳区',
-            },
-          ],
-        },
-      ],
-    },
-  ];
+              label: '庐阳区'
+            }
+          ]
+        }
+      ]
+    }
+  ]
   const listdata = [
   const listdata = [
     'Racing car sprays burning fuel into crowd.',
     'Racing car sprays burning fuel into crowd.',
     'Japanese princess to wed commoner.',
     'Japanese princess to wed commoner.',
     'Australian walks 100km after outback crash.',
     'Australian walks 100km after outback crash.',
     'Man charged over missing wedding girl.',
     'Man charged over missing wedding girl.',
-    'Los Angeles battles huge wildfires.',
-  ];
+    'Los Angeles battles huge wildfires.'
+  ]
   return (
   return (
     <div>
     <div>
       <div className="sheet-box">
       <div className="sheet-box">
@@ -77,27 +77,27 @@ const Popcontactform = props => {
               <div className="sheet-left-panel pr-4">
               <div className="sheet-left-panel pr-4">
               <Row>
               <Row>
                 <Col span={12}><h2>刘泽富</h2></Col>
                 <Col span={12}><h2>刘泽富</h2></Col>
-                <Col span={12} className={["text-right",styles.textMuted]}>陈特 创建于 2019年5月6日 14:55</Col>
+                <Col span={12} className={[ "text-right",styles.textMuted ]}>陈特 创建于 2019年5月6日 14:55</Col>
               </Row>
               </Row>
               <Form layout="vertical" form={form}>
               <Form layout="vertical" form={form}>
                 <Form.Item
                 <Form.Item
                   label="姓名"
                   label="姓名"
                   name="clientname"
                   name="clientname"
-                  rules={[{ required: false, message: '姓名' }]}
+                  rules={[ { required: false, message: '姓名' } ]}
                   >
                   >
                   <Input value="刘泽富" />
                   <Input value="刘泽富" />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="联系人地区"
                   label="联系人地区"
                   name="local"
                   name="local"
-                  rules={[{ required: false, message: '地区' }]}
+                  rules={[ { required: false, message: '地区' } ]}
                   >
                   >
                   <Cascader options={residences} />
                   <Cascader options={residences} />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="客户名称"
                   label="客户名称"
                   name="companyname"
                   name="companyname"
-                  rules={[{ required: false, message: '客户名称' }]}
+                  rules={[ { required: false, message: '客户名称' } ]}
                   >
                   >
                   <Input value="刘泽富" />
                   <Input value="刘泽富" />
                 </Form.Item>
                 </Form.Item>
@@ -106,7 +106,7 @@ const Popcontactform = props => {
                     <Form.Item
                     <Form.Item
                     label="性别"
                     label="性别"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '性别' }]}
+                    rules={[ { required: false, message: '性别' } ]}
                     >
                     >
                     <Select>
                     <Select>
                       <Select.Option value="男">男</Select.Option>
                       <Select.Option value="男">男</Select.Option>
@@ -118,7 +118,7 @@ const Popcontactform = props => {
                   <Form.Item
                   <Form.Item
                     label="昵称"
                     label="昵称"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '昵称' }]}
+                    rules={[ { required: false, message: '昵称' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -129,7 +129,7 @@ const Popcontactform = props => {
                     <Form.Item
                     <Form.Item
                     label="手机"
                     label="手机"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '手机' }]}
+                    rules={[ { required: false, message: '手机' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -138,7 +138,7 @@ const Popcontactform = props => {
                   <Form.Item
                   <Form.Item
                     label="QQ"
                     label="QQ"
                     name=""
                     name=""
-                    rules={[{ required: false, message: 'QQ' }]}
+                    rules={[ { required: false, message: 'QQ' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -149,7 +149,7 @@ const Popcontactform = props => {
                     <Form.Item
                     <Form.Item
                     label="电话"
                     label="电话"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '电话' }]}
+                    rules={[ { required: false, message: '电话' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -158,7 +158,7 @@ const Popcontactform = props => {
                   <Form.Item
                   <Form.Item
                     label="邮箱"
                     label="邮箱"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '邮箱' }]}
+                    rules={[ { required: false, message: '邮箱' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -169,7 +169,7 @@ const Popcontactform = props => {
                     <Form.Item
                     <Form.Item
                     label="传真"
                     label="传真"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '传真' }]}
+                    rules={[ { required: false, message: '传真' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -181,7 +181,7 @@ const Popcontactform = props => {
                     <Form.Item
                     <Form.Item
                     label="部门"
                     label="部门"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '部门' }]}
+                    rules={[ { required: false, message: '部门' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -190,7 +190,7 @@ const Popcontactform = props => {
                   <Form.Item
                   <Form.Item
                     label="职务"
                     label="职务"
                     name=""
                     name=""
-                    rules={[{ required: false, message: '职务' }]}
+                    rules={[ { required: false, message: '职务' } ]}
                     >
                     >
                     <Input value="" />
                     <Input value="" />
                     </Form.Item>
                     </Form.Item>
@@ -199,42 +199,42 @@ const Popcontactform = props => {
                 <Form.Item
                 <Form.Item
                   label="办公室"
                   label="办公室"
                   name=""
                   name=""
-                  rules={[{ required: false, message: '办公室' }]}
+                  rules={[ { required: false, message: '办公室' } ]}
                   >
                   >
                   <Input value="" />
                   <Input value="" />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="联系人地址"
                   label="联系人地址"
                   name=""
                   name=""
-                  rules={[{ required: false, message: '联系人地址' }]}
+                  rules={[ { required: false, message: '联系人地址' } ]}
                   >
                   >
                   <Input value="" />
                   <Input value="" />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="联系人乘车"
                   label="联系人乘车"
                   name=""
                   name=""
-                  rules={[{ required: false, message: '联系人乘车' }]}
+                  rules={[ { required: false, message: '联系人乘车' } ]}
                   >
                   >
                   <Input value="" />
                   <Input value="" />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="联系人地标"
                   label="联系人地标"
                   name=""
                   name=""
-                  rules={[{ required: false, message: '联系人地标' }]}
+                  rules={[ { required: false, message: '联系人地标' } ]}
                   >
                   >
                   <Input value="" />
                   <Input value="" />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="联系人住宿"
                   label="联系人住宿"
                   name=""
                   name=""
-                  rules={[{ required: false, message: '联系人住宿' }]}
+                  rules={[ { required: false, message: '联系人住宿' } ]}
                   >
                   >
                   <Input value="" />
                   <Input value="" />
                 </Form.Item>
                 </Form.Item>
                 <Form.Item
                 <Form.Item
                   label="备注"
                   label="备注"
                   name=""
                   name=""
-                  rules={[{ required: false, message: '备注' }]}
+                  rules={[ { required: false, message: '备注' } ]}
                   >
                   >
                   <Input value="" />
                   <Input value="" />
                 </Form.Item>
                 </Form.Item>

+ 8 - 0
src/components/SvgIcon/index.jsx

@@ -0,0 +1,8 @@
+import { createFromIconfontCN } from '@ant-design/icons'
+import setting from '../../../config/defaultSettings'
+
+console.log(setting)
+const IconFont = createFromIconfontCN({
+  scriptUrl: setting.iconfontUrl
+})
+export default IconFont

+ 12 - 0
src/components/SvgIcon/index.less

@@ -0,0 +1,12 @@
+.svg-icon {
+  line-height: 1em;
+  vertical-align: text-bottom;
+  .svg-class {
+    display: inline-block;
+    width: 1em;
+    height: 1em;
+    margin-right: 5px;
+    overflow: hidden;
+    vertical-align: baseline;
+  }
+}

+ 1 - 1
src/e2e/__mocks__/antd-pro-merge-less.js

@@ -1 +1 @@
-export default undefined;
+export default undefined

+ 33 - 33
src/e2e/baseLayout.e2e.js

@@ -1,57 +1,57 @@
-const { uniq } = require('lodash');
-const RouterConfig = require('../../config/config').default.routes;
+const { uniq } = require('lodash')
+const RouterConfig = require('../../config/config').default.routes
 
 
-const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
+const BASE_URL = `http://localhost:${process.env.PORT || 8000}`
 
 
 function formatter(routes, parentPath = '') {
 function formatter(routes, parentPath = '') {
-  const fixedParentPath = parentPath.replace(/\/{1,}/g, '/');
-  let result = [];
+  const fixedParentPath = parentPath.replace(/\/{1,}/g, '/')
+  let result = []
   routes.forEach((item) => {
   routes.forEach((item) => {
     if (item.path) {
     if (item.path) {
-      result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'));
+      result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'))
     }
     }
     if (item.routes) {
     if (item.routes) {
       result = result.concat(
       result = result.concat(
-        formatter(item.routes, item.path ? `${fixedParentPath}/${item.path}` : parentPath),
-      );
+        formatter(item.routes, item.path ? `${fixedParentPath}/${item.path}` : parentPath)
+      )
     }
     }
-  });
-  return uniq(result.filter((item) => !!item));
+  })
+  return uniq(result.filter((item) => !!item))
 }
 }
 
 
 beforeEach(async () => {
 beforeEach(async () => {
-  await page.goto(`${BASE_URL}`);
+  await page.goto(`${BASE_URL}`)
   await page.evaluate(() => {
   await page.evaluate(() => {
-    localStorage.setItem('antd-pro-authority', '["admin"]');
-  });
-});
+    localStorage.setItem('antd-pro-authority', '["admin"]')
+  })
+})
 
 
 describe('Ant Design Pro E2E test', () => {
 describe('Ant Design Pro E2E test', () => {
   const testPage = (path) => async () => {
   const testPage = (path) => async () => {
-    await page.goto(`${BASE_URL}${path}`);
+    await page.goto(`${BASE_URL}${path}`)
     await page.waitForSelector('footer', {
     await page.waitForSelector('footer', {
-      timeout: 2000,
-    });
+      timeout: 2000
+    })
     const haveFooter = await page.evaluate(
     const haveFooter = await page.evaluate(
-      () => document.getElementsByTagName('footer').length > 0,
-    );
-    expect(haveFooter).toBeTruthy();
-  };
+      () => document.getElementsByTagName('footer').length > 0
+    )
+    expect(haveFooter).toBeTruthy()
+  }
 
 
-  const routers = formatter(RouterConfig);
+  const routers = formatter(RouterConfig)
   routers.forEach((route) => {
   routers.forEach((route) => {
-    it(`test pages ${route}`, testPage(route));
-  });
+    it(`test pages ${route}`, testPage(route))
+  })
 
 
   it('topmenu should have footer', async () => {
   it('topmenu should have footer', async () => {
-    const params = '?navTheme=light&layout=topmenu';
-    await page.goto(`${BASE_URL}${params}`);
+    const params = '?navTheme=light&layout=topmenu'
+    await page.goto(`${BASE_URL}${params}`)
     await page.waitForSelector('footer', {
     await page.waitForSelector('footer', {
-      timeout: 2000,
-    });
+      timeout: 2000
+    })
     const haveFooter = await page.evaluate(
     const haveFooter = await page.evaluate(
-      () => document.getElementsByTagName('footer').length > 0,
-    );
-    expect(haveFooter).toBeTruthy();
-  });
-});
+      () => document.getElementsByTagName('footer').length > 0
+    )
+    expect(haveFooter).toBeTruthy()
+  })
+})

+ 43 - 43
src/global.jsx

@@ -1,103 +1,103 @@
-import { Button, message, notification } from 'antd';
-import React from 'react';
-import { useIntl } from 'umi';
-import defaultSettings from '../config/defaultSettings';
+import { Button, message, notification } from 'antd'
+import React from 'react'
+import { useIntl } from 'umi'
+import defaultSettings from '../config/defaultSettings'
 
 
-const { pwa } = defaultSettings;
-const isHttps = document.location.protocol === 'https:'; // if pwa is true
+const { pwa } = defaultSettings
+const isHttps = document.location.protocol === 'https:' // if pwa is true
 
 
 if (pwa) {
 if (pwa) {
   // Notify user if offline now
   // Notify user if offline now
   window.addEventListener('sw.offline', () => {
   window.addEventListener('sw.offline', () => {
     message.warning(
     message.warning(
       useIntl().formatMessage({
       useIntl().formatMessage({
-        id: 'app.pwa.offline',
-      }),
-    );
-  }); // Pop up a prompt on the page asking the user if they want to use the latest version
+        id: 'app.pwa.offline'
+      })
+    )
+  }) // Pop up a prompt on the page asking the user if they want to use the latest version
 
 
   window.addEventListener('sw.updated', (event) => {
   window.addEventListener('sw.updated', (event) => {
-    const e = event;
+    const e = event
 
 
     const reloadSW = async () => {
     const reloadSW = async () => {
       // Check if there is sw whose state is waiting in ServiceWorkerRegistration
       // Check if there is sw whose state is waiting in ServiceWorkerRegistration
       // https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration
       // https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration
-      const worker = e.detail && e.detail.waiting;
+      const worker = e.detail && e.detail.waiting
 
 
       if (!worker) {
       if (!worker) {
-        return true;
+        return true
       } // Send skip-waiting event to waiting SW with MessageChannel
       } // Send skip-waiting event to waiting SW with MessageChannel
 
 
       await new Promise((resolve, reject) => {
       await new Promise((resolve, reject) => {
-        const channel = new MessageChannel();
+        const channel = new MessageChannel()
 
 
         channel.port1.onmessage = (msgEvent) => {
         channel.port1.onmessage = (msgEvent) => {
           if (msgEvent.data.error) {
           if (msgEvent.data.error) {
-            reject(msgEvent.data.error);
+            reject(msgEvent.data.error)
           } else {
           } else {
-            resolve(msgEvent.data);
+            resolve(msgEvent.data)
           }
           }
-        };
+        }
 
 
         worker.postMessage(
         worker.postMessage(
           {
           {
-            type: 'skip-waiting',
+            type: 'skip-waiting'
           },
           },
-          [channel.port2],
-        );
-      }); // Refresh current page to use the updated HTML and other assets after SW has skiped waiting
+          [ channel.port2 ]
+        )
+      }) // Refresh current page to use the updated HTML and other assets after SW has skiped waiting
 
 
-      window.location.reload(true);
-      return true;
-    };
+      window.location.reload(true)
+      return true
+    }
 
 
-    const key = `open${Date.now()}`;
+    const key = `open${Date.now()}`
     const btn = (
     const btn = (
       <Button
       <Button
         type="primary"
         type="primary"
         onClick={() => {
         onClick={() => {
-          notification.close(key);
-          reloadSW();
+          notification.close(key)
+          reloadSW()
         }}
         }}
       >
       >
         {useIntl().formatMessage({
         {useIntl().formatMessage({
-          id: 'app.pwa.serviceworker.updated.ok',
+          id: 'app.pwa.serviceworker.updated.ok'
         })}
         })}
       </Button>
       </Button>
-    );
+    )
     notification.open({
     notification.open({
       message: useIntl().formatMessage({
       message: useIntl().formatMessage({
-        id: 'app.pwa.serviceworker.updated',
+        id: 'app.pwa.serviceworker.updated'
       }),
       }),
       description: useIntl().formatMessage({
       description: useIntl().formatMessage({
-        id: 'app.pwa.serviceworker.updated.hint',
+        id: 'app.pwa.serviceworker.updated.hint'
       }),
       }),
       btn,
       btn,
       key,
       key,
-      onClose: async () => {},
-    });
-  });
+      onClose: async () => {}
+    })
+  })
 } else if ('serviceWorker' in navigator && isHttps) {
 } else if ('serviceWorker' in navigator && isHttps) {
   // unregister service worker
   // unregister service worker
-  const { serviceWorker } = navigator;
+  const { serviceWorker } = navigator
 
 
   if (serviceWorker.getRegistrations) {
   if (serviceWorker.getRegistrations) {
     serviceWorker.getRegistrations().then((sws) => {
     serviceWorker.getRegistrations().then((sws) => {
       sws.forEach((sw) => {
       sws.forEach((sw) => {
-        sw.unregister();
-      });
-    });
+        sw.unregister()
+      })
+    })
   }
   }
 
 
   serviceWorker.getRegistration().then((sw) => {
   serviceWorker.getRegistration().then((sw) => {
-    if (sw) sw.unregister();
-  }); // remove all caches
+    if (sw) sw.unregister()
+  }) // remove all caches
 
 
   if (window.caches && window.caches.keys) {
   if (window.caches && window.caches.keys) {
     caches.keys().then((keys) => {
     caches.keys().then((keys) => {
       keys.forEach((key) => {
       keys.forEach((key) => {
-        caches.delete(key);
-      });
-    });
+        caches.delete(key)
+      })
+    })
   }
   }
 }
 }

+ 42 - 42
src/layouts/BasicLayout.jsx

@@ -3,16 +3,16 @@
  * You can view component api by:
  * You can view component api by:
  * https://github.com/ant-design/ant-design-pro-layout
  * https://github.com/ant-design/ant-design-pro-layout
  */
  */
-import ProLayout, { DefaultFooter } from '@ant-design/pro-layout';
-import React, { useEffect, useMemo, useRef } from 'react';
-import { Link, useIntl, connect, history } from 'umi';
-import { GithubOutlined } from '@ant-design/icons';
-import { Result, Button } from 'antd';
-import Authorized from '@/utils/Authorized';
-import RightContent from '@/components/GlobalHeader/RightContent';
-import { getMatchMenu } from '@umijs/route-utils';
-import logo from '../assets/logo.svg';
-import styles from './BasicLayout.less';
+import ProLayout, { DefaultFooter } from '@ant-design/pro-layout'
+import React, { useEffect, useMemo, useRef } from 'react'
+import { Link, useIntl, connect, history } from 'umi'
+import { GithubOutlined } from '@ant-design/icons'
+import { Result, Button } from 'antd'
+import Authorized from '@/utils/Authorized'
+import RightContent from '@/components/GlobalHeader/RightContent'
+import { getMatchMenu } from '@umijs/route-utils'
+import logo from '../assets/logo.svg'
+import styles from './BasicLayout.less'
 
 
 const noMatch = (
 const noMatch = (
   <Result
   <Result
@@ -25,7 +25,7 @@ const noMatch = (
       </Button>
       </Button>
     }
     }
   />
   />
-);
+)
 
 
 /**
 /**
  * use Authorized check all menu item
  * use Authorized check all menu item
@@ -34,10 +34,10 @@ const menuDataRender = (menuList) =>
   menuList.map((item) => {
   menuList.map((item) => {
     const localItem = {
     const localItem = {
       ...item,
       ...item,
-      children: item.children ? menuDataRender(item.children) : undefined,
-    };
-    return Authorized.check(item.authority, localItem, null);
-  });
+      children: item.children ? menuDataRender(item.children) : undefined
+    }
+    return Authorized.check(item.authority, localItem, null)
+  })
 
 
 // const defaultFooterDom = (
 // const defaultFooterDom = (
 //   <DefaultFooter
 //   <DefaultFooter
@@ -71,17 +71,17 @@ const BasicLayout = (props) => {
     children,
     children,
     settings,
     settings,
     location = {
     location = {
-      pathname: '/',
-    },
-  } = props;
-  const menuDataRef = useRef([]);
+      pathname: '/'
+    }
+  } = props
+  const menuDataRef = useRef([])
   useEffect(() => {
   useEffect(() => {
     if (dispatch) {
     if (dispatch) {
       dispatch({
       dispatch({
-        type: 'user/fetchCurrent',
-      });
+        type: 'user/fetchCurrent'
+      })
     }
     }
-  }, []);
+  }, [])
   /**
   /**
    * init variables
    * init variables
    */
    */
@@ -90,19 +90,19 @@ const BasicLayout = (props) => {
     if (dispatch) {
     if (dispatch) {
       dispatch({
       dispatch({
         type: 'global/changeLayoutCollapsed',
         type: 'global/changeLayoutCollapsed',
-        payload,
-      });
+        payload
+      })
     }
     }
-  }; // get children authority
+  } // get children authority
 
 
   const authorized = useMemo(
   const authorized = useMemo(
     () =>
     () =>
       getMatchMenu(location.pathname || '/', menuDataRef.current).pop() || {
       getMatchMenu(location.pathname || '/', menuDataRef.current).pop() || {
-        authority: undefined,
+        authority: undefined
       },
       },
-    [location.pathname],
-  );
-  const { formatMessage } = useIntl();
+    [ location.pathname ]
+  )
+  const { formatMessage } = useIntl()
   return (
   return (
     <ProLayout
     <ProLayout
       className={styles.layoutBg}
       className={styles.layoutBg}
@@ -114,44 +114,44 @@ const BasicLayout = (props) => {
       onMenuHeaderClick={() => history.push('/')}
       onMenuHeaderClick={() => history.push('/')}
       menuItemRender={(menuItemProps, defaultDom) => {
       menuItemRender={(menuItemProps, defaultDom) => {
         if (menuItemProps.isUrl || !menuItemProps.path) {
         if (menuItemProps.isUrl || !menuItemProps.path) {
-          return defaultDom;
+          return defaultDom
         }
         }
 
 
-        return <Link to={menuItemProps.path}>{defaultDom}</Link>;
+        return <Link to={menuItemProps.path}>{defaultDom}</Link>
       }}
       }}
       breadcrumbRender={(routers = []) => [
       breadcrumbRender={(routers = []) => [
         {
         {
           path: '/',
           path: '/',
           breadcrumbName: formatMessage({
           breadcrumbName: formatMessage({
-            id: 'menu.home',
-          }),
+            id: 'menu.home'
+          })
         },
         },
-        ...routers,
+        ...routers
       ]}
       ]}
       itemRender={(route, params, routes, paths) => {
       itemRender={(route, params, routes, paths) => {
-        const first = routes.indexOf(route) === 0;
+        const first = routes.indexOf(route) === 0
         return first ? (
         return first ? (
           <Link to={paths.join('/')}>{route.breadcrumbName}</Link>
           <Link to={paths.join('/')}>{route.breadcrumbName}</Link>
         ) : (
         ) : (
           <span>{route.breadcrumbName}</span>
           <span>{route.breadcrumbName}</span>
-        );
+        )
       }}
       }}
       // footerRender={() => defaultFooterDom}
       // footerRender={() => defaultFooterDom}
       menuDataRender={menuDataRender}
       menuDataRender={menuDataRender}
       rightContentRender={() => <RightContent />}
       rightContentRender={() => <RightContent />}
       postMenuData={(menuData) => {
       postMenuData={(menuData) => {
-        menuDataRef.current = menuData || [];
-        return menuData || [];
+        menuDataRef.current = menuData || []
+        return menuData || []
       }}
       }}
     >
     >
       <Authorized authority={authorized.authority} noMatch={noMatch}>
       <Authorized authority={authorized.authority} noMatch={noMatch}>
         {children}
         {children}
       </Authorized>
       </Authorized>
     </ProLayout>
     </ProLayout>
-  );
-};
+  )
+}
 
 
 export default connect(({ global, settings }) => ({
 export default connect(({ global, settings }) => ({
   collapsed: global.collapsed,
   collapsed: global.collapsed,
-  settings,
-}))(BasicLayout);
+  settings
+}))(BasicLayout)

+ 3 - 3
src/layouts/BlankLayout.jsx

@@ -1,5 +1,5 @@
-import React from 'react';
+import React from 'react'
 
 
-const Layout = ({ children }) => <>{children}</>;
+const Layout = ({ children }) => <>{children}</>
 
 
-export default Layout;
+export default Layout

+ 20 - 20
src/layouts/SecurityLayout.jsx

@@ -1,49 +1,49 @@
-import React from 'react';
-import { PageLoading } from '@ant-design/pro-layout';
-import { Redirect, connect } from 'umi';
-import { stringify } from 'querystring';
+import React from 'react'
+import { PageLoading } from '@ant-design/pro-layout'
+import { Redirect, connect } from 'umi'
+import { stringify } from 'querystring'
 
 
 class SecurityLayout extends React.Component {
 class SecurityLayout extends React.Component {
   state = {
   state = {
-    isReady: false,
+    isReady: false
   };
   };
 
 
   componentDidMount() {
   componentDidMount() {
     this.setState({
     this.setState({
-      isReady: true,
-    });
-    const { dispatch } = this.props;
+      isReady: true
+    })
+    const { dispatch } = this.props
 
 
     if (dispatch) {
     if (dispatch) {
       dispatch({
       dispatch({
-        type: 'user/fetchCurrent',
-      });
+        type: 'user/fetchCurrent'
+      })
     }
     }
   }
   }
 
 
   render() {
   render() {
-    const { isReady } = this.state;
-    const { children, loading, currentUser } = this.props; // You can replace it to your authentication rule (such as check token exists)
+    const { isReady } = this.state
+    const { children, loading, currentUser } = this.props // You can replace it to your authentication rule (such as check token exists)
     // 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
     // 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
 
 
-    const isLogin = currentUser && currentUser.userid;
+    const isLogin = currentUser && currentUser.userid
     const queryString = stringify({
     const queryString = stringify({
-      redirect: window.location.href,
-    });
+      redirect: window.location.href
+    })
 
 
     if ((!isLogin && loading) || !isReady) {
     if ((!isLogin && loading) || !isReady) {
-      return <PageLoading />;
+      return <PageLoading />
     }
     }
 
 
     if (!isLogin && window.location.pathname !== '/user/login') {
     if (!isLogin && window.location.pathname !== '/user/login') {
-      return <Redirect to={`/user/login?${queryString}`} />;
+      return <Redirect to={`/user/login?${queryString}`} />
     }
     }
 
 
-    return children;
+    return children
   }
   }
 }
 }
 
 
 export default connect(({ user, loading }) => ({
 export default connect(({ user, loading }) => ({
   currentUser: user.currentUser,
   currentUser: user.currentUser,
-  loading: loading.models.user,
-}))(SecurityLayout);
+  loading: loading.models.user
+}))(SecurityLayout)

+ 20 - 20
src/layouts/UserLayout.jsx

@@ -1,31 +1,31 @@
-import { DefaultFooter, getMenuData, getPageTitle } from '@ant-design/pro-layout';
-import { Helmet, HelmetProvider } from 'react-helmet-async';
-import { Link, SelectLang, useIntl, connect, FormattedMessage } from 'umi';
-import React from 'react';
-import logo from '../assets/logo.svg';
-import styles from './UserLayout.less';
+import { DefaultFooter, getMenuData, getPageTitle } from '@ant-design/pro-layout'
+import { Helmet, HelmetProvider } from 'react-helmet-async'
+import { Link, SelectLang, useIntl, connect, FormattedMessage } from 'umi'
+import React from 'react'
+import logo from '../assets/logo.svg'
+import styles from './UserLayout.less'
 
 
 const UserLayout = (props) => {
 const UserLayout = (props) => {
   const {
   const {
     route = {
     route = {
-      routes: [],
-    },
-  } = props;
-  const { routes = [] } = route;
+      routes: []
+    }
+  } = props
+  const { routes = [] } = route
   const {
   const {
     children,
     children,
     location = {
     location = {
-      pathname: '',
-    },
-  } = props;
-  const { formatMessage } = useIntl();
-  const { breadcrumb } = getMenuData(routes);
+      pathname: ''
+    }
+  } = props
+  const { formatMessage } = useIntl()
+  const { breadcrumb } = getMenuData(routes)
   const title = getPageTitle({
   const title = getPageTitle({
     pathname: location.pathname,
     pathname: location.pathname,
     formatMessage,
     formatMessage,
     breadcrumb,
     breadcrumb,
-    ...props,
-  });
+    ...props
+  })
   return (
   return (
     <HelmetProvider>
     <HelmetProvider>
       <Helmet>
       <Helmet>
@@ -57,7 +57,7 @@ const UserLayout = (props) => {
         {/* <DefaultFooter /> */}
         {/* <DefaultFooter /> */}
       </div>
       </div>
     </HelmetProvider>
     </HelmetProvider>
-  );
-};
+  )
+}
 
 
-export default connect(({ settings }) => ({ ...settings }))(UserLayout);
+export default connect(({ settings }) => ({ ...settings }))(UserLayout)

+ 9 - 9
src/locales/en-US.js

@@ -1,10 +1,10 @@
-import component from './en-US/component';
-import globalHeader from './en-US/globalHeader';
-import menu from './en-US/menu';
-import pwa from './en-US/pwa';
-import settingDrawer from './en-US/settingDrawer';
-import settings from './en-US/settings';
-import pages from './en-US/pages';
+import component from './en-US/component'
+import globalHeader from './en-US/globalHeader'
+import menu from './en-US/menu'
+import pwa from './en-US/pwa'
+import settingDrawer from './en-US/settingDrawer'
+import settings from './en-US/settings'
+import pages from './en-US/pages'
 
 
 export default {
 export default {
   'navBar.lang': 'Languages',
   'navBar.lang': 'Languages',
@@ -20,5 +20,5 @@ export default {
   ...settings,
   ...settings,
   ...pwa,
   ...pwa,
   ...component,
   ...component,
-  ...pages,
-};
+  ...pages
+}

+ 2 - 2
src/locales/en-US/component.js

@@ -1,5 +1,5 @@
 export default {
 export default {
   'component.tagSelect.expand': 'Expand',
   'component.tagSelect.expand': 'Expand',
   'component.tagSelect.collapse': 'Collapse',
   'component.tagSelect.collapse': 'Collapse',
-  'component.tagSelect.all': 'All',
-};
+  'component.tagSelect.all': 'All'
+}

+ 2 - 2
src/locales/en-US/globalHeader.js

@@ -13,5 +13,5 @@ export default {
   'component.noticeIcon.clear': 'Clear',
   'component.noticeIcon.clear': 'Clear',
   'component.noticeIcon.cleared': 'Cleared',
   'component.noticeIcon.cleared': 'Cleared',
   'component.noticeIcon.empty': 'No notifications',
   'component.noticeIcon.empty': 'No notifications',
-  'component.noticeIcon.view-more': 'View more',
-};
+  'component.noticeIcon.view-more': 'View more'
+}

+ 2 - 2
src/locales/en-US/menu.js

@@ -48,5 +48,5 @@ export default {
   'menu.editor': 'Graphic Editor',
   'menu.editor': 'Graphic Editor',
   'menu.editor.flow': 'Flow Editor',
   'menu.editor.flow': 'Flow Editor',
   'menu.editor.mind': 'Mind Editor',
   'menu.editor.mind': 'Mind Editor',
-  'menu.editor.koni': 'Koni Editor',
-};
+  'menu.editor.koni': 'Koni Editor'
+}

+ 2 - 2
src/locales/en-US/pages.js

@@ -20,5 +20,5 @@ export default {
   'pages.login.forgotPassword': 'Forgot Password ?',
   'pages.login.forgotPassword': 'Forgot Password ?',
   'pages.login.submit': 'Submit',
   'pages.login.submit': 'Submit',
   'pages.login.loginWith': 'Login with :',
   'pages.login.loginWith': 'Login with :',
-  'pages.login.registerAccount': 'Register Account',
-};
+  'pages.login.registerAccount': 'Register Account'
+}

+ 2 - 2
src/locales/en-US/pwa.js

@@ -2,5 +2,5 @@ export default {
   'app.pwa.offline': 'You are offline now',
   'app.pwa.offline': 'You are offline now',
   'app.pwa.serviceworker.updated': 'New content is available',
   'app.pwa.serviceworker.updated': 'New content is available',
   'app.pwa.serviceworker.updated.hint': 'Please press the "Refresh" button to reload current page',
   'app.pwa.serviceworker.updated.hint': 'Please press the "Refresh" button to reload current page',
-  'app.pwa.serviceworker.updated.ok': 'Refresh',
-};
+  'app.pwa.serviceworker.updated.ok': 'Refresh'
+}

+ 2 - 2
src/locales/en-US/settingDrawer.js

@@ -27,5 +27,5 @@ export default {
   'app.setting.copy': 'Copy Setting',
   'app.setting.copy': 'Copy Setting',
   'app.setting.copyinfo': 'copy success,please replace defaultSettings in src/models/setting.js',
   'app.setting.copyinfo': 'copy success,please replace defaultSettings in src/models/setting.js',
   'app.setting.production.hint':
   'app.setting.production.hint':
-    'Setting panel shows in development environment only, please manually modify',
-};
+    'Setting panel shows in development environment only, please manually modify'
+}

+ 2 - 2
src/locales/en-US/settings.js

@@ -56,5 +56,5 @@ export default {
   'app.settings.notification.todo-description':
   'app.settings.notification.todo-description':
     'The to-do list will be notified in the form of a letter from the station',
     'The to-do list will be notified in the form of a letter from the station',
   'app.settings.open': 'Open',
   'app.settings.open': 'Open',
-  'app.settings.close': 'Close',
-};
+  'app.settings.close': 'Close'
+}

+ 8 - 8
src/locales/id-ID.js

@@ -1,9 +1,9 @@
-import component from './id-ID/component';
-import globalHeader from './id-ID/globalHeader';
-import menu from './id-ID/menu';
-import pwa from './id-ID/pwa';
-import settingDrawer from './id-ID/settingDrawer';
-import settings from './id-ID/settings';
+import component from './id-ID/component'
+import globalHeader from './id-ID/globalHeader'
+import menu from './id-ID/menu'
+import pwa from './id-ID/pwa'
+import settingDrawer from './id-ID/settingDrawer'
+import settings from './id-ID/settings'
 
 
 export default {
 export default {
   'navbar.lang': 'Bahasa',
   'navbar.lang': 'Bahasa',
@@ -19,5 +19,5 @@ export default {
   ...settingDrawer,
   ...settingDrawer,
   ...settings,
   ...settings,
   ...pwa,
   ...pwa,
-  ...component,
-};
+  ...component
+}

+ 2 - 2
src/locales/id-ID/component.js

@@ -1,5 +1,5 @@
 export default {
 export default {
   'component.tagSelect.expand': 'Perluas',
   'component.tagSelect.expand': 'Perluas',
   'component.tagSelect.collapse': 'Lipat',
   'component.tagSelect.collapse': 'Lipat',
-  'component.tagSelect.all': 'Semua',
-};
+  'component.tagSelect.all': 'Semua'
+}

+ 2 - 2
src/locales/id-ID/globalHeader.js

@@ -13,5 +13,5 @@ export default {
   'component.noticeIcon.clear': 'Kosongkan',
   'component.noticeIcon.clear': 'Kosongkan',
   'component.noticeIcon.cleared': 'Berhasil dikosongkan',
   'component.noticeIcon.cleared': 'Berhasil dikosongkan',
   'component.noticeIcon.empty': 'Tidak ada pemberitahuan',
   'component.noticeIcon.empty': 'Tidak ada pemberitahuan',
-  'component.noticeIcon.view-more': 'Melihat lebih',
-};
+  'component.noticeIcon.view-more': 'Melihat lebih'
+}

+ 2 - 2
src/locales/id-ID/menu.js

@@ -48,5 +48,5 @@ export default {
   'menu.editor': 'Penyusun Grafis',
   'menu.editor': 'Penyusun Grafis',
   'menu.editor.flow': 'Penyusun Alur',
   'menu.editor.flow': 'Penyusun Alur',
   'menu.editor.mind': 'Penyusun Mind',
   'menu.editor.mind': 'Penyusun Mind',
-  'menu.editor.koni': 'Penyusun Koni',
-};
+  'menu.editor.koni': 'Penyusun Koni'
+}

+ 2 - 2
src/locales/id-ID/pwa.js

@@ -3,5 +3,5 @@ export default {
   'app.pwa.serviceworker.updated': 'Konten baru sudah tersedia',
   'app.pwa.serviceworker.updated': 'Konten baru sudah tersedia',
   'app.pwa.serviceworker.updated.hint':
   'app.pwa.serviceworker.updated.hint':
     'Silahkan klik tombol "Refresh" untuk memuat ulang halaman ini',
     'Silahkan klik tombol "Refresh" untuk memuat ulang halaman ini',
-  'app.pwa.serviceworker.updated.ok': 'Memuat ulang',
-};
+  'app.pwa.serviceworker.updated.ok': 'Memuat ulang'
+}

+ 2 - 2
src/locales/id-ID/settingDrawer.js

@@ -29,5 +29,5 @@ export default {
   'app.setting.copyinfo':
   'app.setting.copyinfo':
     'Berhasil disalin,tolong ubah defaultSettings pada src/models/setting.js',
     'Berhasil disalin,tolong ubah defaultSettings pada src/models/setting.js',
   'app.setting.production.hint':
   'app.setting.production.hint':
-    'Panel pengaturan hanya muncul pada lingkungan pengembangan, silahkan modifikasi secara menual',
-};
+    'Panel pengaturan hanya muncul pada lingkungan pengembangan, silahkan modifikasi secara menual'
+}

+ 2 - 2
src/locales/id-ID/settings.js

@@ -56,5 +56,5 @@ export default {
   'app.settings.notification.todo-description':
   'app.settings.notification.todo-description':
     'Daftar to-do akan diberitahukan dalam bentuk surat dari stasiun',
     'Daftar to-do akan diberitahukan dalam bentuk surat dari stasiun',
   'app.settings.open': 'Buka',
   'app.settings.open': 'Buka',
-  'app.settings.close': 'Tutup',
-};
+  'app.settings.close': 'Tutup'
+}

+ 8 - 8
src/locales/pt-BR.js

@@ -1,9 +1,9 @@
-import component from './pt-BR/component';
-import globalHeader from './pt-BR/globalHeader';
-import menu from './pt-BR/menu';
-import pwa from './pt-BR/pwa';
-import settingDrawer from './pt-BR/settingDrawer';
-import settings from './pt-BR/settings';
+import component from './pt-BR/component'
+import globalHeader from './pt-BR/globalHeader'
+import menu from './pt-BR/menu'
+import pwa from './pt-BR/pwa'
+import settingDrawer from './pt-BR/settingDrawer'
+import settings from './pt-BR/settings'
 
 
 export default {
 export default {
   'navBar.lang': 'Idiomas',
   'navBar.lang': 'Idiomas',
@@ -16,5 +16,5 @@ export default {
   ...settingDrawer,
   ...settingDrawer,
   ...settings,
   ...settings,
   ...pwa,
   ...pwa,
-  ...component,
-};
+  ...component
+}

+ 2 - 2
src/locales/pt-BR/component.js

@@ -1,5 +1,5 @@
 export default {
 export default {
   'component.tagSelect.expand': 'Expandir',
   'component.tagSelect.expand': 'Expandir',
   'component.tagSelect.collapse': 'Diminuir',
   'component.tagSelect.collapse': 'Diminuir',
-  'component.tagSelect.all': 'Todas',
-};
+  'component.tagSelect.all': 'Todas'
+}

+ 2 - 2
src/locales/pt-BR/globalHeader.js

@@ -14,5 +14,5 @@ export default {
   'component.noticeIcon.cleared': 'Limpo',
   'component.noticeIcon.cleared': 'Limpo',
   'component.noticeIcon.empty': 'Sem notificações',
   'component.noticeIcon.empty': 'Sem notificações',
   'component.noticeIcon.loaded': 'Carregado',
   'component.noticeIcon.loaded': 'Carregado',
-  'component.noticeIcon.view-more': 'Veja mais',
-};
+  'component.noticeIcon.view-more': 'Veja mais'
+}

+ 2 - 2
src/locales/pt-BR/menu.js

@@ -48,5 +48,5 @@ export default {
   'menu.editor': 'Graphic Editor',
   'menu.editor': 'Graphic Editor',
   'menu.editor.flow': 'Flow Editor',
   'menu.editor.flow': 'Flow Editor',
   'menu.editor.mind': 'Mind Editor',
   'menu.editor.mind': 'Mind Editor',
-  'menu.editor.koni': 'Koni Editor',
-};
+  'menu.editor.koni': 'Koni Editor'
+}

+ 2 - 2
src/locales/pt-BR/pwa.js

@@ -3,5 +3,5 @@ export default {
   'app.pwa.serviceworker.updated': 'Novo conteúdo está disponível',
   'app.pwa.serviceworker.updated': 'Novo conteúdo está disponível',
   'app.pwa.serviceworker.updated.hint':
   'app.pwa.serviceworker.updated.hint':
     'Por favor, pressione o botão "Atualizar" para recarregar a página atual',
     'Por favor, pressione o botão "Atualizar" para recarregar a página atual',
-  'app.pwa.serviceworker.updated.ok': 'Atualizar',
-};
+  'app.pwa.serviceworker.updated.ok': 'Atualizar'
+}

+ 2 - 2
src/locales/pt-BR/settingDrawer.js

@@ -28,5 +28,5 @@ export default {
   'app.setting.copyinfo':
   'app.setting.copyinfo':
     'copiado com sucesso,por favor trocar o defaultSettings em src/models/setting.js',
     'copiado com sucesso,por favor trocar o defaultSettings em src/models/setting.js',
   'app.setting.production.hint':
   'app.setting.production.hint':
-    'O painel de configuração apenas é exibido no ambiente de desenvolvimento, por favor modifique manualmente o',
-};
+    'O painel de configuração apenas é exibido no ambiente de desenvolvimento, por favor modifique manualmente o'
+}

+ 2 - 2
src/locales/pt-BR/settings.js

@@ -56,5 +56,5 @@ export default {
   'app.settings.notification.todo-description':
   'app.settings.notification.todo-description':
     'A lista de to-do será notificada na forma de uma estação de letra',
     'A lista de to-do será notificada na forma de uma estação de letra',
   'app.settings.open': 'Aberto',
   'app.settings.open': 'Aberto',
-  'app.settings.close': 'Fechado',
-};
+  'app.settings.close': 'Fechado'
+}

+ 9 - 9
src/locales/zh-CN.js

@@ -1,10 +1,10 @@
-import component from './zh-CN/component';
-import globalHeader from './zh-CN/globalHeader';
-import menu from './zh-CN/menu';
-import pwa from './zh-CN/pwa';
-import settingDrawer from './zh-CN/settingDrawer';
-import settings from './zh-CN/settings';
-import pages from './zh-CN/pages';
+import component from './zh-CN/component'
+import globalHeader from './zh-CN/globalHeader'
+import menu from './zh-CN/menu'
+import pwa from './zh-CN/pwa'
+import settingDrawer from './zh-CN/settingDrawer'
+import settings from './zh-CN/settings'
+import pages from './zh-CN/pages'
 
 
 export default {
 export default {
   'navBar.lang': '语言',
   'navBar.lang': '语言',
@@ -20,5 +20,5 @@ export default {
   ...settingDrawer,
   ...settingDrawer,
   ...settings,
   ...settings,
   ...pwa,
   ...pwa,
-  ...component,
-};
+  ...component
+}

+ 2 - 2
src/locales/zh-CN/component.js

@@ -1,5 +1,5 @@
 export default {
 export default {
   'component.tagSelect.expand': '展开',
   'component.tagSelect.expand': '展开',
   'component.tagSelect.collapse': '收起',
   'component.tagSelect.collapse': '收起',
-  'component.tagSelect.all': '全部',
-};
+  'component.tagSelect.all': '全部'
+}

+ 2 - 2
src/locales/zh-CN/globalHeader.js

@@ -13,5 +13,5 @@ export default {
   'component.noticeIcon.clear': '清空',
   'component.noticeIcon.clear': '清空',
   'component.noticeIcon.cleared': '清空了',
   'component.noticeIcon.cleared': '清空了',
   'component.noticeIcon.empty': '暂无数据',
   'component.noticeIcon.empty': '暂无数据',
-  'component.noticeIcon.view-more': '查看更多',
-};
+  'component.noticeIcon.view-more': '查看更多'
+}

+ 2 - 2
src/locales/zh-CN/menu.js

@@ -60,5 +60,5 @@ export default {
   'menu.editor': '图形编辑器',
   'menu.editor': '图形编辑器',
   'menu.editor.flow': '流程编辑器',
   'menu.editor.flow': '流程编辑器',
   'menu.editor.mind': '脑图编辑器',
   'menu.editor.mind': '脑图编辑器',
-  'menu.editor.koni': '拓扑编辑器',
-};
+  'menu.editor.koni': '拓扑编辑器'
+}

+ 2 - 2
src/locales/zh-CN/pages.js

@@ -20,5 +20,5 @@ export default {
   'pages.login.forgotPassword': '忘记密码 ?',
   'pages.login.forgotPassword': '忘记密码 ?',
   'pages.login.submit': '提交',
   'pages.login.submit': '提交',
   'pages.login.loginWith': '其他登录方式 :',
   'pages.login.loginWith': '其他登录方式 :',
-  'pages.login.registerAccount': '注册账户',
-};
+  'pages.login.registerAccount': '注册账户'
+}

+ 2 - 2
src/locales/zh-CN/pwa.js

@@ -2,5 +2,5 @@ export default {
   'app.pwa.offline': '当前处于离线状态',
   'app.pwa.offline': '当前处于离线状态',
   'app.pwa.serviceworker.updated': '有新内容',
   'app.pwa.serviceworker.updated': '有新内容',
   'app.pwa.serviceworker.updated.hint': '请点击“刷新”按钮或者手动刷新页面',
   'app.pwa.serviceworker.updated.hint': '请点击“刷新”按钮或者手动刷新页面',
-  'app.pwa.serviceworker.updated.ok': '刷新',
-};
+  'app.pwa.serviceworker.updated.ok': '刷新'
+}

+ 2 - 2
src/locales/zh-CN/settingDrawer.js

@@ -27,5 +27,5 @@ export default {
   'app.setting.copy': '拷贝设置',
   'app.setting.copy': '拷贝设置',
   'app.setting.copyinfo': '拷贝成功,请到 src/defaultSettings.js 中替换默认配置',
   'app.setting.copyinfo': '拷贝成功,请到 src/defaultSettings.js 中替换默认配置',
   'app.setting.production.hint':
   'app.setting.production.hint':
-    '配置栏只在开发环境用于预览,生产环境不会展现,请拷贝后手动修改配置文件',
-};
+    '配置栏只在开发环境用于预览,生产环境不会展现,请拷贝后手动修改配置文件'
+}

+ 2 - 2
src/locales/zh-CN/settings.js

@@ -51,5 +51,5 @@ export default {
   'app.settings.notification.todo': '待办任务',
   'app.settings.notification.todo': '待办任务',
   'app.settings.notification.todo-description': '待办任务将以站内信的形式通知',
   'app.settings.notification.todo-description': '待办任务将以站内信的形式通知',
   'app.settings.open': '开',
   'app.settings.open': '开',
-  'app.settings.close': '关',
-};
+  'app.settings.close': '关'
+}

+ 8 - 8
src/locales/zh-TW.js

@@ -1,9 +1,9 @@
-import component from './zh-TW/component';
-import globalHeader from './zh-TW/globalHeader';
-import menu from './zh-TW/menu';
-import pwa from './zh-TW/pwa';
-import settingDrawer from './zh-TW/settingDrawer';
-import settings from './zh-TW/settings';
+import component from './zh-TW/component'
+import globalHeader from './zh-TW/globalHeader'
+import menu from './zh-TW/menu'
+import pwa from './zh-TW/pwa'
+import settingDrawer from './zh-TW/settingDrawer'
+import settings from './zh-TW/settings'
 
 
 export default {
 export default {
   'navBar.lang': '語言',
   'navBar.lang': '語言',
@@ -16,5 +16,5 @@ export default {
   ...settingDrawer,
   ...settingDrawer,
   ...settings,
   ...settings,
   ...pwa,
   ...pwa,
-  ...component,
-};
+  ...component
+}

+ 2 - 2
src/locales/zh-TW/component.js

@@ -1,5 +1,5 @@
 export default {
 export default {
   'component.tagSelect.expand': '展開',
   'component.tagSelect.expand': '展開',
   'component.tagSelect.collapse': '收起',
   'component.tagSelect.collapse': '收起',
-  'component.tagSelect.all': '全部',
-};
+  'component.tagSelect.all': '全部'
+}

+ 2 - 2
src/locales/zh-TW/globalHeader.js

@@ -13,5 +13,5 @@ export default {
   'component.noticeIcon.clear': '清空',
   'component.noticeIcon.clear': '清空',
   'component.noticeIcon.cleared': '清空了',
   'component.noticeIcon.cleared': '清空了',
   'component.noticeIcon.empty': '暫無資料',
   'component.noticeIcon.empty': '暫無資料',
-  'component.noticeIcon.view-more': '查看更多',
-};
+  'component.noticeIcon.view-more': '查看更多'
+}

+ 2 - 2
src/locales/zh-TW/menu.js

@@ -48,5 +48,5 @@ export default {
   'menu.editor': '圖形編輯器',
   'menu.editor': '圖形編輯器',
   'menu.editor.flow': '流程編輯器',
   'menu.editor.flow': '流程編輯器',
   'menu.editor.mind': '腦圖編輯器',
   'menu.editor.mind': '腦圖編輯器',
-  'menu.editor.koni': '拓撲編輯器',
-};
+  'menu.editor.koni': '拓撲編輯器'
+}

+ 2 - 2
src/locales/zh-TW/pwa.js

@@ -2,5 +2,5 @@ export default {
   'app.pwa.offline': '當前處於離線狀態',
   'app.pwa.offline': '當前處於離線狀態',
   'app.pwa.serviceworker.updated': '有新內容',
   'app.pwa.serviceworker.updated': '有新內容',
   'app.pwa.serviceworker.updated.hint': '請點擊“刷新”按鈕或者手動刷新頁面',
   'app.pwa.serviceworker.updated.hint': '請點擊“刷新”按鈕或者手動刷新頁面',
-  'app.pwa.serviceworker.updated.ok': '刷新',
-};
+  'app.pwa.serviceworker.updated.ok': '刷新'
+}

+ 2 - 2
src/locales/zh-TW/settingDrawer.js

@@ -27,5 +27,5 @@ export default {
   'app.setting.copy': '拷貝設置',
   'app.setting.copy': '拷貝設置',
   'app.setting.copyinfo': '拷貝成功,請到 src/defaultSettings.js 中替換默認配置',
   'app.setting.copyinfo': '拷貝成功,請到 src/defaultSettings.js 中替換默認配置',
   'app.setting.production.hint':
   'app.setting.production.hint':
-    '配置欄只在開發環境用於預覽,生產環境不會展現,請拷貝後手動修改配置文件',
-};
+    '配置欄只在開發環境用於預覽,生產環境不會展現,請拷貝後手動修改配置文件'
+}

+ 2 - 2
src/locales/zh-TW/settings.js

@@ -51,5 +51,5 @@ export default {
   'app.settings.notification.todo': '待辦任務',
   'app.settings.notification.todo': '待辦任務',
   'app.settings.notification.todo-description': '待辦任務將以站內信的形式通知',
   'app.settings.notification.todo-description': '待辦任務將以站內信的形式通知',
   'app.settings.open': '開',
   'app.settings.open': '開',
-  'app.settings.close': '關',
-};
+  'app.settings.close': '關'
+}

+ 11 - 11
src/models/contact.js

@@ -1,19 +1,19 @@
-import { queryContact } from '@/services/contact';
+import { queryContact } from '@/services/contact'
 
 
 export default {
 export default {
   namespace: 'contact',
   namespace: 'contact',
   state: {
   state: {
-    list: [],
+    list: []
   },
   },
   // 用于处理异步操作和业务逻辑,由action触发,但不能修改state
   // 用于处理异步操作和业务逻辑,由action触发,但不能修改state
   effects: {
   effects: {
     *fetch({ payload }, { call, put }) {
     *fetch({ payload }, { call, put }) {
-      const response = yield call(queryContact, payload);
+      const response = yield call(queryContact, payload)
       yield put({
       yield put({
         type: 'show',
         type: 'show',
-        payload: response,
-      });
-    },
+        payload: response
+      })
+    }
   },
   },
   // reducers:用于处理同步操作,由action触发,可修改state
   // reducers:用于处理同步操作,由action触发,可修改state
   reducers: {
   reducers: {
@@ -21,8 +21,8 @@ export default {
     show(state, action) {
     show(state, action) {
       return {
       return {
         ...state,
         ...state,
-        list: action.payload,
-      };
-    },
-  },
-};
+        list: action.payload
+      }
+    }
+  }
+}

+ 42 - 42
src/models/global.js

@@ -1,105 +1,105 @@
-import { queryNotices } from '@/services/user';
+import { queryNotices } from '@/services/user'
 
 
 const GlobalModel = {
 const GlobalModel = {
   namespace: 'global',
   namespace: 'global',
   state: {
   state: {
     collapsed: false,
     collapsed: false,
-    notices: [],
+    notices: []
   },
   },
   effects: {
   effects: {
     *fetchNotices(_, { call, put, select }) {
     *fetchNotices(_, { call, put, select }) {
-      const data = yield call(queryNotices);
+      const data = yield call(queryNotices)
       yield put({
       yield put({
         type: 'saveNotices',
         type: 'saveNotices',
-        payload: data,
-      });
+        payload: data
+      })
       const unreadCount = yield select(
       const unreadCount = yield select(
-        (state) => state.global.notices.filter((item) => !item.read).length,
-      );
+        (state) => state.global.notices.filter((item) => !item.read).length
+      )
       yield put({
       yield put({
         type: 'user/changeNotifyCount',
         type: 'user/changeNotifyCount',
         payload: {
         payload: {
           totalCount: data.length,
           totalCount: data.length,
-          unreadCount,
-        },
-      });
+          unreadCount
+        }
+      })
     },
     },
 
 
     *clearNotices({ payload }, { put, select }) {
     *clearNotices({ payload }, { put, select }) {
       yield put({
       yield put({
         type: 'saveClearedNotices',
         type: 'saveClearedNotices',
-        payload,
-      });
-      const count = yield select((state) => state.global.notices.length);
+        payload
+      })
+      const count = yield select((state) => state.global.notices.length)
       const unreadCount = yield select(
       const unreadCount = yield select(
-        (state) => state.global.notices.filter((item) => !item.read).length,
-      );
+        (state) => state.global.notices.filter((item) => !item.read).length
+      )
       yield put({
       yield put({
         type: 'user/changeNotifyCount',
         type: 'user/changeNotifyCount',
         payload: {
         payload: {
           totalCount: count,
           totalCount: count,
-          unreadCount,
-        },
-      });
+          unreadCount
+        }
+      })
     },
     },
 
 
     *changeNoticeReadState({ payload }, { put, select }) {
     *changeNoticeReadState({ payload }, { put, select }) {
       const notices = yield select((state) =>
       const notices = yield select((state) =>
         state.global.notices.map((item) => {
         state.global.notices.map((item) => {
-          const notice = { ...item };
+          const notice = { ...item }
 
 
           if (notice.id === payload) {
           if (notice.id === payload) {
-            notice.read = true;
+            notice.read = true
           }
           }
 
 
-          return notice;
-        }),
-      );
+          return notice
+        })
+      )
       yield put({
       yield put({
         type: 'saveNotices',
         type: 'saveNotices',
-        payload: notices,
-      });
+        payload: notices
+      })
       yield put({
       yield put({
         type: 'user/changeNotifyCount',
         type: 'user/changeNotifyCount',
         payload: {
         payload: {
           totalCount: notices.length,
           totalCount: notices.length,
-          unreadCount: notices.filter((item) => !item.read).length,
-        },
-      });
-    },
+          unreadCount: notices.filter((item) => !item.read).length
+        }
+      })
+    }
   },
   },
   reducers: {
   reducers: {
     changeLayoutCollapsed(
     changeLayoutCollapsed(
       state = {
       state = {
         notices: [],
         notices: [],
-        collapsed: true,
+        collapsed: true
       },
       },
-      { payload },
+      { payload }
     ) {
     ) {
-      return { ...state, collapsed: payload };
+      return { ...state, collapsed: payload }
     },
     },
 
 
     saveNotices(state, { payload }) {
     saveNotices(state, { payload }) {
       return {
       return {
         collapsed: false,
         collapsed: false,
         ...state,
         ...state,
-        notices: payload,
-      };
+        notices: payload
+      }
     },
     },
 
 
     saveClearedNotices(
     saveClearedNotices(
       state = {
       state = {
         notices: [],
         notices: [],
-        collapsed: true,
+        collapsed: true
       },
       },
-      { payload },
+      { payload }
     ) {
     ) {
       return {
       return {
         ...state,
         ...state,
         collapsed: false,
         collapsed: false,
-        notices: state.notices.filter((item) => item.type !== payload),
-      };
-    },
-  },
-};
-export default GlobalModel;
+        notices: state.notices.filter((item) => item.type !== payload)
+      }
+    }
+  }
+}
+export default GlobalModel

+ 31 - 31
src/models/login.js

@@ -1,67 +1,67 @@
-import { stringify } from 'querystring';
-import { history } from 'umi';
-import { fakeAccountLogin } from '@/services/login';
-import { setAuthority } from '@/utils/authority';
-import { getPageQuery } from '@/utils/utils';
-import { message } from 'antd';
+import { stringify } from 'querystring'
+import { history } from 'umi'
+import { fakeAccountLogin } from '@/services/login'
+import { setAuthority } from '@/utils/authority'
+import { getPageQuery } from '@/utils/utils'
+import { message } from 'antd'
 
 
 const Model = {
 const Model = {
   namespace: 'login',
   namespace: 'login',
   state: {
   state: {
-    status: undefined,
+    status: undefined
   },
   },
   effects: {
   effects: {
     *login({ payload }, { call, put }) {
     *login({ payload }, { call, put }) {
       // 获取登录接口数据
       // 获取登录接口数据
-      const response = yield call(fakeAccountLogin, payload);
+      const response = yield call(fakeAccountLogin, payload)
       yield put({
       yield put({
         type: 'changeLoginStatus',
         type: 'changeLoginStatus',
-        payload: response,
-      }); // Login successfully
+        payload: response
+      }) // Login successfully
 
 
       if (response.status === 'ok') {
       if (response.status === 'ok') {
-        const urlParams = new URL(window.location.href);
-        const params = getPageQuery();
-        message.success('🎉 🎉 🎉  登录成功!');
-        let { redirect } = params;
+        const urlParams = new URL(window.location.href)
+        const params = getPageQuery()
+        message.success('🎉 🎉 🎉  登录成功!')
+        let { redirect } = params
 
 
         if (redirect) {
         if (redirect) {
-          const redirectUrlParams = new URL(redirect);
+          const redirectUrlParams = new URL(redirect)
 
 
           if (redirectUrlParams.origin === urlParams.origin) {
           if (redirectUrlParams.origin === urlParams.origin) {
-            redirect = redirect.substr(urlParams.origin.length);
+            redirect = redirect.substr(urlParams.origin.length)
 
 
             if (redirect.match(/^\/.*#/)) {
             if (redirect.match(/^\/.*#/)) {
-              redirect = redirect.substr(redirect.indexOf('#') + 1);
+              redirect = redirect.substr(redirect.indexOf('#') + 1)
             }
             }
           } else {
           } else {
-            window.location.href = '/';
-            return;
+            window.location.href = '/'
+            return
           }
           }
         }
         }
 
 
-        history.replace(redirect || '/');
+        history.replace(redirect || '/')
       }
       }
     },
     },
 
 
     logout() {
     logout() {
-      const { redirect } = getPageQuery(); // Note: There may be security issues, please note
+      const { redirect } = getPageQuery() // Note: There may be security issues, please note
 
 
       if (window.location.pathname !== '/user/login' && !redirect) {
       if (window.location.pathname !== '/user/login' && !redirect) {
         history.replace({
         history.replace({
           pathname: '/user/login',
           pathname: '/user/login',
           search: stringify({
           search: stringify({
-            redirect: window.location.href,
-          }),
-        });
+            redirect: window.location.href
+          })
+        })
       }
       }
-    },
+    }
   },
   },
   reducers: {
   reducers: {
     changeLoginStatus(state, { payload }) {
     changeLoginStatus(state, { payload }) {
-      setAuthority(payload.currentAuthority);
-      return { ...state, status: payload.status, type: payload.type };
-    },
-  },
-};
-export default Model;
+      setAuthority(payload.currentAuthority)
+      return { ...state, status: payload.status, type: payload.type }
+    }
+  }
+}
+export default Model

+ 12 - 12
src/models/setting.js

@@ -1,27 +1,27 @@
-import defaultSettings from '../../config/defaultSettings';
+import defaultSettings from '../../config/defaultSettings'
 
 
 const updateColorWeak = (colorWeak) => {
 const updateColorWeak = (colorWeak) => {
-  const root = document.getElementById('root');
+  const root = document.getElementById('root')
 
 
   if (root) {
   if (root) {
-    root.className = colorWeak ? 'colorWeak' : '';
+    root.className = colorWeak ? 'colorWeak' : ''
   }
   }
-};
+}
 
 
 const SettingModel = {
 const SettingModel = {
   namespace: 'settings',
   namespace: 'settings',
   state: defaultSettings,
   state: defaultSettings,
   reducers: {
   reducers: {
     changeSetting(state = defaultSettings, { payload }) {
     changeSetting(state = defaultSettings, { payload }) {
-      const { colorWeak, contentWidth } = payload;
+      const { colorWeak, contentWidth } = payload
 
 
       if (state.contentWidth !== contentWidth && window.dispatchEvent) {
       if (state.contentWidth !== contentWidth && window.dispatchEvent) {
-        window.dispatchEvent(new Event('resize'));
+        window.dispatchEvent(new Event('resize'))
       }
       }
 
 
-      updateColorWeak(!!colorWeak);
-      return { ...state, ...payload };
-    },
-  },
-};
-export default SettingModel;
+      updateColorWeak(!!colorWeak)
+      return { ...state, ...payload }
+    }
+  }
+}
+export default SettingModel

+ 19 - 19
src/models/user.js

@@ -1,47 +1,47 @@
-import { queryCurrent, query as queryUsers } from '@/services/user';
+import { queryCurrent, query as queryUsers } from '@/services/user'
 
 
 const UserModel = {
 const UserModel = {
   namespace: 'user',
   namespace: 'user',
   state: {
   state: {
-    currentUser: {},
+    currentUser: {}
   },
   },
   effects: {
   effects: {
     *fetch(_, { call, put }) {
     *fetch(_, { call, put }) {
-      const response = yield call(queryUsers);
+      const response = yield call(queryUsers)
       yield put({
       yield put({
         type: 'save',
         type: 'save',
-        payload: response,
-      });
+        payload: response
+      })
     },
     },
 
 
     *fetchCurrent(_, { call, put }) {
     *fetchCurrent(_, { call, put }) {
-      const response = yield call(queryCurrent);
+      const response = yield call(queryCurrent)
       yield put({
       yield put({
         type: 'saveCurrentUser',
         type: 'saveCurrentUser',
-        payload: response,
-      });
-    },
+        payload: response
+      })
+    }
   },
   },
   reducers: {
   reducers: {
     saveCurrentUser(state, action) {
     saveCurrentUser(state, action) {
-      return { ...state, currentUser: action.payload || {} };
+      return { ...state, currentUser: action.payload || {} }
     },
     },
 
 
     changeNotifyCount(
     changeNotifyCount(
       state = {
       state = {
-        currentUser: {},
+        currentUser: {}
       },
       },
-      action,
+      action
     ) {
     ) {
       return {
       return {
         ...state,
         ...state,
         currentUser: {
         currentUser: {
           ...state.currentUser,
           ...state.currentUser,
           notifyCount: action.payload.totalCount,
           notifyCount: action.payload.totalCount,
-          unreadCount: action.payload.unreadCount,
-        },
-      };
-    },
-  },
-};
-export default UserModel;
+          unreadCount: action.payload.unreadCount
+        }
+      }
+    }
+  }
+}
+export default UserModel

+ 5 - 5
src/pages/404.jsx

@@ -1,6 +1,6 @@
-import { Button, Result } from 'antd';
-import React from 'react';
-import { history } from 'umi';
+import { Button, Result } from 'antd'
+import React from 'react'
+import { history } from 'umi'
 
 
 const NoFoundPage = () => (
 const NoFoundPage = () => (
   <Result
   <Result
@@ -13,6 +13,6 @@ const NoFoundPage = () => (
       </Button>
       </Button>
     }
     }
   />
   />
-);
+)
 
 
-export default NoFoundPage;
+export default NoFoundPage

+ 8 - 8
src/pages/Admin.jsx

@@ -1,7 +1,7 @@
-import React from 'react';
-import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
-import { Card, Typography, Alert } from 'antd';
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import React from 'react'
+import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons'
+import { Card, Typography, Alert } from 'antd'
+import { PageHeaderWrapper } from '@ant-design/pro-layout'
 
 
 export default () => (
 export default () => (
   <PageHeaderWrapper content=" 这个页面只有 admin 权限才能查看">
   <PageHeaderWrapper content=" 这个页面只有 admin 权限才能查看">
@@ -13,13 +13,13 @@ export default () => (
         banner
         banner
         style={{
         style={{
           margin: -12,
           margin: -12,
-          marginBottom: 48,
+          marginBottom: 48
         }}
         }}
       />
       />
       <Typography.Title
       <Typography.Title
         level={2}
         level={2}
         style={{
         style={{
-          textAlign: 'center',
+          textAlign: 'center'
         }}
         }}
       >
       >
         <SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" /> You
         <SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" /> You
@@ -28,7 +28,7 @@ export default () => (
     <p
     <p
       style={{
       style={{
         textAlign: 'center',
         textAlign: 'center',
-        marginTop: 24,
+        marginTop: 24
       }}
       }}
     >
     >
       Want to add more pages? Please refer to{' '}
       Want to add more pages? Please refer to{' '}
@@ -38,4 +38,4 @@ export default () => (
     </p>
     </p>
   </PageHeaderWrapper>
   </PageHeaderWrapper>
-);
+)

+ 5 - 6
src/pages/Customer/company.jsx

@@ -1,6 +1,6 @@
-import React from 'react';
+import React from 'react'
 // import { PageHeaderWrapper } from '@ant-design/pro-layout';
 // import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { Card} from 'antd';
+import { Card } from 'antd'
 // import { PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
 // import { PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
 // import ProTable, { TableDropdown } from '@ant-design/pro-table';
 // import ProTable, { TableDropdown } from '@ant-design/pro-table';
 // import request from 'umi-request';
 // import request from 'umi-request';
@@ -134,14 +134,13 @@ import { Card} from 'antd';
 // export default Lockstore;
 // export default Lockstore;
 
 
 
 
-
 const Company = () => {
 const Company = () => {
   // const { modalVisible, onCancel } = props;
   // const { modalVisible, onCancel } = props;
   return (
   return (
     <Card bordered={false}>
     <Card bordered={false}>
       dasdasd
       dasdasd
     </Card>
     </Card>
-  );
-};
+  )
+}
 
 
-export default Company;
+export default Company

+ 19 - 19
src/pages/Customer/contact.jsx

@@ -12,7 +12,7 @@ import React, { useEffect, useState } from 'react'
 
 
 const Contact = (props) => {
 const Contact = (props) => {
   // let tag = Array.from(tag);
   // let tag = Array.from(tag);
-  const [visible, setVisible] = useState(false)
+  const [ visible, setVisible ] = useState(false)
 
 
   // 展示drawer
   // 展示drawer
   const showDrawer = () => {
   const showDrawer = () => {
@@ -25,7 +25,7 @@ const Contact = (props) => {
   }
   }
 
 
   const onCreate = (values) => {
   const onCreate = (values) => {
-    console.log(values);
+    console.log(values)
   }
   }
 
 
   const columns = [
   const columns = [
@@ -93,33 +93,33 @@ const Contact = (props) => {
           all: { text: '全部', status: 'Default' },
           all: { text: '全部', status: 'Default' },
           green: {
           green: {
               text: '个人标签1',
               text: '个人标签1',
-              status: 'green',
+              status: 'green'
           },
           },
           blue: {
           blue: {
               text: '个人标签2',
               text: '个人标签2',
-              status: 'blue',
+              status: 'blue'
           },
           },
           purple: {
           purple: {
               text: '个人标签3',
               text: '个人标签3',
-              status: 'purple',
+              status: 'purple'
           },
           },
           red: {
           red: {
             text: '个人标签4',
             text: '个人标签4',
-            status: 'red',
+            status: 'red'
           },
           },
           brown: {
           brown: {
               text: '个人标签5',
               text: '个人标签5',
-              status: 'brown',
+              status: 'brown'
           },
           },
           black: {
           black: {
               text: '个人标签6',
               text: '个人标签6',
-              status: 'black',
+              status: 'black'
           },
           },
           yellow: {
           yellow: {
             text: '个人标签7',
             text: '个人标签7',
-            status: 'yellow',
-        },
-      },
+            status: 'yellow'
+        }
+      }
       // render:(_, record) => {
       // render:(_, record) => {
       //   console.log(record);
       //   console.log(record);
       // }
       // }
@@ -135,32 +135,32 @@ const Contact = (props) => {
           all: { text: '全部', status: 'Default' },
           all: { text: '全部', status: 'Default' },
           green: {
           green: {
               text: '协作标签1',
               text: '协作标签1',
-              status: 'green',
+              status: 'green'
           },
           },
           blue: {
           blue: {
               text: '协作标签2',
               text: '协作标签2',
-              status: 'blue',
+              status: 'blue'
           },
           },
           purple: {
           purple: {
               text: '协作标签3',
               text: '协作标签3',
-              status: 'purple',
+              status: 'purple'
           },
           },
           red: {
           red: {
             text: '协作标签4',
             text: '协作标签4',
-            status: 'red',
+            status: 'red'
           },
           },
           brown: {
           brown: {
               text: '协作标签5',
               text: '协作标签5',
-              status: 'brown',
+              status: 'brown'
           },
           },
           black: {
           black: {
               text: '协作标签6',
               text: '协作标签6',
-              status: 'black',
+              status: 'black'
           },
           },
           yellow: {
           yellow: {
             text: '协作标签7',
             text: '协作标签7',
-            status: 'yellow',
-        },
+            status: 'yellow'
+        }
       }
       }
     },
     },
     {
     {

+ 6 - 6
src/pages/ListTableList/components/CreateForm.jsx

@@ -1,8 +1,8 @@
-import React from 'react';
-import { Modal } from 'antd';
+import React from 'react'
+import { Modal } from 'antd'
 
 
 const CreateForm = (props) => {
 const CreateForm = (props) => {
-  const { modalVisible, onCancel } = props;
+  const { modalVisible, onCancel } = props
   return (
   return (
     <Modal
     <Modal
       destroyOnClose
       destroyOnClose
@@ -13,7 +13,7 @@ const CreateForm = (props) => {
     >
     >
       {props.children}
       {props.children}
     </Modal>
     </Modal>
-  );
-};
+  )
+}
 
 
-export default CreateForm;
+export default CreateForm

+ 24 - 24
src/pages/ListTableList/components/UpdateForm.jsx

@@ -1,25 +1,25 @@
-import React from 'react';
-import { Modal } from 'antd';
+import React from 'react'
+import { Modal } from 'antd'
 import {
 import {
   ProFormSelect,
   ProFormSelect,
   ProFormText,
   ProFormText,
   ProFormTextArea,
   ProFormTextArea,
   StepsForm,
   StepsForm,
   ProFormRadio,
   ProFormRadio,
-  ProFormDateTimePicker,
-} from '@ant-design/pro-form';
+  ProFormDateTimePicker
+} from '@ant-design/pro-form'
 
 
 const UpdateForm = (props) => (
 const UpdateForm = (props) => (
   <StepsForm
   <StepsForm
     stepsProps={{
     stepsProps={{
-      size: 'small',
+      size: 'small'
     }}
     }}
     stepsFormRender={(dom, submitter) => {
     stepsFormRender={(dom, submitter) => {
       return (
       return (
         <Modal
         <Modal
           width={640}
           width={640}
           bodyStyle={{
           bodyStyle={{
-            padding: '32px 40px 48px',
+            padding: '32px 40px 48px'
           }}
           }}
           destroyOnClose
           destroyOnClose
           title="规则配置"
           title="规则配置"
@@ -29,14 +29,14 @@ const UpdateForm = (props) => (
         >
         >
           {dom}
           {dom}
         </Modal>
         </Modal>
-      );
+      )
     }}
     }}
     onFinish={props.onSubmit}
     onFinish={props.onSubmit}
   >
   >
     <StepsForm.StepForm
     <StepsForm.StepForm
       initialValues={{
       initialValues={{
         name: props.values.name,
         name: props.values.name,
-        desc: props.values.desc,
+        desc: props.values.desc
       }}
       }}
       title="基本信息"
       title="基本信息"
     >
     >
@@ -46,8 +46,8 @@ const UpdateForm = (props) => (
         rules={[
         rules={[
           {
           {
             required: true,
             required: true,
-            message: '请输入规则名称!',
-          },
+            message: '请输入规则名称!'
+          }
         ]}
         ]}
       />
       />
       <ProFormTextArea
       <ProFormTextArea
@@ -58,15 +58,15 @@ const UpdateForm = (props) => (
           {
           {
             required: true,
             required: true,
             message: '请输入至少五个字符的规则描述!',
             message: '请输入至少五个字符的规则描述!',
-            min: 5,
-          },
+            min: 5
+          }
         ]}
         ]}
       />
       />
     </StepsForm.StepForm>
     </StepsForm.StepForm>
     <StepsForm.StepForm
     <StepsForm.StepForm
       initialValues={{
       initialValues={{
         target: '0',
         target: '0',
-        template: '0',
+        template: '0'
       }}
       }}
       title="配置规则属性"
       title="配置规则属性"
     >
     >
@@ -75,7 +75,7 @@ const UpdateForm = (props) => (
         label="监控对象"
         label="监控对象"
         valueEnum={{
         valueEnum={{
           0: '表一',
           0: '表一',
-          1: '表二',
+          1: '表二'
         }}
         }}
       />
       />
       <ProFormSelect
       <ProFormSelect
@@ -83,7 +83,7 @@ const UpdateForm = (props) => (
         label="规则模板"
         label="规则模板"
         valueEnum={{
         valueEnum={{
           0: '规则模板一',
           0: '规则模板一',
-          1: '规则模板二',
+          1: '规则模板二'
         }}
         }}
       />
       />
       <ProFormRadio.Group
       <ProFormRadio.Group
@@ -92,19 +92,19 @@ const UpdateForm = (props) => (
         options={[
         options={[
           {
           {
             value: '0',
             value: '0',
-            label: '强',
+            label: '强'
           },
           },
           {
           {
             value: '1',
             value: '1',
-            label: '弱',
-          },
+            label: '弱'
+          }
         ]}
         ]}
       />
       />
     </StepsForm.StepForm>
     </StepsForm.StepForm>
     <StepsForm.StepForm
     <StepsForm.StepForm
       initialValues={{
       initialValues={{
         type: '1',
         type: '1',
-        frequency: 'month',
+        frequency: 'month'
       }}
       }}
       title="设定调度周期"
       title="设定调度周期"
     >
     >
@@ -114,8 +114,8 @@ const UpdateForm = (props) => (
         rules={[
         rules={[
           {
           {
             required: true,
             required: true,
-            message: '请选择开始时间!',
-          },
+            message: '请选择开始时间!'
+          }
         ]}
         ]}
       />
       />
       <ProFormSelect
       <ProFormSelect
@@ -124,11 +124,11 @@ const UpdateForm = (props) => (
         width="xs"
         width="xs"
         valueEnum={{
         valueEnum={{
           month: '月',
           month: '月',
-          week: '周',
+          week: '周'
         }}
         }}
       />
       />
     </StepsForm.StepForm>
     </StepsForm.StepForm>
   </StepsForm>
   </StepsForm>
-);
+)
 
 
-export default UpdateForm;
+export default UpdateForm

+ 90 - 90
src/pages/ListTableList/index.jsx

@@ -1,84 +1,84 @@
-import { PlusOutlined } from '@ant-design/icons';
-import { Button, Divider, message, Input, Drawer } from 'antd';
-import React, { useState, useRef } from 'react';
-import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
-import ProTable from '@ant-design/pro-table';
-import ProDescriptions from '@ant-design/pro-descriptions';
-import CreateForm from './components/CreateForm';
-import UpdateForm from './components/UpdateForm';
-import { queryRule, updateRule, addRule, removeRule } from './service';
+import { PlusOutlined } from '@ant-design/icons'
+import { Button, Divider, message, Input, Drawer } from 'antd'
+import React, { useState, useRef } from 'react'
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'
+import ProTable from '@ant-design/pro-table'
+import ProDescriptions from '@ant-design/pro-descriptions'
+import CreateForm from './components/CreateForm'
+import UpdateForm from './components/UpdateForm'
+import { queryRule, updateRule, addRule, removeRule } from './service'
 /**
 /**
  * 添加节点
  * 添加节点
  * @param fields
  * @param fields
  */
  */
 
 
 const handleAdd = async (fields) => {
 const handleAdd = async (fields) => {
-  const hide = message.loading('正在添加');
+  const hide = message.loading('正在添加')
 
 
   try {
   try {
-    await addRule({ ...fields });
-    hide();
-    message.success('添加成功');
-    return true;
+    await addRule({ ...fields })
+    hide()
+    message.success('添加成功')
+    return true
   } catch (error) {
   } catch (error) {
-    hide();
-    message.error('添加失败请重试!');
-    return false;
+    hide()
+    message.error('添加失败请重试!')
+    return false
   }
   }
-};
+}
 /**
 /**
  * 更新节点
  * 更新节点
  * @param fields
  * @param fields
  */
  */
 
 
 const handleUpdate = async (fields) => {
 const handleUpdate = async (fields) => {
-  const hide = message.loading('正在配置');
+  const hide = message.loading('正在配置')
 
 
   try {
   try {
     await updateRule({
     await updateRule({
       name: fields.name,
       name: fields.name,
       desc: fields.desc,
       desc: fields.desc,
-      key: fields.key,
-    });
-    hide();
-    message.success('配置成功');
-    return true;
+      key: fields.key
+    })
+    hide()
+    message.success('配置成功')
+    return true
   } catch (error) {
   } catch (error) {
-    hide();
-    message.error('配置失败请重试!');
-    return false;
+    hide()
+    message.error('配置失败请重试!')
+    return false
   }
   }
-};
+}
 /**
 /**
  *  删除节点
  *  删除节点
  * @param selectedRows
  * @param selectedRows
  */
  */
 
 
 const handleRemove = async (selectedRows) => {
 const handleRemove = async (selectedRows) => {
-  const hide = message.loading('正在删除');
-  if (!selectedRows) return true;
+  const hide = message.loading('正在删除')
+  if (!selectedRows) return true
 
 
   try {
   try {
     await removeRule({
     await removeRule({
-      key: selectedRows.map((row) => row.key),
-    });
-    hide();
-    message.success('删除成功,即将刷新');
-    return true;
+      key: selectedRows.map((row) => row.key)
+    })
+    hide()
+    message.success('删除成功,即将刷新')
+    return true
   } catch (error) {
   } catch (error) {
-    hide();
-    message.error('删除失败,请重试');
-    return false;
+    hide()
+    message.error('删除失败,请重试')
+    return false
   }
   }
-};
+}
 
 
 const TableList = () => {
 const TableList = () => {
-  const [createModalVisible, handleModalVisible] = useState(false);
-  const [updateModalVisible, handleUpdateModalVisible] = useState(false);
-  const [stepFormValues, setStepFormValues] = useState({});
-  const actionRef = useRef();
-  const [row, setRow] = useState();
-  const [selectedRowsState, setSelectedRows] = useState([]);
+  const [ createModalVisible, handleModalVisible ] = useState(false)
+  const [ updateModalVisible, handleUpdateModalVisible ] = useState(false)
+  const [ stepFormValues, setStepFormValues ] = useState({})
+  const actionRef = useRef()
+  const [ row, setRow ] = useState()
+  const [ selectedRowsState, setSelectedRows ] = useState([])
   const columns = [
   const columns = [
     {
     {
       title: '规则名称',
       title: '规则名称',
@@ -88,25 +88,25 @@ const TableList = () => {
         rules: [
         rules: [
           {
           {
             required: true,
             required: true,
-            message: '规则名称为必填项',
-          },
-        ],
+            message: '规则名称为必填项'
+          }
+        ]
       },
       },
       render: (dom, entity) => {
       render: (dom, entity) => {
-        return <a onClick={() => setRow(entity)}>{dom}</a>;
-      },
+        return <a onClick={() => setRow(entity)}>{dom}</a>
+      }
     },
     },
     {
     {
       title: '描述',
       title: '描述',
       dataIndex: 'desc',
       dataIndex: 'desc',
-      valueType: 'textarea',
+      valueType: 'textarea'
     },
     },
     {
     {
       title: '服务调用次数',
       title: '服务调用次数',
       dataIndex: 'callNo',
       dataIndex: 'callNo',
       sorter: true,
       sorter: true,
       hideInForm: true,
       hideInForm: true,
-      renderText: (val) => `${val} 万`,
+      renderText: (val) => `${val} 万`
     },
     },
     {
     {
       title: '状态',
       title: '状态',
@@ -115,21 +115,21 @@ const TableList = () => {
       valueEnum: {
       valueEnum: {
         0: {
         0: {
           text: '关闭',
           text: '关闭',
-          status: 'Default',
+          status: 'Default'
         },
         },
         1: {
         1: {
           text: '运行中',
           text: '运行中',
-          status: 'Processing',
+          status: 'Processing'
         },
         },
         2: {
         2: {
           text: '已上线',
           text: '已上线',
-          status: 'Success',
+          status: 'Success'
         },
         },
         3: {
         3: {
           text: '异常',
           text: '异常',
-          status: 'Error',
-        },
-      },
+          status: 'Error'
+        }
+      }
     },
     },
     {
     {
       title: '上次调度时间',
       title: '上次调度时间',
@@ -138,18 +138,18 @@ const TableList = () => {
       valueType: 'dateTime',
       valueType: 'dateTime',
       hideInForm: true,
       hideInForm: true,
       renderFormItem: (item, { defaultRender, ...rest }, form) => {
       renderFormItem: (item, { defaultRender, ...rest }, form) => {
-        const status = form.getFieldValue('status');
+        const status = form.getFieldValue('status')
 
 
         if (`${status}` === '0') {
         if (`${status}` === '0') {
-          return false;
+          return false
         }
         }
 
 
         if (`${status}` === '3') {
         if (`${status}` === '3') {
-          return <Input {...rest} placeholder="请输入异常原因!" />;
+          return <Input {...rest} placeholder="请输入异常原因!" />
         }
         }
 
 
-        return defaultRender(item);
-      },
+        return defaultRender(item)
+      }
     },
     },
     {
     {
       title: '操作',
       title: '操作',
@@ -159,8 +159,8 @@ const TableList = () => {
         <>
         <>
           <a
           <a
             onClick={() => {
             onClick={() => {
-              handleUpdateModalVisible(true);
-              setStepFormValues(record);
+              handleUpdateModalVisible(true)
+              setStepFormValues(record)
             }}
             }}
           >
           >
             配置
             配置
@@ -168,9 +168,9 @@ const TableList = () => {
           <Divider type="vertical" />
           <Divider type="vertical" />
           <a href="">订阅警报</a>
           <a href="">订阅警报</a>
         </>
         </>
-      ),
-    },
-  ];
+      )
+    }
+  ]
   return (
   return (
     <PageContainer>
     <PageContainer>
       <ProTable
       <ProTable
@@ -178,17 +178,17 @@ const TableList = () => {
         actionRef={actionRef}
         actionRef={actionRef}
         rowKey="key"
         rowKey="key"
         search={{
         search={{
-          labelWidth: 120,
+          labelWidth: 120
         }}
         }}
         toolBarRender={() => [
         toolBarRender={() => [
           <Button type="primary" onClick={() => handleModalVisible(true)}>
           <Button type="primary" onClick={() => handleModalVisible(true)}>
             <PlusOutlined /> 新建
             <PlusOutlined /> 新建
-          </Button>,
+          </Button>
         ]}
         ]}
         request={(params, sorter, filter) => queryRule({ ...params, sorter, filter })}
         request={(params, sorter, filter) => queryRule({ ...params, sorter, filter })}
         columns={columns}
         columns={columns}
         rowSelection={{
         rowSelection={{
-          onChange: (_, selectedRows) => setSelectedRows(selectedRows),
+          onChange: (_, selectedRows) => setSelectedRows(selectedRows)
         }}
         }}
       />
       />
       {selectedRowsState?.length > 0 && (
       {selectedRowsState?.length > 0 && (
@@ -198,7 +198,7 @@ const TableList = () => {
               已选择{' '}
               已选择{' '}
               <a
               <a
                 style={{
                 style={{
-                  fontWeight: 600,
+                  fontWeight: 600
                 }}
                 }}
               >
               >
                 {selectedRowsState.length}
                 {selectedRowsState.length}
@@ -212,9 +212,9 @@ const TableList = () => {
         >
         >
           <Button
           <Button
             onClick={async () => {
             onClick={async () => {
-              await handleRemove(selectedRowsState);
-              setSelectedRows([]);
-              actionRef.current?.reloadAndRest?.();
+              await handleRemove(selectedRowsState)
+              setSelectedRows([])
+              actionRef.current?.reloadAndRest?.()
             }}
             }}
           >
           >
             批量删除
             批量删除
@@ -225,13 +225,13 @@ const TableList = () => {
       <CreateForm onCancel={() => handleModalVisible(false)} modalVisible={createModalVisible}>
       <CreateForm onCancel={() => handleModalVisible(false)} modalVisible={createModalVisible}>
         <ProTable
         <ProTable
           onSubmit={async (value) => {
           onSubmit={async (value) => {
-            const success = await handleAdd(value);
+            const success = await handleAdd(value)
 
 
             if (success) {
             if (success) {
-              handleModalVisible(false);
+              handleModalVisible(false)
 
 
               if (actionRef.current) {
               if (actionRef.current) {
-                actionRef.current.reload();
+                actionRef.current.reload()
               }
               }
             }
             }
           }}
           }}
@@ -243,20 +243,20 @@ const TableList = () => {
       {stepFormValues && Object.keys(stepFormValues).length ? (
       {stepFormValues && Object.keys(stepFormValues).length ? (
         <UpdateForm
         <UpdateForm
           onSubmit={async (value) => {
           onSubmit={async (value) => {
-            const success = await handleUpdate(value);
+            const success = await handleUpdate(value)
 
 
             if (success) {
             if (success) {
-              handleUpdateModalVisible(false);
-              setStepFormValues({});
+              handleUpdateModalVisible(false)
+              setStepFormValues({})
 
 
               if (actionRef.current) {
               if (actionRef.current) {
-                actionRef.current.reload();
+                actionRef.current.reload()
               }
               }
             }
             }
           }}
           }}
           onCancel={() => {
           onCancel={() => {
-            handleUpdateModalVisible(false);
-            setStepFormValues({});
+            handleUpdateModalVisible(false)
+            setStepFormValues({})
           }}
           }}
           updateModalVisible={updateModalVisible}
           updateModalVisible={updateModalVisible}
           values={stepFormValues}
           values={stepFormValues}
@@ -267,7 +267,7 @@ const TableList = () => {
         width={600}
         width={600}
         visible={!!row}
         visible={!!row}
         onClose={() => {
         onClose={() => {
-          setRow(undefined);
+          setRow(undefined)
         }}
         }}
         closable={false}
         closable={false}
       >
       >
@@ -276,17 +276,17 @@ const TableList = () => {
             column={2}
             column={2}
             title={row?.name}
             title={row?.name}
             request={async () => ({
             request={async () => ({
-              data: row || {},
+              data: row || {}
             })}
             })}
             params={{
             params={{
-              id: row?.name,
+              id: row?.name
             }}
             }}
             columns={columns}
             columns={columns}
           />
           />
         )}
         )}
       </Drawer>
       </Drawer>
     </PageContainer>
     </PageContainer>
-  );
-};
+  )
+}
 
 
-export default TableList;
+export default TableList

+ 9 - 9
src/pages/ListTableList/service.js

@@ -1,25 +1,25 @@
-import request from '@/utils/request';
+import request from '@/utils/request'
 
 
 export async function queryRule(params) {
 export async function queryRule(params) {
   return request('/api/rule', {
   return request('/api/rule', {
-    params,
-  });
+    params
+  })
 }
 }
 export async function removeRule(params) {
 export async function removeRule(params) {
   return request('/api/rule', {
   return request('/api/rule', {
     method: 'POST',
     method: 'POST',
-    data: { ...params, method: 'delete' },
-  });
+    data: { ...params, method: 'delete' }
+  })
 }
 }
 export async function addRule(params) {
 export async function addRule(params) {
   return request('/api/rule', {
   return request('/api/rule', {
     method: 'POST',
     method: 'POST',
-    data: { ...params, method: 'post' },
-  });
+    data: { ...params, method: 'post' }
+  })
 }
 }
 export async function updateRule(params) {
 export async function updateRule(params) {
   return request('/api/rule', {
   return request('/api/rule', {
     method: 'POST',
     method: 'POST',
-    data: { ...params, method: 'update' },
-  });
+    data: { ...params, method: 'update' }
+  })
 }
 }

+ 4 - 4
src/pages/Product/Cloud/build.jsx

@@ -1,12 +1,12 @@
-import React from 'react';
-import { Modal } from 'antd';
+import React from 'react'
+import { Modal } from 'antd'
 
 
 class Build extends React.Component{
 class Build extends React.Component{
     render(){
     render(){
       return(
       return(
         <div>build</div>
         <div>build</div>
-      );
+      )
     }
     }
 }
 }
 
 
-export default Build;
+export default Build

+ 3 - 3
src/pages/Product/Cloud/curing.jsx

@@ -1,11 +1,11 @@
-import React from 'react';
+import React from 'react'
 
 
 class Curing extends React.Component{
 class Curing extends React.Component{
     render(){
     render(){
       return(
       return(
         <div>curing</div>
         <div>curing</div>
-      );
+      )
     }
     }
 }
 }
 
 
-export default Curing;
+export default Curing

+ 5 - 5
src/pages/Product/Lock/lockcount.jsx

@@ -1,6 +1,6 @@
-import React from 'react';
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { Card } from 'antd';
+import React from 'react'
+import { PageHeaderWrapper } from '@ant-design/pro-layout'
+import { Card } from 'antd'
 
 
 class Lockcount extends React.Component{
 class Lockcount extends React.Component{
   render(){
   render(){
@@ -8,7 +8,7 @@ class Lockcount extends React.Component{
       <PageHeaderWrapper>
       <PageHeaderWrapper>
         <Card bordered={false}>lockcount</Card>
         <Card bordered={false}>lockcount</Card>
       </PageHeaderWrapper>
       </PageHeaderWrapper>
-    );
+    )
   }
   }
 }
 }
-export default Lockcount;
+export default Lockcount

+ 5 - 5
src/pages/Product/Lock/lockstore.jsx

@@ -1,6 +1,6 @@
-import React from 'react';
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { Card } from 'antd';
+import React from 'react'
+import { PageHeaderWrapper } from '@ant-design/pro-layout'
+import { Card } from 'antd'
 // import { createFromIconfontCN } from '@ant-design/icons';
 // import { createFromIconfontCN } from '@ant-design/icons';
 // const IconFont = createFromIconfontCN({
 // const IconFont = createFromIconfontCN({
 //   scriptUrl: '//at.alicdn.com/t/font_2276974_y914krojop.js',
 //   scriptUrl: '//at.alicdn.com/t/font_2276974_y914krojop.js',
@@ -10,8 +10,8 @@ class Lockstore extends React.Component{
   render(){
   render(){
     return(
     return(
       <Card bordered={false}>lockstore</Card>
       <Card bordered={false}>lockstore</Card>
-    );
+    )
   }
   }
 }
 }
 
 
-export default Lockstore;
+export default Lockstore

+ 8 - 8
src/pages/Welcome.jsx

@@ -1,7 +1,7 @@
-import React from 'react';
-import { PageContainer } from '@ant-design/pro-layout';
-import { Card, Alert, Typography } from 'antd';
-import styles from './Welcome.less';
+import React from 'react'
+import { PageContainer } from '@ant-design/pro-layout'
+import { Card, Alert, Typography } from 'antd'
+import styles from './Welcome.less'
 
 
 const CodePreview = ({ children }) => (
 const CodePreview = ({ children }) => (
   <pre className={styles.pre}>
   <pre className={styles.pre}>
@@ -9,7 +9,7 @@ const CodePreview = ({ children }) => (
       <Typography.Text copyable>{children}</Typography.Text>
       <Typography.Text copyable>{children}</Typography.Text>
     </code>
     </code>
   </pre>
   </pre>
-);
+)
 
 
 export default () => (
 export default () => (
   <PageContainer>
   <PageContainer>
@@ -21,7 +21,7 @@ export default () => (
         banner
         banner
         style={{
         style={{
           margin: -12,
           margin: -12,
-          marginBottom: 24,
+          marginBottom: 24
         }}
         }}
       />
       />
       <Typography.Text strong>
       <Typography.Text strong>
@@ -38,7 +38,7 @@ export default () => (
       <Typography.Text
       <Typography.Text
         strong
         strong
         style={{
         style={{
-          marginBottom: 12,
+          marginBottom: 12
         }}
         }}
       >
       >
         高级布局{' '}
         高级布局{' '}
@@ -53,4 +53,4 @@ export default () => (
       <CodePreview>yarn add @ant-design/pro-layout</CodePreview>
       <CodePreview>yarn add @ant-design/pro-layout</CodePreview>
     </Card>
     </Card>
   </PageContainer>
   </PageContainer>
-);
+)

+ 5 - 5
src/pages/Workbench/workbench.jsx

@@ -1,6 +1,6 @@
-import React from 'react';
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { Card } from 'antd';
+import React from 'react'
+import { PageHeaderWrapper } from '@ant-design/pro-layout'
+import { Card } from 'antd'
 
 
 class Lockcount extends React.Component{
 class Lockcount extends React.Component{
   render(){
   render(){
@@ -8,7 +8,7 @@ class Lockcount extends React.Component{
       <PageHeaderWrapper>
       <PageHeaderWrapper>
         <Card bordered={false}>工作台首页</Card>
         <Card bordered={false}>工作台首页</Card>
       </PageHeaderWrapper>
       </PageHeaderWrapper>
-    );
+    )
   }
   }
 }
 }
-export default Lockcount;
+export default Lockcount

+ 33 - 33
src/pages/user/login/index.jsx

@@ -4,7 +4,7 @@ import {
   MailTwoTone,
   MailTwoTone,
   MobileTwoTone,
   MobileTwoTone,
   // TaobaoCircleOutlined,
   // TaobaoCircleOutlined,
-  UserOutlined,
+  UserOutlined
   // WeiboCircleOutlined,
   // WeiboCircleOutlined,
 } from '@ant-design/icons'
 } from '@ant-design/icons'
 import { Alert, message, Tabs } from 'antd'
 import { Alert, message, Tabs } from 'antd'
@@ -17,7 +17,7 @@ import styles from './index.less'
 const LoginMessage = ({ content }) => (
 const LoginMessage = ({ content }) => (
   <Alert
   <Alert
     style={{
     style={{
-      marginBottom: 24,
+      marginBottom: 24
     }}
     }}
     message={content}
     message={content}
     type="error"
     type="error"
@@ -28,14 +28,14 @@ const LoginMessage = ({ content }) => (
 const Login = (props) => {
 const Login = (props) => {
   const { userLogin = {}, submitting } = props
   const { userLogin = {}, submitting } = props
   const { status, type: loginType } = userLogin
   const { status, type: loginType } = userLogin
-  const [type, setType] = useState('account')
+  const [ type, setType ] = useState('account')
   const intl = useIntl()
   const intl = useIntl()
 
 
   const handleSubmit = (values) => {
   const handleSubmit = (values) => {
     const { dispatch } = props
     const { dispatch } = props
     dispatch({
     dispatch({
       type: 'login/login',
       type: 'login/login',
-      payload: { ...values, type },
+      payload: { ...values, type }
     })
     })
   }
   }
 
 
@@ -43,7 +43,7 @@ const Login = (props) => {
     <div className={styles.main}>
     <div className={styles.main}>
       <ProForm
       <ProForm
         initialValues={{
         initialValues={{
-          autoLogin: true,
+          autoLogin: true
         }}
         }}
         submitter={{
         submitter={{
           render: (_, dom) => dom.pop(),
           render: (_, dom) => dom.pop(),
@@ -51,9 +51,9 @@ const Login = (props) => {
             loading: submitting,
             loading: submitting,
             size: 'large',
             size: 'large',
             style: {
             style: {
-              width: '100%',
-            },
-          },
+              width: '100%'
+            }
+          }
         }}
         }}
         onFinish={async (values) => {
         onFinish={async (values) => {
           handleSubmit(values)
           handleSubmit(values)
@@ -64,7 +64,7 @@ const Login = (props) => {
             key="account"
             key="account"
             tab={intl.formatMessage({
             tab={intl.formatMessage({
               id: 'pages.login.accountLogin.tab',
               id: 'pages.login.accountLogin.tab',
-              defaultMessage: '账户密码登录',
+              defaultMessage: '账户密码登录'
             })}
             })}
           />
           />
           {/* <Tabs.TabPane
           {/* <Tabs.TabPane
@@ -80,7 +80,7 @@ const Login = (props) => {
           <LoginMessage
           <LoginMessage
             content={intl.formatMessage({
             content={intl.formatMessage({
               id: 'pages.login.accountLogin.errorMessage',
               id: 'pages.login.accountLogin.errorMessage',
-              defaultMessage: '账户或密码错误(admin/ant.design)',
+              defaultMessage: '账户或密码错误(admin/ant.design)'
             })}
             })}
           />
           />
         )}
         )}
@@ -90,11 +90,11 @@ const Login = (props) => {
               name="userName"
               name="userName"
               fieldProps={{
               fieldProps={{
                 size: 'large',
                 size: 'large',
-                prefix: <UserOutlined className={styles.prefixIcon} />,
+                prefix: <UserOutlined className={styles.prefixIcon} />
               }}
               }}
               placeholder={intl.formatMessage({
               placeholder={intl.formatMessage({
                 id: 'pages.login.username.placeholder',
                 id: 'pages.login.username.placeholder',
-                defaultMessage: '用户名: admin or user',
+                defaultMessage: '用户名: admin or user'
               })}
               })}
               rules={[
               rules={[
                 {
                 {
@@ -104,19 +104,19 @@ const Login = (props) => {
                       id="pages.login.username.required"
                       id="pages.login.username.required"
                       defaultMessage="请输入用户名!"
                       defaultMessage="请输入用户名!"
                     />
                     />
-                  ),
-                },
+                  )
+                }
               ]}
               ]}
             />
             />
             <ProFormText.Password
             <ProFormText.Password
               name="password"
               name="password"
               fieldProps={{
               fieldProps={{
                 size: 'large',
                 size: 'large',
-                prefix: <LockTwoTone className={styles.prefixIcon} />,
+                prefix: <LockTwoTone className={styles.prefixIcon} />
               }}
               }}
               placeholder={intl.formatMessage({
               placeholder={intl.formatMessage({
                 id: 'pages.login.password.placeholder',
                 id: 'pages.login.password.placeholder',
-                defaultMessage: '密码: ant.design',
+                defaultMessage: '密码: ant.design'
               })}
               })}
               rules={[
               rules={[
                 {
                 {
@@ -126,8 +126,8 @@ const Login = (props) => {
                       id="pages.login.password.required"
                       id="pages.login.password.required"
                       defaultMessage="请输入密码!"
                       defaultMessage="请输入密码!"
                     />
                     />
-                  ),
-                },
+                  )
+                }
               ]}
               ]}
             />
             />
           </>
           </>
@@ -141,12 +141,12 @@ const Login = (props) => {
             <ProFormText
             <ProFormText
               fieldProps={{
               fieldProps={{
                 size: 'large',
                 size: 'large',
-                prefix: <MobileTwoTone className={styles.prefixIcon} />,
+                prefix: <MobileTwoTone className={styles.prefixIcon} />
               }}
               }}
               name="mobile"
               name="mobile"
               placeholder={intl.formatMessage({
               placeholder={intl.formatMessage({
                 id: 'pages.login.phoneNumber.placeholder',
                 id: 'pages.login.phoneNumber.placeholder',
-                defaultMessage: '手机号',
+                defaultMessage: '手机号'
               })}
               })}
               rules={[
               rules={[
                 {
                 {
@@ -156,7 +156,7 @@ const Login = (props) => {
                       id="pages.login.phoneNumber.required"
                       id="pages.login.phoneNumber.required"
                       defaultMessage="请输入手机号!"
                       defaultMessage="请输入手机号!"
                     />
                     />
-                  ),
+                  )
                 },
                 },
                 {
                 {
                   pattern: /^1\d{10}$/,
                   pattern: /^1\d{10}$/,
@@ -165,31 +165,31 @@ const Login = (props) => {
                       id="pages.login.phoneNumber.invalid"
                       id="pages.login.phoneNumber.invalid"
                       defaultMessage="手机号格式错误!"
                       defaultMessage="手机号格式错误!"
                     />
                     />
-                  ),
-                },
+                  )
+                }
               ]}
               ]}
             />
             />
             <ProFormCaptcha
             <ProFormCaptcha
               fieldProps={{
               fieldProps={{
                 size: 'large',
                 size: 'large',
-                prefix: <MailTwoTone className={styles.prefixIcon} />,
+                prefix: <MailTwoTone className={styles.prefixIcon} />
               }}
               }}
               captchaProps={{
               captchaProps={{
-                size: 'large',
+                size: 'large'
               }}
               }}
               placeholder={intl.formatMessage({
               placeholder={intl.formatMessage({
                 id: 'pages.login.captcha.placeholder',
                 id: 'pages.login.captcha.placeholder',
-                defaultMessage: '请输入验证码',
+                defaultMessage: '请输入验证码'
               })}
               })}
               captchaTextRender={(timing, count) =>
               captchaTextRender={(timing, count) =>
                 timing
                 timing
                   ? `${count} ${intl.formatMessage({
                   ? `${count} ${intl.formatMessage({
                       id: 'pages.getCaptchaSecondText',
                       id: 'pages.getCaptchaSecondText',
-                      defaultMessage: '获取验证码',
+                      defaultMessage: '获取验证码'
                     })}`
                     })}`
                   : intl.formatMessage({
                   : intl.formatMessage({
                       id: 'pages.login.phoneLogin.getVerificationCode',
                       id: 'pages.login.phoneLogin.getVerificationCode',
-                      defaultMessage: '获取验证码',
+                      defaultMessage: '获取验证码'
                     })
                     })
               }
               }
               name="captcha"
               name="captcha"
@@ -201,8 +201,8 @@ const Login = (props) => {
                       id="pages.login.captcha.required"
                       id="pages.login.captcha.required"
                       defaultMessage="请输入验证码!"
                       defaultMessage="请输入验证码!"
                     />
                     />
-                  ),
-                },
+                  )
+                }
               ]}
               ]}
               onGetCaptcha={async (mobile) => {
               onGetCaptcha={async (mobile) => {
                 const result = await getFakeCaptcha(mobile)
                 const result = await getFakeCaptcha(mobile)
@@ -218,7 +218,7 @@ const Login = (props) => {
         )}
         )}
         <div
         <div
           style={{
           style={{
-            marginBottom: 24,
+            marginBottom: 24
           }}
           }}
         >
         >
           <ProFormCheckbox noStyle name="autoLogin">
           <ProFormCheckbox noStyle name="autoLogin">
@@ -226,7 +226,7 @@ const Login = (props) => {
           </ProFormCheckbox>
           </ProFormCheckbox>
           <a
           <a
             style={{
             style={{
-              float: 'right',
+              float: 'right'
             }}
             }}
           >
           >
             <FormattedMessage id="pages.login.forgotPassword" defaultMessage="忘记密码" />
             <FormattedMessage id="pages.login.forgotPassword" defaultMessage="忘记密码" />
@@ -245,5 +245,5 @@ const Login = (props) => {
 
 
 export default connect(({ login, loading }) => ({
 export default connect(({ login, loading }) => ({
   userLogin: login,
   userLogin: login,
-  submitting: loading.effects['login/login'],
+  submitting: loading.effects['login/login']
 }))(Login)
 }))(Login)

+ 19 - 19
src/service-worker.js

@@ -4,22 +4,22 @@
 /* globals workbox */
 /* globals workbox */
 workbox.core.setCacheNameDetails({
 workbox.core.setCacheNameDetails({
   prefix: 'antd-pro',
   prefix: 'antd-pro',
-  suffix: 'v1',
-});
+  suffix: 'v1'
+})
 // Control all opened tabs ASAP
 // Control all opened tabs ASAP
-workbox.clientsClaim();
+workbox.clientsClaim()
 
 
 /**
 /**
  * Use precaching list generated by workbox in build process.
  * Use precaching list generated by workbox in build process.
  * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching
  * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching
  */
  */
-workbox.precaching.precacheAndRoute(self.__precacheManifest || []);
+workbox.precaching.precacheAndRoute(self.__precacheManifest || [])
 
 
 /**
 /**
  * Register a navigation route.
  * Register a navigation route.
  * https://developers.google.com/web/tools/workbox/modules/workbox-routing#how_to_register_a_navigation_route
  * https://developers.google.com/web/tools/workbox/modules/workbox-routing#how_to_register_a_navigation_route
  */
  */
-workbox.routing.registerNavigationRoute('/index.html');
+workbox.routing.registerNavigationRoute('/index.html')
 
 
 /**
 /**
  * Use runtime cache:
  * Use runtime cache:
@@ -32,39 +32,39 @@ workbox.routing.registerNavigationRoute('/index.html');
 /**
 /**
  * Handle API requests
  * Handle API requests
  */
  */
-workbox.routing.registerRoute(/\/api\//, workbox.strategies.networkFirst());
+workbox.routing.registerRoute(/\/api\//, workbox.strategies.networkFirst())
 
 
 /**
 /**
  * Handle third party requests
  * Handle third party requests
  */
  */
 workbox.routing.registerRoute(
 workbox.routing.registerRoute(
   /^https:\/\/gw\.alipayobjects\.com\//,
   /^https:\/\/gw\.alipayobjects\.com\//,
-  workbox.strategies.networkFirst(),
-);
+  workbox.strategies.networkFirst()
+)
 workbox.routing.registerRoute(
 workbox.routing.registerRoute(
   /^https:\/\/cdnjs\.cloudflare\.com\//,
   /^https:\/\/cdnjs\.cloudflare\.com\//,
-  workbox.strategies.networkFirst(),
-);
-workbox.routing.registerRoute(/\/color.less/, workbox.strategies.networkFirst());
+  workbox.strategies.networkFirst()
+)
+workbox.routing.registerRoute(/\/color.less/, workbox.strategies.networkFirst())
 
 
 /**
 /**
  * Response to client after skipping waiting with MessageChannel
  * Response to client after skipping waiting with MessageChannel
  */
  */
 addEventListener('message', (event) => {
 addEventListener('message', (event) => {
-  const replyPort = event.ports[0];
-  const message = event.data;
+  const replyPort = event.ports[0]
+  const message = event.data
   if (replyPort && message && message.type === 'skip-waiting') {
   if (replyPort && message && message.type === 'skip-waiting') {
     event.waitUntil(
     event.waitUntil(
       self.skipWaiting().then(
       self.skipWaiting().then(
         () =>
         () =>
           replyPort.postMessage({
           replyPort.postMessage({
-            error: null,
+            error: null
           }),
           }),
         (error) =>
         (error) =>
           replyPort.postMessage({
           replyPort.postMessage({
-            error,
-          }),
-      ),
-    );
+            error
+          })
+      )
+    )
   }
   }
-});
+})

+ 2 - 2
src/services/contact.js

@@ -1,5 +1,5 @@
-import request from '@/utils/request';
+import request from '@/utils/request'
 
 
 export async function queryContact(){
 export async function queryContact(){
-    return request('/api/contact');// 请求/api/contact 端口数据的函数 queryContact
+    return request('/api/contact')// 请求/api/contact 端口数据的函数 queryContact
 }
 }

+ 3 - 4
src/services/login.js

@@ -1,7 +1,6 @@
-import request from '@/utils/request';
+import request from '@/utils/request'
 
 
 export async function fakeAccountLogin(params) {
 export async function fakeAccountLogin(params) {
-
  
  
 
 
  // 发送接口请求数据
  // 发送接口请求数据
@@ -9,7 +8,7 @@ export async function fakeAccountLogin(params) {
 return request('/api/login/account', {
 return request('/api/login/account', {
   method: 'POST',
   method: 'POST',
   data:params
   data:params
-});
+})
 
 
   // return request('/cld2/login', {
   // return request('/cld2/login', {
   //   method: 'POST',
   //   method: 'POST',
@@ -17,5 +16,5 @@ return request('/api/login/account', {
   // });
   // });
 }
 }
 export async function getFakeCaptcha(mobile) {
 export async function getFakeCaptcha(mobile) {
-  return request(`/api/login/captcha?mobile=${mobile}`);
+  return request(`/api/login/captcha?mobile=${mobile}`)
 }
 }

+ 4 - 4
src/services/user.js

@@ -1,11 +1,11 @@
-import request from '@/utils/request';
+import request from '@/utils/request'
 
 
 export async function query() {
 export async function query() {
-  return request('/api/users');
+  return request('/api/users')
 }
 }
 export async function queryCurrent() {
 export async function queryCurrent() {
-  return request('/api/currentUser');
+  return request('/api/currentUser')
 }
 }
 export async function queryNotices() {
 export async function queryNotices() {
-  return request('/api/notices');
+  return request('/api/notices')
 }
 }

+ 8 - 8
src/utils/Authorized.js

@@ -1,19 +1,19 @@
-import RenderAuthorize from '@/components/Authorized';
-import { getAuthority } from './authority';
+import RenderAuthorize from '@/components/Authorized'
+import { getAuthority } from './authority'
 /* eslint-disable eslint-comments/disable-enable-pair */
 /* eslint-disable eslint-comments/disable-enable-pair */
 
 
 /* eslint-disable import/no-mutable-exports */
 /* eslint-disable import/no-mutable-exports */
 
 
-let Authorized = RenderAuthorize(getAuthority()); // Reload the rights component
+let Authorized = RenderAuthorize(getAuthority()) // Reload the rights component
 
 
 const reloadAuthorized = () => {
 const reloadAuthorized = () => {
-  Authorized = RenderAuthorize(getAuthority());
-};
+  Authorized = RenderAuthorize(getAuthority())
+}
 /**
 /**
  * hard code
  * hard code
  * block need it。
  * block need it。
  */
  */
 
 
-window.reloadAuthorized = reloadAuthorized;
-export { reloadAuthorized };
-export default Authorized;
+window.reloadAuthorized = reloadAuthorized
+export { reloadAuthorized }
+export default Authorized

+ 11 - 11
src/utils/authority.js

@@ -1,33 +1,33 @@
-import { reloadAuthorized } from './Authorized'; // use localStorage to store the authority info, which might be sent from server in actual project.
+import { reloadAuthorized } from './Authorized' // use localStorage to store the authority info, which might be sent from server in actual project.
 
 
 export function getAuthority(str) {
 export function getAuthority(str) {
   const authorityString =
   const authorityString =
-    typeof str === 'undefined' && localStorage ? localStorage.getItem('antd-pro-authority') : str; // authorityString could be admin, "admin", ["admin"]
+    typeof str === 'undefined' && localStorage ? localStorage.getItem('antd-pro-authority') : str // authorityString could be admin, "admin", ["admin"]
 
 
-  let authority;
+  let authority
 
 
   try {
   try {
     if (authorityString) {
     if (authorityString) {
-      authority = JSON.parse(authorityString);
+      authority = JSON.parse(authorityString)
     }
     }
   } catch (e) {
   } catch (e) {
-    authority = authorityString;
+    authority = authorityString
   }
   }
 
 
   if (typeof authority === 'string') {
   if (typeof authority === 'string') {
-    return [authority];
+    return [ authority ]
   } // preview.pro.ant.design only do not use in your production.
   } // preview.pro.ant.design only do not use in your production.
   // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
   // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
 
 
   if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
   if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
-    return ['admin'];
+    return [ 'admin' ]
   }
   }
 
 
-  return authority;
+  return authority
 }
 }
 export function setAuthority(authority) {
 export function setAuthority(authority) {
-  const proAuthority = typeof authority === 'string' ? [authority] : authority;
-  localStorage.setItem('antd-pro-authority', JSON.stringify(proAuthority)); // auto reload
+  const proAuthority = typeof authority === 'string' ? [ authority ] : authority
+  localStorage.setItem('antd-pro-authority', JSON.stringify(proAuthority)) // auto reload
 
 
-  reloadAuthorized();
+  reloadAuthorized()
 }
 }

+ 16 - 16
src/utils/request.js

@@ -2,8 +2,8 @@
  * request 网络请求工具
  * request 网络请求工具
  * 更详细的 api 文档: https://github.com/umijs/umi-request
  * 更详细的 api 文档: https://github.com/umijs/umi-request
  */
  */
-import { extend } from 'umi-request';
-import { notification } from 'antd';
+import { extend } from 'umi-request'
+import { notification } from 'antd'
 
 
 const codeMessage = {
 const codeMessage = {
   200: '服务器成功返回请求的数据。',
   200: '服务器成功返回请求的数据。',
@@ -20,31 +20,31 @@ const codeMessage = {
   500: '服务器发生错误,请检查服务器。',
   500: '服务器发生错误,请检查服务器。',
   502: '网关错误。',
   502: '网关错误。',
   503: '服务不可用,服务器暂时过载或维护。',
   503: '服务不可用,服务器暂时过载或维护。',
-  504: '网关超时。',
-};
+  504: '网关超时。'
+}
 /**
 /**
  * 异常处理程序
  * 异常处理程序
  */
  */
 
 
 const errorHandler = (error) => {
 const errorHandler = (error) => {
-  const { response } = error;
+  const { response } = error
 
 
   if (response && response.status) {
   if (response && response.status) {
-    const errorText = codeMessage[response.status] || response.statusText;
-    const { status, url } = response;
+    const errorText = codeMessage[response.status] || response.statusText
+    const { status, url } = response
     notification.error({
     notification.error({
       message: `请求错误 ${status}: ${url}`,
       message: `请求错误 ${status}: ${url}`,
-      description: errorText,
-    });
+      description: errorText
+    })
   } else if (!response) {
   } else if (!response) {
     notification.error({
     notification.error({
       description: '您的网络发生异常,无法连接服务器',
       description: '您的网络发生异常,无法连接服务器',
-      message: '网络异常',
-    });
+      message: '网络异常'
+    })
   }
   }
 
 
-  return response;
-};
+  return response
+}
 /**
 /**
  * 配置request请求时的默认参数
  * 配置request请求时的默认参数
  */
  */
@@ -52,6 +52,6 @@ const errorHandler = (error) => {
 const request = extend({
 const request = extend({
   errorHandler,
   errorHandler,
   // 默认错误处理
   // 默认错误处理
-  credentials: 'include', // 默认请求是否带上cookie
-});
-export default request;
+  credentials: 'include' // 默认请求是否带上cookie
+})
+export default request

+ 11 - 11
src/utils/utils.js

@@ -1,23 +1,23 @@
-import { parse } from 'querystring';
+import { parse } from 'querystring'
 /* eslint no-useless-escape:0 import/prefer-default-export:0 */
 /* eslint no-useless-escape:0 import/prefer-default-export:0 */
 
 
-const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
-export const isUrl = (path) => reg.test(path);
+const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/
+export const isUrl = (path) => reg.test(path)
 export const isAntDesignPro = () => {
 export const isAntDesignPro = () => {
   if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
   if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
-    return true;
+    return true
   }
   }
 
 
-  return window.location.hostname === 'preview.pro.ant.design';
-}; // 给官方演示站点用,用于关闭真实开发环境不需要使用的特性
+  return window.location.hostname === 'preview.pro.ant.design'
+} // 给官方演示站点用,用于关闭真实开发环境不需要使用的特性
 
 
 export const isAntDesignProOrDev = () => {
 export const isAntDesignProOrDev = () => {
-  const { NODE_ENV } = process.env;
+  const { NODE_ENV } = process.env
 
 
   if (NODE_ENV === 'development') {
   if (NODE_ENV === 'development') {
-    return true;
+    return true
   }
   }
 
 
-  return isAntDesignPro();
-};
-export const getPageQuery = () => parse(window.location.href.split('?')[1]);
+  return isAntDesignPro()
+}
+export const getPageQuery = () => parse(window.location.href.split('?')[1])

+ 30 - 30
src/utils/utils.test.js

@@ -1,35 +1,35 @@
-import { isUrl } from './utils';
+import { isUrl } from './utils'
 
 
 describe('isUrl tests', () => {
 describe('isUrl tests', () => {
   it('should return false for invalid and corner case inputs', () => {
   it('should return false for invalid and corner case inputs', () => {
-    expect(isUrl([])).toBeFalsy();
-    expect(isUrl({})).toBeFalsy();
-    expect(isUrl(false)).toBeFalsy();
-    expect(isUrl(true)).toBeFalsy();
-    expect(isUrl(NaN)).toBeFalsy();
-    expect(isUrl(null)).toBeFalsy();
-    expect(isUrl(undefined)).toBeFalsy();
-    expect(isUrl('')).toBeFalsy();
-  });
+    expect(isUrl([])).toBeFalsy()
+    expect(isUrl({})).toBeFalsy()
+    expect(isUrl(false)).toBeFalsy()
+    expect(isUrl(true)).toBeFalsy()
+    expect(isUrl(NaN)).toBeFalsy()
+    expect(isUrl(null)).toBeFalsy()
+    expect(isUrl(undefined)).toBeFalsy()
+    expect(isUrl('')).toBeFalsy()
+  })
   it('should return false for invalid URLs', () => {
   it('should return false for invalid URLs', () => {
-    expect(isUrl('foo')).toBeFalsy();
-    expect(isUrl('bar')).toBeFalsy();
-    expect(isUrl('bar/test')).toBeFalsy();
-    expect(isUrl('http:/example.com/')).toBeFalsy();
-    expect(isUrl('ttp://example.com/')).toBeFalsy();
-  });
+    expect(isUrl('foo')).toBeFalsy()
+    expect(isUrl('bar')).toBeFalsy()
+    expect(isUrl('bar/test')).toBeFalsy()
+    expect(isUrl('http:/example.com/')).toBeFalsy()
+    expect(isUrl('ttp://example.com/')).toBeFalsy()
+  })
   it('should return true for valid URLs', () => {
   it('should return true for valid URLs', () => {
-    expect(isUrl('http://example.com/')).toBeTruthy();
-    expect(isUrl('https://example.com/')).toBeTruthy();
-    expect(isUrl('http://example.com/test/123')).toBeTruthy();
-    expect(isUrl('https://example.com/test/123')).toBeTruthy();
-    expect(isUrl('http://example.com/test/123?foo=bar')).toBeTruthy();
-    expect(isUrl('https://example.com/test/123?foo=bar')).toBeTruthy();
-    expect(isUrl('http://www.example.com/')).toBeTruthy();
-    expect(isUrl('https://www.example.com/')).toBeTruthy();
-    expect(isUrl('http://www.example.com/test/123')).toBeTruthy();
-    expect(isUrl('https://www.example.com/test/123')).toBeTruthy();
-    expect(isUrl('http://www.example.com/test/123?foo=bar')).toBeTruthy();
-    expect(isUrl('https://www.example.com/test/123?foo=bar')).toBeTruthy();
-  });
-});
+    expect(isUrl('http://example.com/')).toBeTruthy()
+    expect(isUrl('https://example.com/')).toBeTruthy()
+    expect(isUrl('http://example.com/test/123')).toBeTruthy()
+    expect(isUrl('https://example.com/test/123')).toBeTruthy()
+    expect(isUrl('http://example.com/test/123?foo=bar')).toBeTruthy()
+    expect(isUrl('https://example.com/test/123?foo=bar')).toBeTruthy()
+    expect(isUrl('http://www.example.com/')).toBeTruthy()
+    expect(isUrl('https://www.example.com/')).toBeTruthy()
+    expect(isUrl('http://www.example.com/test/123')).toBeTruthy()
+    expect(isUrl('https://www.example.com/test/123')).toBeTruthy()
+    expect(isUrl('http://www.example.com/test/123?foo=bar')).toBeTruthy()
+    expect(isUrl('https://www.example.com/test/123?foo=bar')).toBeTruthy()
+  })
+})