|
@@ -1,5 +1,5 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
-import { Form, Icon, Input, Button, Checkbox, Spin,message } from 'antd';
|
|
|
|
|
|
+import { Form, Icon, Input, Button, Checkbox, Spin, message } from 'antd';
|
|
import './login.less';
|
|
import './login.less';
|
|
import ajax from 'jquery/src/ajax/xhr.js'
|
|
import ajax from 'jquery/src/ajax/xhr.js'
|
|
import $ from 'jquery/src/ajax';
|
|
import $ from 'jquery/src/ajax';
|
|
@@ -29,11 +29,23 @@ const LoginForm = Form.create()(React.createClass({
|
|
"type": this.props.loginProp,
|
|
"type": this.props.loginProp,
|
|
"remember": values.remember
|
|
"remember": values.remember
|
|
}
|
|
}
|
|
- }).done(function (data) {
|
|
|
|
- if (!data.error.length) {
|
|
|
|
- window.location.href = globalConfig.context + "/user/account/index.html";
|
|
|
|
|
|
+ }).done(function (res) {
|
|
|
|
+ if (!res.error.length) {
|
|
|
|
+ let data = res.data;
|
|
|
|
+ if (data && data.requestURI) {
|
|
|
|
+ let path = globalConfig.context + data.requestURI
|
|
|
|
+ if (data.queryString) {
|
|
|
|
+ path += '?' + data.queryString;
|
|
|
|
+ }
|
|
|
|
+ if (window.location.hash) {
|
|
|
|
+ path += window.location.hash;
|
|
|
|
+ }
|
|
|
|
+ window.location.href = path;
|
|
|
|
+ } else {
|
|
|
|
+ window.location.href = globalConfig.context + "/user/account/index.html";
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- message.warning(data.error[0].message);
|
|
|
|
|
|
+ message.warning(res.error[0].message);
|
|
}
|
|
}
|
|
}.bind(this)).always(function () {
|
|
}.bind(this)).always(function () {
|
|
this.props.spinState(false);
|
|
this.props.spinState(false);
|
|
@@ -44,34 +56,34 @@ const LoginForm = Form.create()(React.createClass({
|
|
render() {
|
|
render() {
|
|
const { getFieldDecorator } = this.props.form;
|
|
const { getFieldDecorator } = this.props.form;
|
|
return (
|
|
return (
|
|
- <Form onSubmit={this.handleSubmit} className="login-form">
|
|
|
|
- <FormItem>
|
|
|
|
- {getFieldDecorator('phone', {
|
|
|
|
- rules: [{ required: true, message: '请输入手机号!' }],
|
|
|
|
- })(
|
|
|
|
- <Input addonBefore={<Icon type="user" />} placeholder="手机号" />
|
|
|
|
- )}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem>
|
|
|
|
- {getFieldDecorator('password', {
|
|
|
|
- rules: [{ required: true, message: '请输入密码!' }],
|
|
|
|
- })(
|
|
|
|
- <Input addonBefore={<Icon type="lock" />} type="password" placeholder="密码" />
|
|
|
|
- )}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem>
|
|
|
|
- {getFieldDecorator('remember', {
|
|
|
|
- valuePropName: 'checked',
|
|
|
|
- initialValue: false,
|
|
|
|
- })(
|
|
|
|
- <Checkbox>记住我</Checkbox>
|
|
|
|
- )}
|
|
|
|
- <ForgetPw theType={this.props.loginProp}/>
|
|
|
|
- <Button type="primary" htmlType="submit" className="login-form-button">
|
|
|
|
- 登录
|
|
|
|
|
|
+ <Form onSubmit={this.handleSubmit} className="login-form">
|
|
|
|
+ <FormItem>
|
|
|
|
+ {getFieldDecorator('phone', {
|
|
|
|
+ rules: [{ required: true, message: '请输入手机号!' }],
|
|
|
|
+ })(
|
|
|
|
+ <Input addonBefore={<Icon type="user" />} placeholder="手机号" />
|
|
|
|
+ )}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem>
|
|
|
|
+ {getFieldDecorator('password', {
|
|
|
|
+ rules: [{ required: true, message: '请输入密码!' }],
|
|
|
|
+ })(
|
|
|
|
+ <Input addonBefore={<Icon type="lock" />} type="password" placeholder="密码" />
|
|
|
|
+ )}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem>
|
|
|
|
+ {getFieldDecorator('remember', {
|
|
|
|
+ valuePropName: 'checked',
|
|
|
|
+ initialValue: false,
|
|
|
|
+ })(
|
|
|
|
+ <Checkbox>记住我</Checkbox>
|
|
|
|
+ )}
|
|
|
|
+ <ForgetPw theType={this.props.loginProp} />
|
|
|
|
+ <Button type="primary" htmlType="submit" className="login-form-button">
|
|
|
|
+ 登录
|
|
</Button>
|
|
</Button>
|
|
- </FormItem>
|
|
|
|
- </Form>
|
|
|
|
|
|
+ </FormItem>
|
|
|
|
+ </Form>
|
|
);
|
|
);
|
|
},
|
|
},
|
|
}));
|
|
}));
|