add login loading

This commit is contained in:
zuiidea
2016-09-12 23:27:11 +08:00
parent 4ded5dbf91
commit 1d368d724d
2 changed files with 10 additions and 4 deletions
+4 -4
View File
@@ -12,10 +12,10 @@ import { Spin, message, Icon } from 'antd'
const App = React.createClass({
getInitialState() {
return {
// loading: true,
// login: false,
loading: false,
login: true,
loading: true,
login: false,
// loading: false,
// login: true,
userName: '未登录',
collapse: false,
}
+6
View File
@@ -19,8 +19,10 @@ let SignIn = React.createClass({
if (!!errors) {
return
}
_this.setState({ loading: true })
ajax.post(`${config.getAPIPath()}${config.login.validate}`)
.type('form').send(values).end((err, res) => {
_this.setState({ loading: false })
if (ajax.isSuccess(res)) {
if (this.props.loginSuccess) {
this.props.loginSuccess(res.body.data, true)
@@ -69,6 +71,10 @@ let SignIn = React.createClass({
登录
</Button>
</Row>
<p style={{color:'#ccc',textAlign:'center'}} className='m-y-sm'>
<span className='mr'>账号:guest</span>
<span>密码:guest</span>
</p>
</form>
</div>
)