Skip to content

Commit

Permalink
代码注释
Browse files Browse the repository at this point in the history
  • Loading branch information
hiphonezhu committed Aug 19, 2016
1 parent 393b2b6 commit 5c0c474
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Demo12/src/constants/ActionTypes.js
Original file line number Diff line number Diff line change
@@ -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'; // 登录完成
10 changes: 7 additions & 3 deletions Demo12/src/pages/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LoginPage extends Component {

shouldComponentUpdate(nextProps, nextState)
{
// 登陆完成,且成功登陆
// 登录完成,且成功登录
if (nextProps.status === 'done' && nextProps.isSuccess) {
this.props.navigator.replace({
id: 'MainPage',
Expand All @@ -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 (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center', flexDirection: 'column'}}>
Expand Down
6 changes: 3 additions & 3 deletions Demo12/src/reducers/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5c0c474

Please sign in to comment.