From 5c0c47473633a34fdddbb062c950f346453300c5 Mon Sep 17 00:00:00 2001 From: hiphonezhu Date: Fri, 19 Aug 2016 12:18:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Demo12/src/constants/ActionTypes.js | 4 ++-- Demo12/src/pages/LoginPage.js | 10 +++++++--- Demo12/src/reducers/Login.js | 6 +++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Demo12/src/constants/ActionTypes.js b/Demo12/src/constants/ActionTypes.js index 643e6ff..27d49d7 100644 --- a/Demo12/src/constants/ActionTypes.js +++ b/Demo12/src/constants/ActionTypes.js @@ -1,3 +1,3 @@ export const LOGIN_IN_INIT = 'LOGIN_IN_INIT'; // 初始状态 -export const LOGIN_IN_DOING = 'LOGIN_IN_DOING'; // 正在登陆 -export const LOGIN_IN_DONE = 'LOGIN_IN_DONE'; // 登陆完成 +export const LOGIN_IN_DOING = 'LOGIN_IN_DOING'; // 正在登录 +export const LOGIN_IN_DONE = 'LOGIN_IN_DONE'; // 登录完成 diff --git a/Demo12/src/pages/LoginPage.js b/Demo12/src/pages/LoginPage.js index 8e7b1c2..7e8dcc8 100644 --- a/Demo12/src/pages/LoginPage.js +++ b/Demo12/src/pages/LoginPage.js @@ -17,7 +17,7 @@ class LoginPage extends Component { shouldComponentUpdate(nextProps, nextState) { - // 登陆完成,且成功登陆 + // 登录完成,且成功登录 if (nextProps.status === 'done' && nextProps.isSuccess) { this.props.navigator.replace({ id: 'MainPage', @@ -35,11 +35,15 @@ class LoginPage extends Component { let tips; if (this.props.status === 'init') { - tips = '请点击登陆'; + tips = '请点击登录'; } else if (this.props.status === 'doing') { - tips = '正在登陆...'; + tips = '正在登录...'; + } + else if (this.props.status === 'done' && !this.props.isSuccess) + { + tips = '登录失败, 请重新登录'; } return ( diff --git a/Demo12/src/reducers/Login.js b/Demo12/src/reducers/Login.js index 2100273..edef199 100644 --- a/Demo12/src/reducers/Login.js +++ b/Demo12/src/reducers/Login.js @@ -10,19 +10,19 @@ const initialState = { export default function loginIn(state = initialState, action) { switch (action.type) { - case types.LOGIN_IN_INIT: + case types.LOGIN_IN_INIT: // 初始状态 return Object.assign({}, state, { status: 'init', isSuccess: false, user: null }); - case types.LOGIN_IN_DOING: + case types.LOGIN_IN_DOING: // 正在登录 return Object.assign({}, state, { status: 'doing', isSuccess: false, user: null }); - case types.LOGIN_IN_DONE: + case types.LOGIN_IN_DONE: // 登录完成 return Object.assign({}, state, { status: 'done', isSuccess: action.isSuccess,