修改有货有赞首页及其他bug -- reviewed by 孙凯
Showing
8 changed files
with
15 additions
and
11 deletions
@@ -36,7 +36,7 @@ export default class Home extends Component { | @@ -36,7 +36,7 @@ export default class Home extends Component { | ||
36 | _renderRow(rowData, sectionID, rowID) { | 36 | _renderRow(rowData, sectionID, rowID) { |
37 | let paddingLeft = rowID % 2 === 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal; | 37 | let paddingLeft = rowID % 2 === 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal; |
38 | let customStyle = rowID === 0 || rowID === 1 ? {paddingLeft} : {paddingLeft}; | 38 | let customStyle = rowID === 0 || rowID === 1 ? {paddingLeft} : {paddingLeft}; |
39 | - let sliderHeight = 111 * DEVICE_WIDTH_RATIO; | 39 | + let sliderHeight = 90 * DEVICE_WIDTH_RATIO; |
40 | let imageUrl = YH_Image.getSlicedUrl(this.props.src, width, sliderHeight, 2); | 40 | let imageUrl = YH_Image.getSlicedUrl(this.props.src, width, sliderHeight, 2); |
41 | switch (sectionID) { | 41 | switch (sectionID) { |
42 | case 'resourceList': { | 42 | case 'resourceList': { |
@@ -138,11 +138,13 @@ export default class Home extends Component { | @@ -138,11 +138,13 @@ export default class Home extends Component { | ||
138 | ); | 138 | ); |
139 | } | 139 | } |
140 | case 'newSingleImage': { | 140 | case 'newSingleImage': { |
141 | + let imageHeight = rowData.get('data').toJS().imageHeight; | ||
141 | return ( | 142 | return ( |
142 | - <SingleImage | ||
143 | - data={rowData.get('data')} | ||
144 | - resourceJumpWithUrl={this.props.resourceJumpWithUrl} | ||
145 | - /> | 143 | + <SingleImage |
144 | + style={imageHeight> 100 ? {marginLeft: 15, marginRight: 15, width: width-30}: {}} | ||
145 | + data={rowData.get('data')} | ||
146 | + resourceJumpWithUrl={this.props.resourceJumpWithUrl} | ||
147 | + /> | ||
146 | ); | 148 | ); |
147 | } | 149 | } |
148 | case 'image_list': { | 150 | case 'image_list': { |
@@ -251,7 +253,7 @@ let styles = StyleSheet.create({ | @@ -251,7 +253,7 @@ let styles = StyleSheet.create({ | ||
251 | fontSize: 16, | 253 | fontSize: 16, |
252 | color: '#000000', | 254 | color: '#000000', |
253 | textAlign:'center', | 255 | textAlign:'center', |
254 | - marginTop:28, | 256 | + marginTop:12, |
255 | }, | 257 | }, |
256 | bannerSubTitle: { | 258 | bannerSubTitle: { |
257 | fontFamily: 'SourceHanSansCN-Bold', | 259 | fontFamily: 'SourceHanSansCN-Bold', |
@@ -36,7 +36,7 @@ export default class ImageSingle extends React.Component { | @@ -36,7 +36,7 @@ export default class ImageSingle extends React.Component { | ||
36 | if (!list || list.length === 0) { | 36 | if (!list || list.length === 0) { |
37 | return null; | 37 | return null; |
38 | } | 38 | } |
39 | - let sliderWidth = width; | 39 | + let sliderWidth = this.props.style && this.props.style.width ? this.props.style.width : width; |
40 | let ratio = data.imageWidth / width; | 40 | let ratio = data.imageWidth / width; |
41 | let sliderHeight = data.imageHeight / ratio; | 41 | let sliderHeight = data.imageHeight / ratio; |
42 | let imageUrl = YH_Image.getSlicedUrl(list[0].src, sliderWidth, sliderHeight, 2); | 42 | let imageUrl = YH_Image.getSlicedUrl(list[0].src, sliderWidth, sliderHeight, 2); |
@@ -44,7 +44,7 @@ export default class ImageSingle extends React.Component { | @@ -44,7 +44,7 @@ export default class ImageSingle extends React.Component { | ||
44 | <TouchableOpacity | 44 | <TouchableOpacity |
45 | activeOpacity={1} | 45 | activeOpacity={1} |
46 | yh_exposureData={list[0].yh_exposureData} | 46 | yh_exposureData={list[0].yh_exposureData} |
47 | - style={{width: sliderWidth, height: sliderHeight}} | 47 | + style={[{width: sliderWidth, height: sliderHeight},this.props.style]} |
48 | onPress={() => { | 48 | onPress={() => { |
49 | this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(list[0].url); | 49 | this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(list[0].url); |
50 | }} | 50 | }} |
@@ -25,6 +25,7 @@ export default class SingleImage extends React.Component { | @@ -25,6 +25,7 @@ export default class SingleImage extends React.Component { | ||
25 | render() { | 25 | render() { |
26 | return ( | 26 | return ( |
27 | <ImageSingle | 27 | <ImageSingle |
28 | + style={this.props.style} | ||
28 | resource={this.props.data} | 29 | resource={this.props.data} |
29 | resourceJumpWithUrl={this.props.resourceJumpWithUrl} | 30 | resourceJumpWithUrl={this.props.resourceJumpWithUrl} |
30 | /> | 31 | /> |
@@ -70,7 +70,7 @@ export default class Recommend extends Component { | @@ -70,7 +70,7 @@ export default class Recommend extends Component { | ||
70 | <ProductCell | 70 | <ProductCell |
71 | key={'row' + rowID} | 71 | key={'row' + rowID} |
72 | data={rowData} | 72 | data={rowData} |
73 | - onPressProduct={this.props.onPressProduct} | 73 | + onPressProduct={() => this.props.onPressProduct(rowData)} |
74 | /> | 74 | /> |
75 | ); | 75 | ); |
76 | } | 76 | } |
@@ -136,10 +136,11 @@ class HomeContainer extends Component { | @@ -136,10 +136,11 @@ class HomeContainer extends Component { | ||
136 | } | 136 | } |
137 | 137 | ||
138 | _onEndReached() { | 138 | _onEndReached() { |
139 | + | ||
139 | let { | 140 | let { |
140 | productPool, | 141 | productPool, |
141 | } = this.props.app; | 142 | } = this.props.app; |
142 | - this.props.actions.getProductList(productPool); | 143 | + productPool !=0 && this.props.actions.getProductList(productPool); |
143 | } | 144 | } |
144 | 145 | ||
145 | render() { | 146 | render() { |
@@ -70,7 +70,7 @@ class RecommendContainer extends Component { | @@ -70,7 +70,7 @@ class RecommendContainer extends Component { | ||
70 | } | 70 | } |
71 | 71 | ||
72 | onPressProduct(data) { | 72 | onPressProduct(data) { |
73 | - let productSkn = data.get('product_skn', 0); | 73 | + let productSkn = data ? data.get('product_skn', 0): null; |
74 | if (!productSkn) { | 74 | if (!productSkn) { |
75 | return; | 75 | return; |
76 | } | 76 | } |
-
Please register or login to post a comment