Authored by chenl

调整了新增银行卡的跳转。review by 张丽霞。

... ... @@ -8,7 +8,7 @@ import {
View,
NativeModules,
InteractionManager,
NativeAppEventEmitter,
DeviceEventEmitter,
Text,
ListView,
TouchableOpacity,
... ... @@ -48,6 +48,13 @@ class InstallmentMyCardContainer extends Component {
super(props);
this.onPressCard = this.onPressCard.bind(this);
this._reloadPage = this._reloadPage.bind(this);
this.subscription = DeviceEventEmitter.addListener(
'BankCardChangeEvent',
() => {
this._reloadPage();
}
);
}
_reloadPage() {
... ... @@ -58,6 +65,10 @@ class InstallmentMyCardContainer extends Component {
this.props.actions.getBankCards();
}
componentWillUnmount(){
this.subscription && this.subscription.remove();
}
onPressCard(cardIdNo){
this.props.actions.goMyCardDetail(cardIdNo);
}
... ...
... ... @@ -9,6 +9,7 @@ import {
NativeModules,
InteractionManager,
NativeAppEventEmitter,
DeviceEventEmitter,
Text,
ListView,
TouchableOpacity,
... ... @@ -60,6 +61,13 @@ class InstallmentMyOrderDetailContainer extends Component {
this._reSendConfirmPaySnsCode = this._reSendConfirmPaySnsCode.bind(this);
this._confirmPayAction = this._confirmPayAction.bind(this);
this._clearTipMessage = this._clearTipMessage.bind(this);
this.subscription = DeviceEventEmitter.addListener(
'BankCardChangeEvent',
() => {
this.props.actions.getBankCards && this.props.actions.getBankCards();
}
);
}
_reloadPage() {
... ... @@ -125,6 +133,10 @@ class InstallmentMyOrderDetailContainer extends Component {
this.props.actions.getOrderDetail();
}
componentWillUnmount(){
this.subscription && this.subscription.remove();
}
render() {
let {error} = this.props.myOrderDetail;
... ...
... ... @@ -9,6 +9,7 @@ import {
NativeModules,
InteractionManager,
NativeAppEventEmitter,
DeviceEventEmitter,
Text,
} from 'react-native'
... ... @@ -58,6 +59,13 @@ class RepayListContainer extends Component {
this._reSendConfirmPaySnsCode = this._reSendConfirmPaySnsCode.bind(this);
this._confirmPayAction = this._confirmPayAction.bind(this);
this._reloadPage = this._reloadPage.bind(this);
this.subscription = DeviceEventEmitter.addListener(
'BankCardChangeEvent',
() => {
this.props.actions.getBankCards && this.props.actions.getBankCards();
}
);
}
componentDidMount() {
let {repayList} = this.props;
... ... @@ -65,6 +73,10 @@ class RepayListContainer extends Component {
this.props.actions.getQueryAmtList(queryDays);
}
componentWillUnmount(){
this.subscription && this.subscription.remove();
}
_reloadPage() {
let {repayList} = this.props;
let {queryDays} = repayList;
... ...
... ... @@ -2,6 +2,7 @@
import ReactNative from 'react-native';
import InstallmentService from '../../services/InstallmentService';
import {DeviceEventEmitter} from 'react-native';
const {
... ... @@ -181,8 +182,8 @@ export function showResultInfo(result) {
export function backToMyCardList() {
return (dispatch, getState) => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentMyCard","params":{}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
ReactNative.NativeModules.YH_CommonHelper.goBack();
DeviceEventEmitter.emit('BankCardChangeEvent');
}
}
... ...
'use strict';
import ReactNative from 'react-native';
import {DeviceEventEmitter} from 'react-native';
import InstallmentService from '../../services/InstallmentService';
const {
... ... @@ -141,8 +142,8 @@ export function unbindCardSuccess(){
export function backToMyCardList() {
return (dispatch, getState) => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentMyCard","params":{}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
ReactNative.NativeModules.YH_CommonHelper.goBack();
DeviceEventEmitter.emit('BankCardChangeEvent');
}
}
... ... @@ -154,11 +155,10 @@ export function toggleBankCard(cardIdNo) {
let toggleCard = (uid) => {
return new InstallmentService(app.host).toggleCard(uid, cardIdNo)
.then(json => {
DeviceEventEmitter.emit('BankCardChangeEvent');
dispatch(toggleCardSuccess());
})
.catch(error => {
dispatch(toggleCardSuccess());
dispatch(setTipMessage(error.message || '暂未获取到数据'));
});
};
... ...