...
|
...
|
@@ -20,13 +20,14 @@ export default class BankCardListCell extends React.Component { |
|
|
let{cardNo, cardBank} = this.props;
|
|
|
|
|
|
let bankImg = this.getBankImage(cardBank);
|
|
|
let newCardNo = this.processBankCardNo(cardNo);
|
|
|
|
|
|
return(
|
|
|
<TouchableOpacity activeOpacity={1} onPress={() => this.props.onPressCard && this.props.onPressCard()}>
|
|
|
<View style={styles.container} >
|
|
|
<Image style={styles.cardBg} source={bankImg} />
|
|
|
<Text style={styles.cardNo} numberOfLines={1}>
|
|
|
{cardNo}
|
|
|
{newCardNo}
|
|
|
</Text>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
...
|
...
|
@@ -34,17 +35,55 @@ export default class BankCardListCell extends React.Component { |
|
|
}
|
|
|
|
|
|
|
|
|
//正则替换卡号,保留后4位
|
|
|
processBankCardNo(cardNo){
|
|
|
|
|
|
let newCardNo = cardNo.replace(/(\d+)(\d{4})$/, (a, b, c)=> {
|
|
|
return b.replace(/\d/g, '*') + c;
|
|
|
});
|
|
|
|
|
|
return newCardNo;
|
|
|
}
|
|
|
|
|
|
|
|
|
getBankImage(bank){
|
|
|
let bankImg;
|
|
|
switch(bank){
|
|
|
case "ABC":
|
|
|
bankImg = require('../../image/bank/bank-ABC.png');
|
|
|
break;
|
|
|
case "BOC":
|
|
|
bankImg = require('../../image/bank/bank-BOC.png');
|
|
|
break;
|
|
|
case "CCB":
|
|
|
bankImg = require('../../image/bank/bank-CCB.png');
|
|
|
break;
|
|
|
case "CEB":
|
|
|
bankImg = require('../../image/bank/bank-CEB.png');
|
|
|
break;
|
|
|
case "CGB":
|
|
|
bankImg = require('../../image/bank/bank-CGB.png');
|
|
|
break;
|
|
|
case "CIB":
|
|
|
bankImg = require('../../image/bank/bank-CIB.png');
|
|
|
break;
|
|
|
case "CITIC":
|
|
|
bankImg = require('../../image/bank/bank-CITIC.png');
|
|
|
break;
|
|
|
case "CMBC":
|
|
|
bankImg = require('../../image/bank/bank-CMBC.png');
|
|
|
break;
|
|
|
case "ICBC":
|
|
|
bankImg = require('../../image/bank/bank-ICBC.png');
|
|
|
break;
|
|
|
case "PAYH":
|
|
|
bankImg = require('../../image/bank/bank-PAYH.png');
|
|
|
break;
|
|
|
case "PSBC":
|
|
|
bankImg = require('../../image/bank/bank-PSBC.png');
|
|
|
break;
|
|
|
default:
|
|
|
bankImg = require('../../image/bank/bank-ICBC.png');
|
|
|
bankImg = require('../../image/bank/bank-EMPTY.png');
|
|
|
break;
|
|
|
}
|
|
|
return bankImg;
|
...
|
...
|
|