Authored by lixia.zhang

补丁

Showing 1 changed file with 253 additions and 0 deletions
  1 +From b10c11f1958e272ede5b63d47333e9aebc460f01 Mon Sep 17 00:00:00 2001
  2 +From: "lixia.zhang" <yoho@lixiazhangdeiMac.local>
  3 +Date: Mon, 23 Apr 2018 11:55:10 +0800
  4 +Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E9=94=80=E7=8A=B6?=
  5 + =?UTF-8?q?=E6=80=81=E5=88=A4=E6=96=AD=EF=BC=8C=E9=A1=B5=E9=9D=A2=E5=B1=95?=
  6 + =?UTF-8?q?=E7=A4=BA=E4=BC=98=E5=8C=96=EF=BC=8Creview=20by=20=E7=8E=8B?=
  7 + =?UTF-8?q?=E6=B5=B7=E5=85=83?=
  8 +MIME-Version: 1.0
  9 +Content-Type: text/plain; charset=UTF-8
  10 +Content-Transfer-Encoding: 8bit
  11 +
  12 +---
  13 + js/userLogout/constants/actionTypes.js | 5 +-
  14 + js/userLogout/containers/UserLogoutContainer.js | 66 +++++++++++++++-------
  15 + .../reducers/userLogout/userLogoutActions.js | 29 +++++++---
  16 + .../reducers/userLogout/userLogoutInitialState.js | 4 +-
  17 + .../reducers/userLogout/userLogoutReducer.js | 19 ++++++-
  18 + 5 files changed, 89 insertions(+), 34 deletions(-)
  19 +
  20 +diff --git a/js/userLogout/constants/actionTypes.js b/js/userLogout/constants/actionTypes.js
  21 +index 2f51f3a..d214322 100644
  22 +--- a/js/userLogout/constants/actionTypes.js
  23 ++++ b/js/userLogout/constants/actionTypes.js
  24 +@@ -12,8 +12,9 @@ export default keyMirror({
  25 + SET_HOST: null,
  26 + SET_SERVICE_HOST: null,
  27 + UPDATE_LOGOUT_MODAL_STATE: null,
  28 +- UPDATE_LOGOUT_STATUS: null,
  29 +-
  30 ++ FETCH_LOGOUT_STATUS_REQUEST: null,
  31 ++ FETCH_LOGOUT_STATUS_SUCCESS: null,
  32 ++ FETCH_LOGOUT_STATUS_FAILURE: null,
  33 +
  34 + //注销原因
  35 + ENABLE_SUBMIT_BTN: null,
  36 +diff --git a/js/userLogout/containers/UserLogoutContainer.js b/js/userLogout/containers/UserLogoutContainer.js
  37 +index 329d982..28c71b1 100644
  38 +--- a/js/userLogout/containers/UserLogoutContainer.js
  39 ++++ b/js/userLogout/containers/UserLogoutContainer.js
  40 +@@ -9,7 +9,7 @@
  41 + import React, {Component} from 'react';
  42 + import {
  43 + StyleSheet,
  44 +- Dimensions
  45 ++ Dimensions,
  46 + } from 'react-native'
  47 +
  48 + import {bindActionCreators} from 'redux';
  49 +@@ -19,6 +19,8 @@ import * as userLogoutActions from '../reducers/userLogout/userLogoutActions';
  50 + import UserLogout from '../components/userLogout/UserLogout';
  51 + import UserLogoutFaild from '../components/userLogout/UserLogoutFaild';
  52 + import UserLogoutStatus from '../components/userLogout/UserLogoutStatus';
  53 ++import LoadingIndicator from '../../common/components/LoadingIndicator';
  54 ++
  55 +
  56 + const actions = [
  57 + userLogoutActions,
  58 +@@ -82,29 +84,51 @@ class UserLogoutContainer extends Component {
  59 + }
  60 +
  61 + render() {
  62 +- let {showConfirmLogoutModal, logoutStatus} = this.props.userLogout;
  63 ++ let {showConfirmLogoutModal, logoutStatus, isFetching, tipMessage} = this.props.userLogout;
  64 + if (logoutStatus == 0) {
  65 +- return (
  66 +- <UserLogout
  67 +- showConfirmLogoutModal = {showConfirmLogoutModal}
  68 +- onPressLogoutClause = {this._onPressLogoutClause}
  69 +- confirmLogoutAction = {this._confirmLogoutAction}
  70 +- updateLogoutModalState = {this._updateLogoutModalState}
  71 +- />
  72 +- );
  73 ++ if (isFetching) {
  74 ++ return (
  75 ++ <LoadingIndicator isVisible={isFetching}/>
  76 ++ );
  77 ++ } else {
  78 ++ return(
  79 ++ <UserLogout
  80 ++ showConfirmLogoutModal = {showConfirmLogoutModal}
  81 ++ onPressLogoutClause = {this._onPressLogoutClause}
  82 ++ confirmLogoutAction = {this._confirmLogoutAction}
  83 ++ updateLogoutModalState = {this._updateLogoutModalState}
  84 ++ />
  85 ++ )
  86 ++ }
  87 ++
  88 + } else if(logoutStatus == 1){
  89 +- return (
  90 +- <UserLogoutStatus
  91 +- />
  92 +- );
  93 ++ if (isFetching) {
  94 ++ return (
  95 ++ <LoadingIndicator isVisible={isFetching}/>
  96 ++ );
  97 ++ } else {
  98 ++ return (
  99 ++ <UserLogoutStatus
  100 ++ />
  101 ++ )
  102 ++ }
  103 ++
  104 ++
  105 + }else if(logoutStatus == 3){
  106 +- return (
  107 +- <UserLogoutFaild
  108 +- isFaildReasonPage={false}
  109 +- gotoLogoutFaildReason={this._gotoLogoutFaildReason}
  110 +- gotoLogoutReason={this._gotoLogoutReason}
  111 +- />
  112 +- );
  113 ++ if (isFetching) {
  114 ++ return (
  115 ++ <LoadingIndicator isVisible={isFetching}/>
  116 ++ );
  117 ++ } else {
  118 ++ return (
  119 ++ <UserLogoutFaild
  120 ++ isFaildReasonPage={false}
  121 ++ gotoLogoutFaildReason={this._gotoLogoutFaildReason}
  122 ++ gotoLogoutReason={this._gotoLogoutReason}
  123 ++ />
  124 ++ )
  125 ++ }
  126 ++
  127 + }
  128 + }
  129 + }
  130 +diff --git a/js/userLogout/reducers/userLogout/userLogoutActions.js b/js/userLogout/reducers/userLogout/userLogoutActions.js
  131 +index 7c1cd0f..73e296d 100644
  132 +--- a/js/userLogout/reducers/userLogout/userLogoutActions.js
  133 ++++ b/js/userLogout/reducers/userLogout/userLogoutActions.js
  134 +@@ -15,7 +15,9 @@ import UserLogoutService from '../../services/UserLogoutService';
  135 +
  136 + const {
  137 + UPDATE_LOGOUT_MODAL_STATE,
  138 +- UPDATE_LOGOUT_STATUS,
  139 ++ FETCH_LOGOUT_STATUS_REQUEST,
  140 ++ FETCH_LOGOUT_STATUS_SUCCESS,
  141 ++ FETCH_LOGOUT_STATUS_FAILURE,
  142 + } = require('../../constants/actionTypes').default;
  143 +
  144 + export function onPressLogoutClause() {
  145 +@@ -32,10 +34,23 @@ export function updateLogoutModalState(flag) {
  146 + }
  147 + }
  148 +
  149 +-export function updateLogoutStatus(status) {
  150 ++export function fetchLogoutStatusRequest() {
  151 + return{
  152 +- type: UPDATE_LOGOUT_STATUS,
  153 +- payload: status
  154 ++ type: FETCH_LOGOUT_STATUS_REQUEST
  155 ++ }
  156 ++}
  157 ++
  158 ++export function fetchLogoutStatusSuccess(obj) {
  159 ++ return{
  160 ++ type: FETCH_LOGOUT_STATUS_SUCCESS,
  161 ++ payload: obj
  162 ++ }
  163 ++}
  164 ++
  165 ++export function fetchLogoutStatusFailure(message) {
  166 ++ return{
  167 ++ type: FETCH_LOGOUT_STATUS_FAILURE,
  168 ++ payload: message
  169 + }
  170 + }
  171 +
  172 +@@ -50,14 +65,14 @@ export function confirmLogoutAction() {
  173 + export function checkUserLogedIn() {
  174 + return (dispatch, getState) => {
  175 + let {app} = getState();
  176 +-
  177 ++ dispatch(fetchLogoutStatusRequest());
  178 + let fetchLogoutState = (uid) => {
  179 + return new UserLogoutService(app.host).fetchLogoutState(uid)
  180 + .then(json => {
  181 +- dispatch(updateLogoutStatus(json.status));
  182 ++ dispatch(fetchLogoutStatusSuccess({state:json.status, descList:json.desc}));
  183 + })
  184 + .catch(error => {
  185 +- console.log(error);
  186 ++ dispatch(fetchLogoutStatusFailure(error.message?error.message:'网络错误'));
  187 + });
  188 + }
  189 +
  190 +diff --git a/js/userLogout/reducers/userLogout/userLogoutInitialState.js b/js/userLogout/reducers/userLogout/userLogoutInitialState.js
  191 +index 2cfd563..7c29171 100755
  192 +--- a/js/userLogout/reducers/userLogout/userLogoutInitialState.js
  193 ++++ b/js/userLogout/reducers/userLogout/userLogoutInitialState.js
  194 +@@ -9,9 +9,11 @@
  195 + import {Record, List, Map} from 'immutable';
  196 +
  197 + let InitialState = Record({
  198 +- isFetching: false,
  199 ++ isFetching: true,
  200 + showConfirmLogoutModal: false,
  201 + logoutStatus: 0,
  202 ++ tipMessage: '',
  203 ++ cancleFialdDesc: List(),
  204 + });
  205 +
  206 + export default InitialState;
  207 +diff --git a/js/userLogout/reducers/userLogout/userLogoutReducer.js b/js/userLogout/reducers/userLogout/userLogoutReducer.js
  208 +index db68fd4..d82c037 100644
  209 +--- a/js/userLogout/reducers/userLogout/userLogoutReducer.js
  210 ++++ b/js/userLogout/reducers/userLogout/userLogoutReducer.js
  211 +@@ -4,14 +4,18 @@
  212 + * @date: 2018/04/13
  213 + */
  214 +
  215 ++
  216 + 'use strict';
  217 +
  218 + import InitialState from './userLogoutInitialState';
  219 + import Immutable, {Map} from 'immutable';
  220 ++import {fetchLogoutStatusFailure, fetchLogoutStatusRequest} from "./userLogoutActions";
  221 +
  222 + const {
  223 + UPDATE_LOGOUT_MODAL_STATE,
  224 +- UPDATE_LOGOUT_STATUS
  225 ++ FETCH_LOGOUT_STATUS_REQUEST,
  226 ++ FETCH_LOGOUT_STATUS_SUCCESS,
  227 ++ FETCH_LOGOUT_STATUS_FAILURE,
  228 + } = require('../../constants/actionTypes').default;
  229 +
  230 + const initialState = new InitialState;
  231 +@@ -21,8 +25,17 @@ export default function userLogoutReducer(state=initialState, action) {
  232 + case UPDATE_LOGOUT_MODAL_STATE:{
  233 + return state.set('showConfirmLogoutModal',action.payload);
  234 + }
  235 +- case UPDATE_LOGOUT_STATUS: {
  236 +- return state.set('logoutStatus',action.payload);
  237 ++ case fetchLogoutStatusRequest:{
  238 ++ return state.set('isFetching', true);
  239 ++ }
  240 ++ case FETCH_LOGOUT_STATUS_SUCCESS:{
  241 ++ return state.set('logoutStatus',action.payload.state)
  242 ++ .set('cancleFialdDesc', Immutable.fromJS(action.payload.descList))
  243 ++ .set('isFetching', false);
  244 ++ }
  245 ++ case fetchLogoutStatusFailure:{
  246 ++ return state.set('isFetching', false)
  247 ++ .set('tipMessage', action.payload);
  248 + }
  249 +
  250 + }
  251 +--
  252 +2.10.1
  253 +