forked from huge/frontEnd/hugeOA

Mr Ke
2020-05-27 fa71559c92ce8f7429971370ca4bd1139c903621
src/module/login/login.jsx
File was renamed from src/pages/login/login.jsx
@@ -10,8 +10,8 @@
import './login.scss';
import logo from '../../img/logo.png';
import fetch from '../../api/request';
import { oaMenus, userMenus, getMenuListByPermission } from '../../menu';
class NormalLoginForm extends React.Component {
  constructor(props) {
@@ -66,8 +66,22 @@
      console.log('res', res);
      if (res) {
        window.localStorage.setItem('menu', JSON.stringify(res));
        window.localStorage.setItem('menusListByRole', JSON.stringify({
          user: { role: 'user', menus: userMenus },
          oa: {
            role: 'oa', menus: 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
              }
            }, []))
          }
        }));//所有模块菜单
        message.success('登录成功');
        setTimeout(() => {
        this.props.history.push({ pathname: "/index" });
        }, 1500);//延时跳转
      }
    })
  }
@@ -99,7 +113,7 @@
                <Form.Item className="login-div-content-form-flex">
                  {getFieldDecorator('credential', {
                    rules: [{ required: true, message: '请输入密码!' }],
                    initialValue: 'admin'
                    // initialValue: 'admin'
                  })(
                    <Input
                      style={{ width: '300px', height: '48px', margin: '12px' }}