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))