Authored by 张丽霞

会员等级内部跳转,review by 盖剑秋

... ... @@ -26,6 +26,7 @@ export default class VIPLevel extends Component {
this.renderSeparator = this.renderSeparator.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
});
}
... ... @@ -69,7 +70,7 @@ export default class VIPLevel extends Component {
return null;
}
return(
<View style={styles.sectionHeader}>
<View key={'sectionHeader' + sectionID} style={styles.sectionHeader}>
<Text style={{lineHeight:38,fontSize:17,color:'#444444',height:58}}>
当前可享受的特权
</Text>
... ... @@ -81,15 +82,17 @@ export default class VIPLevel extends Component {
renderRow(rowData,sectionID,rowID) {
return(
<VIPPrivilegeCell
key={'row' + rowID}
dataSource={rowData}
onPressPrivilegeCell={this.props.onPressPrivilegeCell}
rowID={rowID}
/>
);
}
renderSeparator(sectionID, rowID, adjacentRowHighlighted) {
return(
<View style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/>
<View key={'separator' + rowID} style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/>
);
}
... ... @@ -110,6 +113,7 @@ export default class VIPLevel extends Component {
renderHeader={this.renderHeader}
renderSectionHeader={this.renderSectionHeader}
renderSeparator={this.renderSeparator}
showsVerticalScrollIndicator={false}
/>
</View>
);
... ...
... ... @@ -82,7 +82,7 @@ export default class VIPLevelHeader extends Component {
{VIPLevel == '3'?null:
<View style={styles.nextLevelCost}>
<Text style={{color:'#b0b0b0',fontSize:13}}>
¥0.00{vipInfo.next_need_cost}
¥{vipInfo.next_need_cost}
</Text>
</View>
... ...
... ... @@ -20,10 +20,10 @@ export default class VIPPrivilegeCell extends Component {
}
render() {
let {dataSource} = this.props;
let {dataSource,rowID} = this.props;
return (
<TouchableOpacity activeOpacity={1.0} onPress={() => {
this.props.onPressPrivilegeCell && this.props.onPressPrivilegeCell(dataSource);
this.props.onPressPrivilegeCell && this.props.onPressPrivilegeCell(dataSource,rowID);
}}>
<View style={styles.container}>
<YH_Image url={dataSource.get('pic')} style={styles.image} />
... ...
... ... @@ -45,6 +45,16 @@ function mapDispatchToProps(dispatch) {
class VIPLevelContainer extends Component {
constructor(props) {
super(props);
this._onPressPrivilegeCell = this._onPressPrivilegeCell.bind(this);
this._onPressAllVIPPrivilegeCell = this._onPressAllVIPPrivilegeCell.bind(this);
}
_onPressPrivilegeCell(cellInfo,rowID) {
this.props.actions.onPressPrivilegeCell(cellInfo,rowID);
}
_onPressAllVIPPrivilegeCell() {
this.props.actions.onPressAllVIPPrivilegeCell();
}
componentDidMount() {
... ... @@ -61,6 +71,8 @@ class VIPLevelContainer extends Component {
isFetching={isFetching}
vipInfo={vipInfo}
vipShowPageInfo={vipShowPageInfo}
onPressPrivilegeCell={this._onPressPrivilegeCell}
onPressAllVIPPrivilegeCell={this._onPressAllVIPPrivilegeCell}
/>
</View>
);
... ...
... ... @@ -94,3 +94,19 @@ function processVIPInfo(json) {
}
return({upgradeNeedCost,vipNextLevelProgress})
}
export function onPressPrivilegeCell(cellInfo,rowID) {
return(dispatch, getState) => {
let {app, vipLevel} = getState();
let {vipInfo} =vipLevel;
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoVIPPrivilegeDetailPage({'id':cellInfo.get('id'),'current_vip_level':vipInfo.get('current_vip_level'),'title':cellInfo.get('title'),'rowID':rowID});
}
}
export function onPressAllVIPPrivilegeCell() {
return(dispatch, getState) => {
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoAllVIPPrivilegePage();
}
}
... ...