forked from huge/frontEnd/hugeOA

liuwh
2020-04-06 0bd9e1222d867893b66044b04754d9cc967d472e
src/pages/login/login.jsx
@@ -36,8 +36,9 @@
                    btnLoading: true
                });
                fetch({
                    url: `hik-common/api/opus/user/loginTest`,
                    params: {
                    url: `api/account/login`,
                    method: 'POST',
                    data: {
                        ...values
                    }
                }).then(res => {
@@ -53,18 +54,21 @@
    };
    handleRes = (res) => {
        let loginUser = {};
        let curPosIndex = window.localStorage.getItem('curPosIndex');
        curPosIndex = (curPosIndex || curPosIndex == {}) || 0;
        loginUser = res.user[curPosIndex];
        window.localStorage.setItem('user', res);
        // 将token放入缓存
        window.localStorage.setItem('token', res.token);
        window.localStorage.setItem('curPosIndex', curPosIndex);
        window.localStorage.setItem('loginUser', JSON.stringify(loginUser));
        message.success('登录成功', () => {
        fetch({
            url: `api/resource/getResource`,
        }).then(res => {
            console.log('res', res);
            if (res) {
                window.localStorage.setItem('menu', JSON.stringify(res));
                message.success('登录成功');
            this.props.history.push({ pathname: "/index" });
            }
        })
    }
@@ -82,7 +86,7 @@
                            <div className="login-div-content-div-title">登录OA云平台</div>
                            <Form onSubmit={this.handleSubmit} className="login-form">
                                <Form.Item className="login-div-content-form-flex" >
                                    {getFieldDecorator('loginName', {
                                    {getFieldDecorator('account', {
                                        rules: [{ required: true, message: '请输入账号!' }],
                                    })(
                                        <Input
@@ -93,9 +97,9 @@
                                    )}
                                </Form.Item>
                                <Form.Item className="login-div-content-form-flex">
                                    {getFieldDecorator('passWord', {
                                    {getFieldDecorator('credential', {
                                        rules: [{ required: true, message: '请输入密码!' }],
                                        initialValue: 'psw'
                                        initialValue: 'admin'
                                    })(
                                        <Input
                                            style={{ width: '32vh',height: '5vh',margin:'12px' }}