Authored by chenl

修改了快速送达接口,增加了无数据时依旧显示头部的判断。review by 庄佳佳。

@@ -51,11 +51,20 @@ export default class HotCategoryList extends Component{ @@ -51,11 +51,20 @@ export default class HotCategoryList extends Component{
51 return null; 51 return null;
52 } 52 }
53 53
54 - let imageUrl = SlicedImage.getSlicedUrl(rowData.get("default_images"), 98, 128, 2); 54 + let imageUrl = rowData.get("default_images");
  55 + let hasImage;
  56 + if(imageUrl){
  57 + imageUrl = SlicedImage.getSlicedUrl(rowData.get("default_images"), 98, 128, 2);
  58 + hasImage = true;
  59 + }
  60 + else
  61 + hasImage = false;
  62 +
55 return ( 63 return (
56 <TouchableOpacity onPress={() => this.props.onPressHotCategoryItem && this.props.onPressHotCategoryItem(rowData.toJS(),rowID)}> 64 <TouchableOpacity onPress={() => this.props.onPressHotCategoryItem && this.props.onPressHotCategoryItem(rowData.toJS(),rowID)}>
57 <View style={styles.rowContainer}> 65 <View style={styles.rowContainer}>
58 - <Image style={styles.rowThumbnail} key={imageUrl} source={{uri: imageUrl}}/> 66 + {hasImage ? <Image style={styles.rowThumbnail} key={imageUrl} source={{uri:imageUrl}}/>
  67 + : <View style={styles.rowDefaultImageContainer}><Image style={styles.rowDefaultImage} source={require('../../images/yoho_icon.png')}/></View>}
59 <View style={styles.rowTextContainer}><Text style={styles.rowText} numberOfLines={2}>{rowData.get("category_name")}</Text></View> 68 <View style={styles.rowTextContainer}><Text style={styles.rowText} numberOfLines={2}>{rowData.get("category_name")}</Text></View>
60 </View> 69 </View>
61 </TouchableOpacity> 70 </TouchableOpacity>
@@ -158,6 +167,18 @@ let styles = StyleSheet.create({ @@ -158,6 +167,18 @@ let styles = StyleSheet.create({
158 height: 65 * DEVICE_WIDTH_RATIO, 167 height: 65 * DEVICE_WIDTH_RATIO,
159 }, 168 },
160 169
  170 + rowDefaultImageContainer:{
  171 + width: 48 * DEVICE_WIDTH_RATIO,
  172 + height: 65 * DEVICE_WIDTH_RATIO,
  173 + justifyContent: 'center',
  174 + alignItems: 'center',
  175 + },
  176 +
  177 + rowDefaultImage:{
  178 + width: 48 * DEVICE_WIDTH_RATIO,
  179 + height: 28 * DEVICE_WIDTH_RATIO,
  180 + },
  181 +
161 rowTextContainer:{ 182 rowTextContainer:{
162 width: 53 * DEVICE_WIDTH_RATIO, 183 width: 53 * DEVICE_WIDTH_RATIO,
163 height: 28 * DEVICE_WIDTH_RATIO, 184 height: 28 * DEVICE_WIDTH_RATIO,
@@ -32,6 +32,10 @@ export default class Birth extends Component { @@ -32,6 +32,10 @@ export default class Birth extends Component {
32 32
33 33
34 renderHeader(){ 34 renderHeader(){
  35 +
  36 + let {data} = this.props;
  37 + let showProductTitle = (!data || data.toArray().length == 0) ? false : true;
  38 +
35 return( 39 return(
36 <View style={styles.birthdayTipContainer}> 40 <View style={styles.birthdayTipContainer}>
37 <Text style={styles.tipText}>生日特惠:除了在生日当月月初收到来自我们的真诚祝福,还将收到每年一次的”特殊优惠券”作为生日礼物。</Text> 41 <Text style={styles.tipText}>生日特惠:除了在生日当月月初收到来自我们的真诚祝福,还将收到每年一次的”特殊优惠券”作为生日礼物。</Text>
@@ -40,7 +44,8 @@ export default class Birth extends Component { @@ -40,7 +44,8 @@ export default class Birth extends Component {
40 this.props.onPressComplete && this.props.onPressComplete();}}> 44 this.props.onPressComplete && this.props.onPressComplete();}}>
41 <Text style={styles.completeButton}>完善生日信息</Text> 45 <Text style={styles.completeButton}>完善生日信息</Text>
42 </TouchableOpacity> 46 </TouchableOpacity>
43 - <HeadTitleCell title={"新品推荐"} /> 47 +
  48 + { showProductTitle ? <HeadTitleCell title={"新品推荐"} /> : null}
44 </View> 49 </View>
45 ); 50 );
46 } 51 }
@@ -69,10 +74,6 @@ export default class Birth extends Component { @@ -69,10 +74,6 @@ export default class Birth extends Component {
69 74
70 let {isFetching, data} = this.props; 75 let {isFetching, data} = this.props;
71 76
72 - if(!data || data.toArray().length == 0){  
73 - return null;  
74 - }  
75 -  
76 return ( 77 return (
77 <View style={styles.container}> 78 <View style={styles.container}>
78 <ListView 79 <ListView
@@ -106,7 +107,7 @@ let productHeight = Platform.OS === 'ios'? (rowHeight + rowMarginTop + rowMargin @@ -106,7 +107,7 @@ let productHeight = Platform.OS === 'ios'? (rowHeight + rowMarginTop + rowMargin
106 let styles = StyleSheet.create({ 107 let styles = StyleSheet.create({
107 container: { 108 container: {
108 flex: 1, 109 flex: 1,
109 - backgroundColor: '#f0f0f0', 110 + backgroundColor: 'white',
110 }, 111 },
111 112
112 contentContainer: { 113 contentContainer: {
@@ -26,13 +26,13 @@ export default class FastExpress extends Component { @@ -26,13 +26,13 @@ export default class FastExpress extends Component {
26 this.dataSource = new ListView.DataSource({rowHasChanged: (r1, r2) => !immutable.is(r1, r2)}); 26 this.dataSource = new ListView.DataSource({rowHasChanged: (r1, r2) => !immutable.is(r1, r2)});
27 this.renderHeader = this.renderHeader.bind(this); 27 this.renderHeader = this.renderHeader.bind(this);
28 this.renderRow = this.renderRow.bind(this); 28 this.renderRow = this.renderRow.bind(this);
29 -  
30 } 29 }
31 30
32 31
33 renderHeader(){ 32 renderHeader(){
34 33
35 let {data, fastExpressList} = this.props; 34 let {data, fastExpressList} = this.props;
  35 + let showProductTitle = (!data || data.toArray().length == 0) ? false : true;
36 36
37 let desc1 = "白金会员可享受快速送达服务。订单将采用最快速度进行配送(比如航空快件),保证您可以尽快获得心仪的商品。"; 37 let desc1 = "白金会员可享受快速送达服务。订单将采用最快速度进行配送(比如航空快件),保证您可以尽快获得心仪的商品。";
38 let desc2 = "※ 如果您的收件区域位于可提供快速送达服务的快递范围外或订单内的商品包含航空禁运品,我们仍将统一采用可送达快递进行配送,敬请谅解。"; 38 let desc2 = "※ 如果您的收件区域位于可提供快速送达服务的快递范围外或订单内的商品包含航空禁运品,我们仍将统一采用可送达快递进行配送,敬请谅解。";
@@ -64,8 +64,7 @@ export default class FastExpress extends Component { @@ -64,8 +64,7 @@ export default class FastExpress extends Component {
64 <Text style={styles.headerDescription1}>{desc1}</Text> 64 <Text style={styles.headerDescription1}>{desc1}</Text>
65 <Text style={styles.headerDescription2}>{desc2}</Text> 65 <Text style={styles.headerDescription2}>{desc2}</Text>
66 66
67 -  
68 - <HeadTitleCell title={"新品推荐"} /> 67 + { showProductTitle ? <HeadTitleCell title={"新品推荐"} /> : null}
69 </View> 68 </View>
70 69
71 ); 70 );
@@ -95,10 +94,6 @@ export default class FastExpress extends Component { @@ -95,10 +94,6 @@ export default class FastExpress extends Component {
95 94
96 let {isFetching, data} = this.props; 95 let {isFetching, data} = this.props;
97 96
98 - if(!data || data.toArray().length == 0){  
99 - return null;  
100 - }  
101 -  
102 return ( 97 return (
103 <View style={styles.container}> 98 <View style={styles.container}>
104 <ListView 99 <ListView
@@ -35,7 +35,7 @@ export function getFastExpressInfo() { @@ -35,7 +35,7 @@ export function getFastExpressInfo() {
35 return (dispatch, getState) => { 35 return (dispatch, getState) => {
36 let {app, fastExpress} = getState(); 36 let {app, fastExpress} = getState();
37 37
38 - return new FastExpressService(app.host).getFastExpressInfo() 38 + return new FastExpressService(app.serviceHost).getFastExpressInfo()
39 .then(json => { 39 .then(json => {
40 dispatch(getFastExpressInfoSuccess(json)); 40 dispatch(getFastExpressInfoSuccess(json));
41 }) 41 })
@@ -14,7 +14,7 @@ export default class fastExpressService { @@ -14,7 +14,7 @@ export default class fastExpressService {
14 14
15 async getFastExpressInfo(){ 15 async getFastExpressInfo(){
16 return await this.api.get({ 16 return await this.api.get({
17 - url: '', 17 + url: '/gateway/',
18 body: { 18 body: {
19 method: 'app.vipgrade.fastexpress', 19 method: 'app.vipgrade.fastexpress',
20 } 20 }