Commit 17482b6c by zhanghaozhe

账号登录

parent 48f9746a
import React, { PureComponent } from "react"
import './accountLogin.scss'
import { Link } from "react-router-dom";
import { withFormik, FastField, Form } from "formik";
import { compose } from 'redux';
import { accountLogin } from '@/store/userAction';
import { connect } from "react-redux";
import { Link } from "react-router-dom"
import { withFormik, FastField, Form } from "formik"
import { compose } from 'redux'
import { accountLogin } from '@/store/userAction'
import { connect } from "react-redux"
import { isEmpty } from 'lodash'
import { HeaderBar } from "@/common";
import { HeaderBar } from "@/common"
import Header from "../common/Header";
import Header from "../common/Header"
import Input from '../common/Input'
import LoginButton from '../common/LoginButton'
import PasswordInput from '../common/passwordInput'
import { Toast } from "antd-mobile";
import { Toast } from "antd-mobile"
class AccountLogin extends PureComponent {
......@@ -60,7 +60,7 @@ class AccountLogin extends PureComponent {
<Link className={'forgot-password-btn'} to='/passport/forgot-password'>忘记密码</Link>
</Form>
</div>
);
)
}
}
......@@ -74,12 +74,21 @@ const formikConfig = {
const {props, props: {history}} = formikBag
const from = props.location.state && props.location.state.from
props.accountLogin({
username, password,redirect: from && window.location.origin + from.pathname + from.search + from.hash
username, password, redirect: from && window.location.origin + from.pathname + from.search + from.hash
}).then(res => {
if (res.hasError) {
Toast.info(res.msg, 2, null, false)
}
})
},
validate: values => {
const errors = {}
if (!values.account) {
errors.account = '账号不能为空'
} else if (!values.password) {
errors.password = '密码不能为空'
}
return errors
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment