张延森 3 jaren geleden
bovenliggende
commit
0cb4ebb19a

+ 1
- 0
package.json Bestand weergeven

@@ -59,6 +59,7 @@
59 59
     "antd": "^4.17.0",
60 60
     "classnames": "^2.3.0",
61 61
     "echarts": "^5.3.2",
62
+    "html2canvas": "^1.4.1",
62 63
     "lodash": "^4.17.0",
63 64
     "md5": "^2.3.0",
64 65
     "moment": "^2.29.1",

+ 2
- 2
src/app.jsx Bestand weergeven

@@ -4,7 +4,7 @@ import RightContent from '@/components/RightContent';
4 4
 import Footer from '@/components/Footer';
5 5
 import { currentUser as queryCurrentUser } from './services/user';
6 6
 import { requestConfig } from '@/utils/request';
7
-import myPath from './utils/myPath';
7
+import { getLoginPath } from './utils';
8 8
 
9 9
 const isDev = process.env.NODE_ENV === 'development';
10 10
 let loginPath = '/user/orgLogin';
@@ -21,7 +21,7 @@ export async function getInitialState() {
21 21
     try {
22 22
       return await queryCurrentUser();
23 23
     } catch (error) {
24
-      history.push(myPath());
24
+      history.push(getLoginPath());
25 25
     }
26 26
 
27 27
     return undefined;

+ 35
- 33
src/components/Footer/index.jsx Bestand weergeven

@@ -2,38 +2,40 @@ import { useIntl } from 'umi';
2 2
 import { GithubOutlined } from '@ant-design/icons';
3 3
 import { DefaultFooter } from '@ant-design/pro-layout';
4 4
 
5
-const Footer = () => {
6
-  const intl = useIntl();
7
-  const defaultMessage = intl.formatMessage({
8
-    id: 'app.copyright.produced',
9
-    defaultMessage: '云致科技',
10
-  });
11
-  const currentYear = new Date().getFullYear();
12
-  return (
13
-    <DefaultFooter
14
-      copyright={`${currentYear} ${defaultMessage}`}
15
-    // links={[
16
-    //   {
17
-    //     key: 'Ant Design Pro',
18
-    //     title: 'Ant Design Pro',
19
-    //     href: 'https://pro.ant.design',
20
-    //     blankTarget: true,
21
-    //   },
22
-    //   {
23
-    //     key: 'github',
24
-    //     title: <GithubOutlined />,
25
-    //     href: 'https://github.com/ant-design/ant-design-pro',
26
-    //     blankTarget: true,
27
-    //   },
28
-    //   {
29
-    //     key: 'Ant Design',
30
-    //     title: 'Ant Design',
31
-    //     href: 'https://ant.design',
32
-    //     blankTarget: true,
33
-    //   },
34
-    // ]}
35
-    />
36
-  );
37
-};
5
+const Footer = () => <></>
6
+
7
+// const Footer = () => {
8
+//   const intl = useIntl();
9
+//   const defaultMessage = intl.formatMessage({
10
+//     id: 'app.copyright.produced',
11
+//     defaultMessage: '云致科技',
12
+//   });
13
+//   const currentYear = new Date().getFullYear();
14
+//   return (
15
+//     <DefaultFooter
16
+//       copyright={`${currentYear} ${defaultMessage}`}
17
+//     // links={[
18
+//     //   {
19
+//     //     key: 'Ant Design Pro',
20
+//     //     title: 'Ant Design Pro',
21
+//     //     href: 'https://pro.ant.design',
22
+//     //     blankTarget: true,
23
+//     //   },
24
+//     //   {
25
+//     //     key: 'github',
26
+//     //     title: <GithubOutlined />,
27
+//     //     href: 'https://github.com/ant-design/ant-design-pro',
28
+//     //     blankTarget: true,
29
+//     //   },
30
+//     //   {
31
+//     //     key: 'Ant Design',
32
+//     //     title: 'Ant Design',
33
+//     //     href: 'https://ant.design',
34
+//     //     blankTarget: true,
35
+//     //   },
36
+//     // ]}
37
+//     />
38
+//   );
39
+// };
38 40
 
39 41
 export default Footer;

+ 9
- 0
src/components/QRCode/index.jsx Bestand weergeven

@@ -0,0 +1,9 @@
1
+import React from 'react'
2
+
3
+export default (props) => {
4
+  return (
5
+    <div>
6
+      <div></div>
7
+    </div>
8
+  )
9
+}

+ 7
- 8
src/components/RightContent/AvatarDropdown.jsx Bestand weergeven

@@ -6,19 +6,20 @@ import { stringify } from 'querystring';
6 6
 import HeaderDropdown from '../HeaderDropdown';
7 7
 import ChangePassword from './ChangePassword';
8 8
 import styles from './index.less';
9
-import myPath from '@/utils/myPath';
9
+import { getLoginPath } from '@/utils';
10 10
 
11 11
 /**
12 12
  * 退出登录,并且将当前的 url 保存
13 13
  */
14 14
 const loginOut = async () => {
15
+  const loginPath = getLoginPath()
16
+  setInitialState((s) => ({ ...s, currentUser: undefined }));
15 17
   localStorage.removeItem('token');
16
-  localStorage.removeItem('orgId');
17 18
   const { query = {}, pathname } = history.location;
18 19
   const { redirect } = query;
19 20
   if (window.location.pathname !== '/user/login' && !redirect) {
20 21
     history.replace({
21
-      pathname: myPath(),
22
+      pathname: loginPath,
22 23
       search: stringify({
23 24
         redirect: pathname,
24 25
       }),
@@ -27,15 +28,14 @@ const loginOut = async () => {
27 28
 };
28 29
 const AvatarDropdown = ({ menu }) => {
29 30
   const [showPasswordModal, setShowPasswordModal] = useState(false);
30
-  const { initialState, setInitialState } = useModel('@@initialState');
31
+  const { initialState } = useModel('@@initialState');
31 32
 
32 33
   const onMenuClick = useCallback(
33 34
     (event) => {
34 35
       const { key } = event;
35 36
 
36 37
       if (key === 'logout') {
37
-        setInitialState((s) => ({ ...s, currentUser: undefined }));
38
-        loginOut('admin');
38
+        loginOut();
39 39
         return;
40 40
       }
41 41
 
@@ -44,13 +44,12 @@ const AvatarDropdown = ({ menu }) => {
44 44
         return;
45 45
       }
46 46
     },
47
-    [setInitialState],
47
+    [],
48 48
   );
49 49
 
50 50
   const handleChangeSuccessful = () => {
51 51
     message.success('密码修改成功');
52 52
     setShowPasswordModal(false);
53
-    setInitialState((s) => ({ ...s, currentUser: undefined }));
54 53
     loginOut();
55 54
     return;
56 55
   };

src/utils/myPath.js → src/utils/index.js Bestand weergeven

@@ -1,9 +1,9 @@
1 1
 
2
-export default function myPath(){
2
+export function getLoginPath(){
3 3
   let role = localStorage.getItem('roleAlias');
4 4
   if (role == 'admin') {
5 5
     return '/user/login'
6 6
   } else {
7 7
     return '/user/orgLogin'
8 8
   }
9
-}
9
+}