Authored by chenl

增加有货分期银行卡图片和一些跳转规则。review by 草莓。

Showing 44 changed files with 266 additions and 2 deletions
... ... @@ -27,6 +27,9 @@ import InstallmentStatusContainer from './containers/InstallmentStatusContainer'
import RepayListContainer from './containers/RepayListContainer';
import RepayDetailContainer from './containers/RepayDetailContainer';
import RepayRecordListContainer from './containers/RepayRecordListContainer';
import InstallmentAccountContainer from './containers/InstallmentAccountContainer';
import InstallmentMyCardContainer from './containers/InstallmentMyCardContainer';
import {
setPlatform,
... ... @@ -114,8 +117,25 @@ export default function native(platform) {
<RepayRecordListContainer />
</Provider>
)
} else if (type == 'installAccount') {
return (
<Provider store={store}>
<InstallmentAccountContainer />
</Provider>
)
} else if (type == 'installMyCard') {
return (
<Provider store={store}>
<InstallmentMyCardContainer />
</Provider>
)
} else if (type == 'installMyCardDetail') {
return (
<Provider store={store}>
<InstallmentMyCardContainer />
</Provider>
)
}
}
});
... ...
'use strict';
import React, {Component} from 'react';
import ReactNative, {
View,
Text,
Image,
TouchableOpacity,
StyleSheet,
Dimensions,
} from 'react-native';
export default class AccountPageLineCell extends Component{
constructor(props) {
super(props);
}
render() {
let {title} = this.props;
return (
<TouchableOpacity
activeOpacity={1}
style={styles.container}
onPress={() => {this.props.onPress && this.props.onPress()}}>
<View style={styles.cellContainer}>
<Text style={styles.title}>{title}</Text>
<Image style={styles.arrow} source={require("../../image/arrow_gray.png")}/>
</View>
</TouchableOpacity>
);
}
};
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let styles = StyleSheet.create({
container: {
flex: 1,
},
cellContainer: {
width: width,
height: 50 * DEVICE_WIDTH_RATIO,
backgroundColor: '#ffffff',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
title:{
fontSize: 16,
color: '#444444',
textAlign: 'left',
fontWeight: 'bold',
flex: 1,
paddingLeft: 15 * DEVICE_WIDTH_RATIO,
},
arrow:{
width: 7 * DEVICE_WIDTH_RATIO,
height: 12 * DEVICE_WIDTH_RATIO,
justifyContent: 'center',
alignItems: 'center',
marginRight: 15 * DEVICE_WIDTH_RATIO,
},
});
... ...
'use strict'
import React, {Component} from 'react';
import {
StyleSheet,
Dimensions,
Platform,
View,
NativeModules,
InteractionManager,
NativeAppEventEmitter,
Text,
} from 'react-native'
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Map} from 'immutable';
import * as installmentActions from '../reducers/installment/installmentActions';
import AccountPageLineCell from '../components/installment/AccountPageLineCell';
import ServerError from '../components/installment/ServerError';
const actions = [
installmentActions,
];
function mapStateToProps(state) {
return {
...state
};
}
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class InstallmentAccountContainer extends Component {
constructor(props) {
super(props);
this._onPressMyCard = this._onPressMyCard.bind(this);
}
componentDidMount() {
}
_onPressMyCard() {
this.props.actions.gotoMyCards();
}
render() {
let {installmentStausPageInfo} = this.props.installment;
return (
<AccountPageLineCell
title={"我的银行卡"}
onPress={this._onPressMyCard}
/>
);
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default connect(mapStateToProps, mapDispatchToProps)(InstallmentAccountContainer);
... ...
'use strict'
import React, {Component} from 'react';
import {
StyleSheet,
Dimensions,
Platform,
View,
NativeModules,
InteractionManager,
NativeAppEventEmitter,
Text,
} from 'react-native'
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Map} from 'immutable';
import * as installmentActions from '../reducers/installment/installmentActions';
import InstallmentStatus from '../components/installment/InstallmentStatus';
import ServerError from '../components/installment/ServerError';
const actions = [
installmentActions,
];
function mapStateToProps(state) {
return {
...state
};
}
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class InstallmentMyCardContainer extends Component {
constructor(props) {
super(props);
this._onPressStatusPageBtn = this._onPressStatusPageBtn.bind(this);
this._reloadPage = this._reloadPage.bind(this);
}
componentDidMount() {
}
_reloadPage() {
let {installmentStausPageInfo} = this.props.installment;
let {originalParams} = installmentStausPageInfo;
this.props.actions.setError(null);
this.props.actions.setInstallmentStausPageParams(originalParams.statusCode, originalParams.failReason, originalParams.uid);
}
_onPressStatusPageBtn() {
this.props.actions.onPressStatusPageBtn();
}
render() {
let {installmentStausPageInfo,error} = this.props.installment;
if (error) {
return (
<ServerError
reloadPage={this._reloadPage}
/>
);
}
return (
<InstallmentStatus
installmentStausPageInfo={installmentStausPageInfo}
onPressStatusPageBtn={this._onPressStatusPageBtn}
/>
);
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default connect(mapStateToProps, mapDispatchToProps)(InstallmentMyCardContainer);
... ...
... ... @@ -233,7 +233,6 @@ export function productListForInstallment() {
export function onPressOpenInstallment() {
return (dispatch, getState) => {
// ReactNative.NativeModules.YH_InstallmentHelper.goToOpenInstallment();
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentOpen","params":{}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
... ... @@ -551,3 +550,10 @@ export function gotoRepayRecordList() {
ReactNative.NativeModules.YH_InstallmentHelper.gotoRepayRecordListPage();
};
}
export function gotoMyCards() {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentMyCard","params":{}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
... ...