Showing
10 changed files
with
118 additions
and
32 deletions
@@ -10,9 +10,9 @@ import React, {Component} from 'react'; | @@ -10,9 +10,9 @@ import React, {Component} from 'react'; | ||
10 | import ReactNative, { | 10 | import ReactNative, { |
11 | View, | 11 | View, |
12 | StyleSheet, | 12 | StyleSheet, |
13 | - Image, | 13 | + ScrollView, |
14 | Text, | 14 | Text, |
15 | - TouchableOpacity | 15 | + Dimensions |
16 | } from 'react-native'; | 16 | } from 'react-native'; |
17 | 17 | ||
18 | 18 | ||
@@ -26,7 +26,7 @@ export default class LogoutClause extends Component { | @@ -26,7 +26,7 @@ export default class LogoutClause extends Component { | ||
26 | render() { | 26 | render() { |
27 | 27 | ||
28 | return ( | 28 | return ( |
29 | - <View style={styles.container}> | 29 | + <ScrollView style={[styles.container, {width: width, height:height}]}> |
30 | <View style={styles.titleContainer}> | 30 | <View style={styles.titleContainer}> |
31 | <Text style={styles.title}>《有货账户注销条款》</Text> | 31 | <Text style={styles.title}>《有货账户注销条款》</Text> |
32 | </View> | 32 | </View> |
@@ -53,15 +53,17 @@ export default class LogoutClause extends Component { | @@ -53,15 +53,17 @@ export default class LogoutClause extends Component { | ||
53 | 3)账户在有货商城系统中无欠款; | 53 | 3)账户在有货商城系统中无欠款; |
54 | </Text> | 54 | </Text> |
55 | </View> | 55 | </View> |
56 | - </View> | 56 | + </ScrollView> |
57 | ); | 57 | ); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | +let {width, height} = Dimensions.get('window'); | ||
61 | let styles = StyleSheet.create({ | 62 | let styles = StyleSheet.create({ |
62 | container: { | 63 | container: { |
63 | flex: 1, | 64 | flex: 1, |
64 | - backgroundColor: '#f0f0f0' | 65 | + backgroundColor: '#f0f0f0', |
66 | + overflow: 'scroll' | ||
65 | }, | 67 | }, |
66 | title: { | 68 | title: { |
67 | fontSize: 14, | 69 | fontSize: 14, |
@@ -168,10 +168,10 @@ let styles = StyleSheet.create({ | @@ -168,10 +168,10 @@ let styles = StyleSheet.create({ | ||
168 | height: 44, | 168 | height: 44, |
169 | borderRadius: 5, | 169 | borderRadius: 5, |
170 | alignItems: 'center', | 170 | alignItems: 'center', |
171 | + justifyContent: 'center' | ||
171 | }, | 172 | }, |
172 | confirmText: { | 173 | confirmText: { |
173 | textAlign: 'center', | 174 | textAlign: 'center', |
174 | - lineHeight: 43, | ||
175 | color: 'white', | 175 | color: 'white', |
176 | fontSize: 16 | 176 | fontSize: 16 |
177 | }, | 177 | }, |
@@ -12,6 +12,7 @@ export default keyMirror({ | @@ -12,6 +12,7 @@ export default keyMirror({ | ||
12 | SET_HOST: null, | 12 | SET_HOST: null, |
13 | SET_SERVICE_HOST: null, | 13 | SET_SERVICE_HOST: null, |
14 | UPDATE_LOGOUT_MODAL_STATE: null, | 14 | UPDATE_LOGOUT_MODAL_STATE: null, |
15 | + UPDATE_LOGOUT_STATUS: null, | ||
15 | 16 | ||
16 | 17 | ||
17 | //注销原因 | 18 | //注销原因 |
@@ -17,6 +17,8 @@ import {connect} from 'react-redux'; | @@ -17,6 +17,8 @@ import {connect} from 'react-redux'; | ||
17 | import {Map} from 'immutable'; | 17 | import {Map} from 'immutable'; |
18 | import * as userLogoutActions from '../reducers/userLogout/userLogoutActions'; | 18 | import * as userLogoutActions from '../reducers/userLogout/userLogoutActions'; |
19 | import UserLogout from '../components/userLogout/UserLogout'; | 19 | import UserLogout from '../components/userLogout/UserLogout'; |
20 | +import UserLogoutFaild from '../components/userLogout/UserLogoutFaild'; | ||
21 | +import UserLogoutStatus from '../components/userLogout/UserLogoutStatus'; | ||
20 | 22 | ||
21 | const actions = [ | 23 | const actions = [ |
22 | userLogoutActions, | 24 | userLogoutActions, |
@@ -47,10 +49,12 @@ class UserLogoutContainer extends Component { | @@ -47,10 +49,12 @@ class UserLogoutContainer extends Component { | ||
47 | this._onPressLogoutClause = this._onPressLogoutClause.bind(this); | 49 | this._onPressLogoutClause = this._onPressLogoutClause.bind(this); |
48 | this._confirmLogoutAction = this._confirmLogoutAction.bind(this); | 50 | this._confirmLogoutAction = this._confirmLogoutAction.bind(this); |
49 | this._updateLogoutModalState = this._updateLogoutModalState.bind(this); | 51 | this._updateLogoutModalState = this._updateLogoutModalState.bind(this); |
52 | + this._gotoLogoutFaildReason = this._gotoLogoutFaildReason.bind(this); | ||
53 | + this._gotoLogoutReason = this._gotoLogoutReason.bind(this); | ||
50 | } | 54 | } |
51 | 55 | ||
52 | componentDidMount() { | 56 | componentDidMount() { |
53 | - | 57 | + this.props.actions.checkUserLogedIn(); |
54 | } | 58 | } |
55 | 59 | ||
56 | componentWillUnmount() { | 60 | componentWillUnmount() { |
@@ -69,16 +73,39 @@ class UserLogoutContainer extends Component { | @@ -69,16 +73,39 @@ class UserLogoutContainer extends Component { | ||
69 | this.props.actions.updateLogoutModalState(flag); | 73 | this.props.actions.updateLogoutModalState(flag); |
70 | } | 74 | } |
71 | 75 | ||
76 | + _gotoLogoutFaildReason(){ | ||
77 | + this.props.actions.gotoLogoutFaildReason() | ||
78 | + } | ||
79 | + | ||
80 | + _gotoLogoutReason(){ | ||
81 | + this.props.actions.gotoLogoutReason() | ||
82 | + } | ||
83 | + | ||
72 | render() { | 84 | render() { |
73 | - let {showConfirmLogoutModal} = this.props.userLogout; | ||
74 | - return ( | ||
75 | - <UserLogout | ||
76 | - showConfirmLogoutModal = {showConfirmLogoutModal} | ||
77 | - onPressLogoutClause = {this._onPressLogoutClause} | ||
78 | - confirmLogoutAction = {this._confirmLogoutAction} | ||
79 | - updateLogoutModalState = {this._updateLogoutModalState} | ||
80 | - /> | ||
81 | - ); | 85 | + let {showConfirmLogoutModal, logoutStatus} = this.props.userLogout; |
86 | + if (logoutStatus == 0) { | ||
87 | + return ( | ||
88 | + <UserLogout | ||
89 | + showConfirmLogoutModal = {showConfirmLogoutModal} | ||
90 | + onPressLogoutClause = {this._onPressLogoutClause} | ||
91 | + confirmLogoutAction = {this._confirmLogoutAction} | ||
92 | + updateLogoutModalState = {this._updateLogoutModalState} | ||
93 | + /> | ||
94 | + ); | ||
95 | + } else if(logoutStatus == 1){ | ||
96 | + return ( | ||
97 | + <UserLogoutStatus | ||
98 | + /> | ||
99 | + ); | ||
100 | + }else if(logoutStatus == 3){ | ||
101 | + return ( | ||
102 | + <UserLogoutFaild | ||
103 | + isFaildReasonPage={false} | ||
104 | + gotoLogoutFaildReason={this._gotoLogoutFaildReason} | ||
105 | + gotoLogoutReason={this._gotoLogoutReason} | ||
106 | + /> | ||
107 | + ); | ||
108 | + } | ||
82 | } | 109 | } |
83 | } | 110 | } |
84 | 111 |
@@ -67,6 +67,9 @@ class UserLogoutReasonContainer extends Component { | @@ -67,6 +67,9 @@ class UserLogoutReasonContainer extends Component { | ||
67 | } | 67 | } |
68 | 68 | ||
69 | _showLogoutReasonModalAction(state) { | 69 | _showLogoutReasonModalAction(state) { |
70 | + if(state){ | ||
71 | + this.props.actions.generateCheckImageUrl(); | ||
72 | + } | ||
70 | this.props.actions.showLogoutReasonModal(state); | 73 | this.props.actions.showLogoutReasonModal(state); |
71 | } | 74 | } |
72 | 75 |
@@ -15,6 +15,7 @@ import UserLogoutService from '../../services/UserLogoutService'; | @@ -15,6 +15,7 @@ import UserLogoutService from '../../services/UserLogoutService'; | ||
15 | 15 | ||
16 | const { | 16 | const { |
17 | UPDATE_LOGOUT_MODAL_STATE, | 17 | UPDATE_LOGOUT_MODAL_STATE, |
18 | + UPDATE_LOGOUT_STATUS, | ||
18 | } = require('../../constants/actionTypes').default; | 19 | } = require('../../constants/actionTypes').default; |
19 | 20 | ||
20 | export function onPressLogoutClause() { | 21 | export function onPressLogoutClause() { |
@@ -31,11 +32,47 @@ export function updateLogoutModalState(flag) { | @@ -31,11 +32,47 @@ export function updateLogoutModalState(flag) { | ||
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
35 | +export function updateLogoutStatus(status) { | ||
36 | + return{ | ||
37 | + type: UPDATE_LOGOUT_STATUS, | ||
38 | + payload: status | ||
39 | + } | ||
40 | +} | ||
41 | + | ||
34 | export function confirmLogoutAction() { | 42 | export function confirmLogoutAction() { |
35 | return (dispatch, getState) => { | 43 | return (dispatch, getState) => { |
36 | dispatch(updateLogoutModalState(false)); | 44 | dispatch(updateLogoutModalState(false)); |
37 | let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.userLogout","params":{"title":"注销原因","type":"userLogouReason"}}`; | 45 | let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.userLogout","params":{"title":"注销原因","type":"userLogouReason"}}`; |
38 | - ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 46 | + NativeModules.YH_CommonHelper.jumpWithUrl(url); |
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | +export function checkUserLogedIn() { | ||
51 | + return (dispatch, getState) => { | ||
52 | + let {app} = getState(); | ||
53 | + | ||
54 | + let fetchLogoutState = (uid) => { | ||
55 | + return new UserLogoutService('http://api-test3.yohops.com:9999/').fetchLogoutState(uid) | ||
56 | + .then(json => { | ||
57 | + dispatch(updateLogoutStatus(json.status)); | ||
58 | + }) | ||
59 | + .catch(error => { | ||
60 | + console.log(error); | ||
61 | + }); | ||
62 | + } | ||
63 | + | ||
64 | + NativeModules.YH_CommonHelper.uid() | ||
65 | + .then(uid => { | ||
66 | + fetchLogoutState(uid) | ||
67 | + }) | ||
68 | + .catch(error => { | ||
69 | + NativeModules.YH_CommonHelper.login() | ||
70 | + .then(uid => { | ||
71 | + fetchLogoutState(uid) | ||
72 | + }) | ||
73 | + .catch(error => { | ||
74 | + }); | ||
75 | + }); | ||
39 | } | 76 | } |
40 | } | 77 | } |
41 | 78 |
@@ -10,7 +10,8 @@ import {Record, List, Map} from 'immutable'; | @@ -10,7 +10,8 @@ import {Record, List, Map} from 'immutable'; | ||
10 | 10 | ||
11 | let InitialState = Record({ | 11 | let InitialState = Record({ |
12 | isFetching: false, | 12 | isFetching: false, |
13 | - showConfirmLogoutModal: false | 13 | + showConfirmLogoutModal: false, |
14 | + logoutStatus: 0, | ||
14 | }); | 15 | }); |
15 | 16 | ||
16 | export default InitialState; | 17 | export default InitialState; |
@@ -11,6 +11,7 @@ import Immutable, {Map} from 'immutable'; | @@ -11,6 +11,7 @@ import Immutable, {Map} from 'immutable'; | ||
11 | 11 | ||
12 | const { | 12 | const { |
13 | UPDATE_LOGOUT_MODAL_STATE, | 13 | UPDATE_LOGOUT_MODAL_STATE, |
14 | + UPDATE_LOGOUT_STATUS | ||
14 | } = require('../../constants/actionTypes').default; | 15 | } = require('../../constants/actionTypes').default; |
15 | 16 | ||
16 | const initialState = new InitialState; | 17 | const initialState = new InitialState; |
@@ -20,6 +21,9 @@ export default function userLogoutReducer(state=initialState, action) { | @@ -20,6 +21,9 @@ export default function userLogoutReducer(state=initialState, action) { | ||
20 | case UPDATE_LOGOUT_MODAL_STATE:{ | 21 | case UPDATE_LOGOUT_MODAL_STATE:{ |
21 | return state.set('showConfirmLogoutModal',action.payload); | 22 | return state.set('showConfirmLogoutModal',action.payload); |
22 | } | 23 | } |
24 | + case UPDATE_LOGOUT_STATUS: { | ||
25 | + return state.set('logoutStatus',action.payload); | ||
26 | + } | ||
23 | 27 | ||
24 | } | 28 | } |
25 | return state; | 29 | return state; |
@@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
9 | 9 | ||
10 | import ReactNative from 'react-native'; | 10 | import ReactNative from 'react-native'; |
11 | import UserLogoutReasonService from '../../services/UserLogoutReasonService'; | 11 | import UserLogoutReasonService from '../../services/UserLogoutReasonService'; |
12 | -import message from "../../../community/reducers/message/messageReducer"; | ||
13 | 12 | ||
14 | const { | 13 | const { |
15 | ENABLE_SUBMIT_BTN, | 14 | ENABLE_SUBMIT_BTN, |
@@ -60,9 +59,6 @@ export function fetchImageCheckSwitchState() { | @@ -60,9 +59,6 @@ export function fetchImageCheckSwitchState() { | ||
60 | let udid = ReactNative.NativeModules.RNNativeConfig.udid; | 59 | let udid = ReactNative.NativeModules.RNNativeConfig.udid; |
61 | return new UserLogoutReasonService('http://api-test3.yohops.com:9999/').fetchImageCheckSwitchState(udid) | 60 | return new UserLogoutReasonService('http://api-test3.yohops.com:9999/').fetchImageCheckSwitchState(udid) |
62 | .then(json => { | 61 | .then(json => { |
63 | - if (json){ | ||
64 | - dispatch(generateCheckImageUrl()); | ||
65 | - } | ||
66 | dispatch(setImageCheckSwitchState(json)); | 62 | dispatch(setImageCheckSwitchState(json)); |
67 | }) | 63 | }) |
68 | .catch(error => { | 64 | .catch(error => { |
@@ -78,7 +74,7 @@ export function fetchCanleCode(mobile, degrees) { | @@ -78,7 +74,7 @@ export function fetchCanleCode(mobile, degrees) { | ||
78 | return new UserLogoutReasonService('http://api-test3.yohops.com:9999/').fetchCancleCode(mobile, degrees, udid) | 74 | return new UserLogoutReasonService('http://api-test3.yohops.com:9999/').fetchCancleCode(mobile, degrees, udid) |
79 | .then(json => { | 75 | .then(json => { |
80 | dispatch(fetchImageCheckSwitchState()); | 76 | dispatch(fetchImageCheckSwitchState()); |
81 | - console.log(json); | 77 | + dispatch(updateTipMessage('验证短信已发送,请注意查收')); |
82 | }) | 78 | }) |
83 | .catch(error => { | 79 | .catch(error => { |
84 | if(error.message != '') { | 80 | if(error.message != '') { |
@@ -96,7 +92,6 @@ export function confirmLogout(code, reason) { | @@ -96,7 +92,6 @@ export function confirmLogout(code, reason) { | ||
96 | .then(json => { | 92 | .then(json => { |
97 | dispatch(showLogoutReasonModal(false)); | 93 | dispatch(showLogoutReasonModal(false)); |
98 | dispatch(gotoLogoutStatus()); | 94 | dispatch(gotoLogoutStatus()); |
99 | - | ||
100 | }) | 95 | }) |
101 | .catch(error => { | 96 | .catch(error => { |
102 | if(error.message != '') { | 97 | if(error.message != '') { |
@@ -111,7 +106,7 @@ export function generateCheckImageUrl() { | @@ -111,7 +106,7 @@ export function generateCheckImageUrl() { | ||
111 | let {app} = getState(); | 106 | let {app} = getState(); |
112 | let udid = ReactNative.NativeModules.RNNativeConfig.udid; | 107 | let udid = ReactNative.NativeModules.RNNativeConfig.udid; |
113 | var timeStamp = Date.parse(new Date()); | 108 | var timeStamp = Date.parse(new Date()); |
114 | - let imageUrl = 'http://api-test3.yohops.com:9999/' + '/passport/img-check' + '?business_line=yohobuy' + '&udid=' + udid + '&fromPage=' + 'UserLogoutReason' + '&timeStamp=' + timeStamp; | 109 | + let imageUrl = 'http://api-test3.yohops.com:9999' + '/passport/img-check' + '?business_line=yohobuy' + '&udid=' + udid + '&fromPage=' + 'UserLogoutReason' + '&timeStamp=' + timeStamp; |
115 | dispatch(imgeCheckCodeUrl(imageUrl)); | 110 | dispatch(imgeCheckCodeUrl(imageUrl)); |
116 | } | 111 | } |
117 | } | 112 | } |
@@ -11,11 +11,27 @@ import Request from '../../common/services/NativeRequest'; | @@ -11,11 +11,27 @@ import Request from '../../common/services/NativeRequest'; | ||
11 | 11 | ||
12 | export default class UserLogoutService { | 12 | export default class UserLogoutService { |
13 | 13 | ||
14 | - constructor (host) { | ||
15 | - let baseURL = 'http://api.yoho.cn'; | ||
16 | - if(host){ | ||
17 | - baseURL = host; | ||
18 | - } | ||
19 | - this.api = new Request(baseURL); | ||
20 | - } | 14 | + constructor (host) { |
15 | + let baseURL = 'http://api.yoho.cn'; | ||
16 | + if(host){ | ||
17 | + baseURL = host; | ||
18 | + } | ||
19 | + this.api = new Request(baseURL); | ||
20 | + } | ||
21 | + | ||
22 | + async fetchLogoutState(uid) { | ||
23 | + return await this.api.get({ | ||
24 | + url: '', | ||
25 | + body: { | ||
26 | + method: 'app.cancel.status', | ||
27 | + uid, | ||
28 | + } | ||
29 | + }) | ||
30 | + .then((json) => { | ||
31 | + return json; | ||
32 | + }) | ||
33 | + .catch((error) => { | ||
34 | + throw(error); | ||
35 | + }); | ||
36 | + } | ||
21 | } | 37 | } |
-
Please register or login to post a comment