From f7e9b835c30e5b3287b2c04e24950871cafa907d Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Mon, 07 Sep 2020 15:28:45 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/huge/frontEnd/hugeOA

---
 src/module/login/login.jsx |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/module/login/login.jsx b/src/module/login/login.jsx
index 30856a9..ac1e7ad 100644
--- a/src/module/login/login.jsx
+++ b/src/module/login/login.jsx
@@ -12,6 +12,9 @@
 import logo from '../../img/logo.png';
 import fetch from '../../api/request';
 import { oaMenus, userMenus, getMenuListByPermission } from '../../menu';
+import { Context } from '../../index';
+import { createHashHistory } from 'history';
+const history = createHashHistory();
 
 class NormalLoginForm extends React.Component {
   constructor(props) {
@@ -24,7 +27,7 @@
     };
   }
   componentWillMount() {
-    document.title = '恒巨信息OA-用户登录'
+    document.title = '恒巨信息OA-用户登录';
   }
 
   handleSubmit = e => {
@@ -65,6 +68,19 @@
     }).then(res => {
       console.log('res', res);
       if (res) {
+        console.log('oa', res.map(({ symbol }) => (symbol)).concat(res.map(({ moduleSymbol }) => (moduleSymbol))).reduce((p, n) => {
+          if (p.indexOf(n) == -1) {
+            return p.concat(n)
+          } else {
+            return p
+          }
+        }, []), getMenuListByPermission(oaMenus, res && res.map(({ symbol }) => (symbol)).concat(res.map(({ moduleSymbol }) => (moduleSymbol))).reduce((p, n) => {
+          if (p.indexOf(n) == -1) {
+            return p.concat(n)
+          } else {
+            return p
+          }
+        }, [])), oaMenus)
         window.localStorage.setItem('menu', JSON.stringify(res));
         window.localStorage.setItem('menusListByRole', JSON.stringify({
           user: { role: 'user', menus: userMenus },
@@ -79,9 +95,9 @@
           }
         }));//所有模块菜单
         message.success('登录成功');
-        setTimeout(() => {
-          this.props.history.push({ pathname: "/index" });
-        }, 1500);//延时跳转
+        console.log('this props', this.props);
+        history.push({ pathname: "/index" });
+        this.props.setContext && this.props.setContext({ role: 'oa' })
       }
     })
   }
@@ -139,7 +155,6 @@
           </div>
           <div className="login-div-bottom">2011 10215489广州恒巨信息科技有限公司 版权所有 - 粤ICP备10215489号</div>
         </div>
-
       </div>
     );
   }

--
Gitblit v1.8.0