Commit 5c1747e2 by zhanghaozhe

登录传redirect地址,统计用

parent e04d633d
...@@ -72,8 +72,9 @@ const formikConfig = { ...@@ -72,8 +72,9 @@ const formikConfig = {
handleSubmit(values, formikBag) { handleSubmit(values, formikBag) {
const {account: username, password} = values const {account: username, password} = values
const {props, props: {history}} = formikBag const {props, props: {history}} = formikBag
const from = props.location.state && props.location.state.from
props.accountLogin({ props.accountLogin({
username, password username, password,redirect: from && window.location.origin + from.pathname + from.search + from.hash
}).then(res => { }).then(res => {
if (res.hasError) { if (res.hasError) {
Toast.info(res.msg, 2, null, false) Toast.info(res.msg, 2, null, false)
......
...@@ -130,10 +130,12 @@ const FormikConfig = { ...@@ -130,10 +130,12 @@ const FormikConfig = {
veriCode: '' veriCode: ''
}), }),
handleSubmit(values, {props}) { handleSubmit(values, {props}) {
const from = props.location.state && props.location.state.from
props.quickLogin({ props.quickLogin({
phone_num: values.tel, phone_num: values.tel,
phone_code: values.veriCode, phone_code: values.veriCode,
area_code: '00'+props.country.num area_code: '00'+props.country.num,
redirect: from && window.location.origin + from.pathname + from.search + from.hash
}).then(res => { }).then(res => {
if (res.hasError) { if (res.hasError) {
Toast.info(res.msg); Toast.info(res.msg);
...@@ -163,4 +165,4 @@ export default compose( ...@@ -163,4 +165,4 @@ export default compose(
{quickLogin} {quickLogin}
), ),
withFormik(FormikConfig), withFormik(FormikConfig),
)(Login) )(Login)
\ No newline at end of file
...@@ -7,7 +7,8 @@ const accountLogin = user => dispatch => { ...@@ -7,7 +7,8 @@ const accountLogin = user => dispatch => {
return http.post(`${API['passport-api']}/user_login`, { return http.post(`${API['passport-api']}/user_login`, {
user_name: user.username, user_name: user.username,
password: encrypt(user.password), password: encrypt(user.password),
is_encrypt: 1 is_encrypt: 1,
redirect: user.redirect
}).then(res => { }).then(res => {
return storeUser(res, dispatch) return storeUser(res, dispatch)
}) })
...@@ -80,4 +81,4 @@ export { ...@@ -80,4 +81,4 @@ export {
updateUser, updateUser,
START_FETCH_USER, START_FETCH_USER,
startFetchUser, startFetchUser,
} }
\ No newline at end of file
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