From f962e587e66f76fabb6f7100bfb4dae7496bc7f5 Mon Sep 17 00:00:00 2001 From: bigfengyu Date: Fri, 15 Nov 2019 16:43:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B3=A8=E5=86=8C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...491... fix: 同步 github 上的跳转 bug | 27 +++++++++++++++++++ src/components/account/RegisterForm.tsx | 6 +++-- src/relatives/AccountRelative.ts | 5 +++- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 src/components/account/LoginForm.sass~3c31491... fix: 同步 github 上的跳转 bug diff --git a/src/components/account/LoginForm.sass~3c31491... fix: 同步 github 上的跳转 bug b/src/components/account/LoginForm.sass~3c31491... fix: 同步 github 上的跳转 bug new file mode 100644 index 0000000..b319c4a --- /dev/null +++ b/src/components/account/LoginForm.sass~3c31491... fix: 同步 github 上的跳转 bug @@ -0,0 +1,27 @@ +@import "../../assets/variables.sass"; +// 水平居中 + 垂直居中 +.wrapper + background-size: cover; + width: 100% + height: 100% + min-height: 800px + .LoginForm + position: fixed; + left: 50%; + top: 30%; + width: 25rem; + margin-left: -12.5rem; + margin-top: -135px; + border: 1px solid #E6E6E6; + border-radius: .5rem; + .header + padding: 1.5rem 3rem; + border-bottom: 1px solid $border; + .title + font-size: 2rem; + .body + padding: 1.5rem 3rem; + .footer + padding: 1.5rem 3rem; + border-top: 1px solid $border; + diff --git a/src/components/account/RegisterForm.tsx b/src/components/account/RegisterForm.tsx index 115bcb7..28c30d1 100644 --- a/src/components/account/RegisterForm.tsx +++ b/src/components/account/RegisterForm.tsx @@ -92,8 +92,10 @@ class RegisterForm extends Component { handleSubmit = (e: any) => { const { onAddUser } = this.props e.preventDefault() - onAddUser(this.state, () => { - window.location.href = '/' + onAddUser(this.state, (isOk: boolean) => { + if (isOk) { + window.location.href = '/' + } }) }; } diff --git a/src/relatives/AccountRelative.ts b/src/relatives/AccountRelative.ts index 9937370..f08d10f 100644 --- a/src/relatives/AccountRelative.ts +++ b/src/relatives/AccountRelative.ts @@ -101,7 +101,9 @@ const relatives = { *[AccountAction.addUser(null, null).type](action: any) { try { const user = yield call(AccountService.addUser, action.user) + let isOk = false if (user && user.id) { + isOk = true yield put(AccountAction.addUserSucceeded(user)) try { const user = yield call(AccountService.fetchLoginInfo) @@ -113,10 +115,11 @@ const relatives = { } yield put(push('/')) } else { + yield put(showMessage(`注册失败:${user.errMsg}`, MSG_TYPE.ERROR)) yield put(AccountAction.addUserFailed('注册失败')) } if (action.onResolved) { - action.onResolved() + action.onResolved(isOk) } } catch (e) { yield put(AccountAction.addUserFailed(e.message))