From fe8683d46b441f6d86f3659cf6a479b3137b0560 Mon Sep 17 00:00:00 2001 From: kdxcxs Date: Thu, 3 Dec 2020 13:25:49 +0800 Subject: [PATCH] feat: show error info in toast when login failed --- src/component/YooLogin.js | 4 ++-- src/ui/YooLoginUI.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/component/YooLogin.js b/src/component/YooLogin.js index 2215df7..307b960 100644 --- a/src/component/YooLogin.js +++ b/src/component/YooLogin.js @@ -46,13 +46,13 @@ export default class YooLogin extends Component { }) .then((response) => { if (/(.|\n)*用户登录(.|\n)*<\/title>/.test(response)) { - onFail(); + onFail('用户名或密码错误'); CookieManager.clearAll(); } else if (/<title>(.|\n)*网络课程(.|\n)*<\/title>/.test(response)) { this.props.gotoForum(); } }) - .catch(onFail); + .catch(() => onFail('登陆失败')); } render() { diff --git a/src/ui/YooLoginUI.js b/src/ui/YooLoginUI.js index d3634fc..2bb6132 100644 --- a/src/ui/YooLoginUI.js +++ b/src/ui/YooLoginUI.js @@ -63,9 +63,9 @@ export default class YooLoginUI extends Component { } } - onLoginFailed() { + onLoginFailed(hint) { this.setState({loading: false}); - ToastAndroid.show('登录失败', ToastAndroid.SHORT); + ToastAndroid.show(hint, ToastAndroid.SHORT); } render() {