From 0bd9e1222d867893b66044b04754d9cc967d472e Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Mon, 06 Apr 2020 16:49:45 +0800
Subject: [PATCH] 新建文档
---
src/pages/login/login.jsx | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/pages/login/login.jsx b/src/pages/login/login.jsx
index c967383..8d6150e 100644
--- a/src/pages/login/login.jsx
+++ b/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('登录成功', () => {
- this.props.history.push({ pathname: "/index" });
+
+ 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,24 +86,24 @@
<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
- style={{ width: '32vh',height: '5vh',margin:'12px' }}
+ style={{ width: '32vh', height: '5vh', margin: '12px' }}
prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />}
placeholder="请输入账号"
/>,
)}
</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' }}
- prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)'}} />}
+ style={{ width: '32vh', height: '5vh', margin: '12px' }}
+ prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
type="password"
placeholder="请输入密码"
/>,
--
Gitblit v1.8.0