Authored by 于良

Merge branch '5.5.2' into 5.6.0

Conflicts:
	js/brandStore/components/brandStore/BrandStore.js
	js/brandStore/containers/BrandStoreContainer.js
	js/redPersonBrand/components/redBrand/RedBrand.js
	js/redPersonBrand/containers/RedPersonBrandContainer.js
@@ -37,19 +37,11 @@ export default class BrandStore extends Component { @@ -37,19 +37,11 @@ export default class BrandStore extends Component {
37 this.renderRow = this.renderRow.bind(this); 37 this.renderRow = this.renderRow.bind(this);
38 this._onPressProductFilter = this._onPressProductFilter.bind(this); 38 this._onPressProductFilter = this._onPressProductFilter.bind(this);
39 this._onPressStoreFilter = this._onPressStoreFilter.bind(this); 39 this._onPressStoreFilter = this._onPressStoreFilter.bind(this);
40 - this._onChangeVisibleRows = this._onChangeVisibleRows.bind(this);  
41 - this._onMomentumScrollBegin = this._onMomentumScrollBegin.bind(this);  
42 - this._onMomentumScrollEnd = this._onMomentumScrollEnd.bind(this);  
43 40
44 this.dataSource = new ListView.DataSource({ 41 this.dataSource = new ListView.DataSource({
45 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), 42 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
46 sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2), 43 sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
47 }); 44 });
48 -  
49 - this.state = {  
50 - selectedVisibleIndex: -1,  
51 - scrollEnd: false,  
52 - };  
53 } 45 }
54 46
55 componentDidUpdate() { 47 componentDidUpdate() {
@@ -271,9 +263,6 @@ export default class BrandStore extends Component { @@ -271,9 +263,6 @@ export default class BrandStore extends Component {
271 resource={rowData} 263 resource={rowData}
272 onPressProduct={this.props.onPressFloorProduct} 264 onPressProduct={this.props.onPressFloorProduct}
273 onPressMoreProducts={this.props.onPressMoreProducts} 265 onPressMoreProducts={this.props.onPressMoreProducts}
274 - similarIndex={this.props.similarIndex}  
275 - onLongPressProduct={this.props.onLongPressProduct}  
276 - onPressFindSimilar={this.props.onPressFindSimilar}  
277 /> 266 />
278 ); 267 );
279 } 268 }
@@ -284,30 +273,19 @@ export default class BrandStore extends Component { @@ -284,30 +273,19 @@ export default class BrandStore extends Component {
284 } else if (sectionID == 'storeFilter') { 273 } else if (sectionID == 'storeFilter') {
285 let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal; 274 let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
286 let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft}; 275 let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
287 - let showSimilarGuider = this.props.showSimilarGuider  
288 - && this.state.scrollEnd  
289 - && rowID == this.state.selectedVisibleIndex  
290 - && rowID != this.props.similarIndex; 276 +
291 return ( 277 return (
292 <BrandProductListCell 278 <BrandProductListCell
293 style={[styles.listContainer, customStyle]} 279 style={[styles.listContainer, customStyle]}
294 key={'row' + rowID} 280 key={'row' + rowID}
295 rowID={rowID} 281 rowID={rowID}
296 data={rowData} 282 data={rowData}
297 - similarIndex={this.props.similarIndex}  
298 onPressProduct={this.props.onPressProduct} 283 onPressProduct={this.props.onPressProduct}
299 - onLongPressProduct={this.props.onLongPressProduct}  
300 - onPressFindSimilar={this.props.onPressFindSimilar}  
301 - showSimilarGuider={showSimilarGuider}  
302 /> 284 />
303 ); 285 );
304 } else if (sectionID == 'productList') { 286 } else if (sectionID == 'productList') {
305 let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal; 287 let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
306 let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft}; 288 let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
307 - let showSimilarGuider = this.props.showSimilarGuider  
308 - && this.state.scrollEnd  
309 - && rowID == this.state.selectedVisibleIndex  
310 - && rowID != this.props.similarIndex;  
311 289
312 return ( 290 return (
313 <BrandProductListCell 291 <BrandProductListCell
@@ -316,10 +294,6 @@ export default class BrandStore extends Component { @@ -316,10 +294,6 @@ export default class BrandStore extends Component {
316 rowID={rowID} 294 rowID={rowID}
317 data={rowData} 295 data={rowData}
318 onPressProduct={this.props.onPressProductListProduct} 296 onPressProduct={this.props.onPressProductListProduct}
319 - similarIndex={this.props.similarIndex}  
320 - onLongPressProduct={this.props.onLongPressProduct}  
321 - onPressFindSimilar={this.props.onPressFindSimilar}  
322 - showSimilarGuider={showSimilarGuider}  
323 /> 297 />
324 ); 298 );
325 } 299 }
@@ -327,46 +301,6 @@ export default class BrandStore extends Component { @@ -327,46 +301,6 @@ export default class BrandStore extends Component {
327 return null; 301 return null;
328 } 302 }
329 303
330 - _onChangeVisibleRows(visibleRows, changedRows) {  
331 - if (Object.keys(visibleRows).length == 0) {  
332 - return;  
333 - }  
334 -  
335 - let selectedIndex = -1;  
336 - let sectionIDs = Object.keys(visibleRows);  
337 - let targetSection = 'storeFilter';  
338 - let targetSection2 = 'productList';  
339 - if (sectionIDs.includes(targetSection)) {  
340 - let rowIndexs = Object.keys(visibleRows[targetSection]);  
341 - if (rowIndexs.length > 0) {  
342 - selectedIndex = rowIndexs[0];  
343 - }  
344 - if (rowIndexs.length > 3) {  
345 - selectedIndex = rowIndexs[2];  
346 - }  
347 -  
348 - this.setState({selectedVisibleIndex: selectedIndex});  
349 - } else if (sectionIDs.includes(targetSection2)) {  
350 - let rowIndexs = Object.keys(visibleRows[targetSection2]);  
351 - if (rowIndexs.length > 0) {  
352 - selectedIndex = rowIndexs[0];  
353 - }  
354 - if (rowIndexs.length > 3) {  
355 - selectedIndex = rowIndexs[2];  
356 - }  
357 -  
358 - this.setState({selectedVisibleIndex: selectedIndex});  
359 - }  
360 - }  
361 -  
362 - _onMomentumScrollBegin(event) {  
363 - this.setState({scrollEnd: false});  
364 - }  
365 -  
366 - _onMomentumScrollEnd(event) {  
367 - this.setState({scrollEnd: true});  
368 - }  
369 -  
370 render() { 304 render() {
371 305
372 let { 306 let {
@@ -51,9 +51,6 @@ export default class HotProducts extends React.Component { @@ -51,9 +51,6 @@ export default class HotProducts extends React.Component {
51 rowID={rowID} 51 rowID={rowID}
52 data={rowData} 52 data={rowData}
53 onPressProduct={this.props.onPressProduct} 53 onPressProduct={this.props.onPressProduct}
54 - similarIndex={this.props.similarIndex}  
55 - onLongPressProduct={this.props.onLongPressProduct}  
56 - onPressFindSimilar={this.props.onPressFindSimilar}  
57 /> 54 />
58 ); 55 );
59 } 56 }
@@ -79,8 +79,6 @@ class BrandStoreContainer extends Component { @@ -79,8 +79,6 @@ class BrandStoreContainer extends Component {
79 this._onPressCloseMoreFilter=this._onPressCloseMoreFilter.bind(this); 79 this._onPressCloseMoreFilter=this._onPressCloseMoreFilter.bind(this);
80 this.resetReceiveCouponResult=this.resetReceiveCouponResult.bind(this); 80 this.resetReceiveCouponResult=this.resetReceiveCouponResult.bind(this);
81 81
82 - this._onLongPressProduct = this._onLongPressProduct.bind(this);  
83 - this._onPressFindSimilar = this._onPressFindSimilar.bind(this);  
84 } 82 }
85 83
86 componentDidMount() { 84 componentDidMount() {
@@ -88,28 +86,12 @@ class BrandStoreContainer extends Component { @@ -88,28 +86,12 @@ class BrandStoreContainer extends Component {
88 this.props.actions.getShopCouponList(); 86 this.props.actions.getShopCouponList();
89 this.props.actions.getShopResources(); 87 this.props.actions.getShopResources();
90 this.props.actions.getFavoriteState(); 88 this.props.actions.getFavoriteState();
91 - // this.props.actions.setShowSimilarGuider(true);  
92 - }  
93 -  
94 - componentWillUnmount() {  
95 -  
96 - }  
97 89
98 - _onLongPressProduct(rowID) {  
99 - if (rowID) {  
100 - this.props.actions.setSimilarIndex(rowID);  
101 - } 90 + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_BRAND_SHOP_L', {SHOP_ID: this.props.brandStore.shopId, BRAND_ID: this.props.brandStore.resource.brandBrowse.brandId});
102 } 91 }
103 92
104 - _onPressFindSimilar(product) {  
105 - if (!product) {  
106 - return;  
107 - } 93 + componentWillUnmount() {
108 94
109 - ReactNative.NativeModules.YH_CommonHelper.jumpFindSimilar(product.toJS());  
110 - ReactNative.NativeModules.YH_CommonHelper.setSimilarGuiderVisible(false);  
111 - this.props.actions.setSimilarIndex(-1);  
112 - this.props.actions.setShowSimilarGuider(false, false);  
113 } 95 }
114 96
115 resetReceiveCouponResult(){ 97 resetReceiveCouponResult(){
@@ -396,8 +378,6 @@ class BrandStoreContainer extends Component { @@ -396,8 +378,6 @@ class BrandStoreContainer extends Component {
396 filterCategoryDetailFilterList, 378 filterCategoryDetailFilterList,
397 filterNameFactors, 379 filterNameFactors,
398 filterFactors, 380 filterFactors,
399 - similarIndex,  
400 - showSimilarGuider,  
401 } = this.props.brandStore; 381 } = this.props.brandStore;
402 382
403 let isFetching = (storeFilter == 0 && resource.isFetching) 383 let isFetching = (storeFilter == 0 && resource.isFetching)
@@ -439,10 +419,6 @@ class BrandStoreContainer extends Component { @@ -439,10 +419,6 @@ class BrandStoreContainer extends Component {
439 resetReceiveCouponResult={this.resetReceiveCouponResult} 419 resetReceiveCouponResult={this.resetReceiveCouponResult}
440 onPressFloorProduct={this._onPressFloorProduct} 420 onPressFloorProduct={this._onPressFloorProduct}
441 onPressProductListProduct={this._onPressProductListProduct} 421 onPressProductListProduct={this._onPressProductListProduct}
442 - onLongPressProduct={this._onLongPressProduct}  
443 - onPressFindSimilar={this._onPressFindSimilar}  
444 - similarIndex={similarIndex}  
445 - showSimilarGuider={showSimilarGuider}  
446 /> 422 />
447 ); 423 );
448 } 424 }
@@ -66,7 +66,9 @@ export default class ProductListCell extends Component { @@ -66,7 +66,9 @@ export default class ProductListCell extends Component {
66 66
67 _renderImages() { 67 _renderImages() {
68 let {data, sourceType, similarIndex, rowID, showSimilarGuider} = this.props; 68 let {data, sourceType, similarIndex, rowID, showSimilarGuider} = this.props;
69 - let url = YH_Image.getSlicedUrl(data.get('default_images', ''), 290, 386, 2); // 商品缩略图 69 + let url = data.get('default_images', '').replace('{mode}', 2)
  70 + .replace(/{width}/g, 290)
  71 + .replace(/{height}/g, 386)
70 72
71 73
72 let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品 74 let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
@@ -38,8 +38,12 @@ export default class YH_Image extends Component { @@ -38,8 +38,12 @@ export default class YH_Image extends Component {
38 return ''; 38 return '';
39 } 39 }
40 40
41 - width = PixelRatio.getPixelSizeForLayoutSize(width);  
42 - height = PixelRatio.getPixelSizeForLayoutSize(height); 41 + // width = PixelRatio.getPixelSizeForLayoutSize(width);
  42 + // height = PixelRatio.getPixelSizeForLayoutSize(height);
  43 +
  44 + width = Math.ceil(width * 2);
  45 + height = Math.ceil(height * 2);
  46 +
43 let newSrc = src; 47 let newSrc = src;
44 if (src.indexOf('imageView') === -1 && src.indexOf('imageMogr') === -1) { 48 if (src.indexOf('imageView') === -1 && src.indexOf('imageMogr') === -1) {
45 newSrc = src + '?imageView2/' + mode + '/w/' + width + '/h/' + height; 49 newSrc = src + '?imageView2/' + mode + '/w/' + width + '/h/' + height;
@@ -220,7 +220,7 @@ export default class MineListHeader extends React.Component { @@ -220,7 +220,7 @@ export default class MineListHeader extends React.Component {
220 let favStringFontSize = profile.uid != '0' ? 11 : 15; 220 let favStringFontSize = profile.uid != '0' ? 11 : 15;
221 221
222 return ( 222 return (
223 - <View style={[styles.container,{height:oHigh}]}> 223 + <View style={[styles.container,{height:oHigh, marginBottom: 13}]}>
224 <Image source={bgImage} 224 <Image source={bgImage}
225 style={{width: width, height: bgHeight, paddingTop: bgPaddingTop, marginTop: bgMarginTop}} 225 style={{width: width, height: bgHeight, paddingTop: bgPaddingTop, marginTop: bgMarginTop}}
226 resizeMode={'cover'}> 226 resizeMode={'cover'}>
@@ -727,8 +727,8 @@ export default class MineListHeader extends React.Component { @@ -727,8 +727,8 @@ export default class MineListHeader extends React.Component {
727 height: 10, 727 height: 10,
728 backgroundColor: '#f0f0f0', 728 backgroundColor: '#f0f0f0',
729 }}/> 729 }}/>
730 - <Text style={[styles.icon_text, {fontSize: 16, height: 120, marginTop:15, marginBottom: bgMarginTop,}]} numberOfLines={1}>  
731 - 为您优选新品 730 + <Text style={[styles.icon_text, {fontSize: 16, height: 120, marginTop:15,}]} numberOfLines={1}>
  731 + 为您优选
732 </Text> 732 </Text>
733 </View> 733 </View>
734 ); 734 );
@@ -42,19 +42,11 @@ export default class RedBrand extends Component { @@ -42,19 +42,11 @@ export default class RedBrand extends Component {
42 this._onPressProductFilter = this._onPressProductFilter.bind(this); 42 this._onPressProductFilter = this._onPressProductFilter.bind(this);
43 this._onPressFilter = this._onPressFilter.bind(this); 43 this._onPressFilter = this._onPressFilter.bind(this);
44 this._onPressLaunchProfile = this._onPressLaunchProfile.bind(this); 44 this._onPressLaunchProfile = this._onPressLaunchProfile.bind(this);
45 - this._onChangeVisibleRows = this._onChangeVisibleRows.bind(this);  
46 - this._onMomentumScrollBegin = this._onMomentumScrollBegin.bind(this);  
47 - this._onMomentumScrollEnd = this._onMomentumScrollEnd.bind(this);  
48 45
49 this.dataSource = new ListView.DataSource({ 46 this.dataSource = new ListView.DataSource({
50 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), 47 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
51 sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2), 48 sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
52 }); 49 });
53 -  
54 - this.state = {  
55 - selectedVisibleIndex: -1,  
56 - scrollEnd: false,  
57 - };  
58 } 50 }
59 51
60 _onPressLaunchProfile(value){ 52 _onPressLaunchProfile(value){
@@ -155,61 +147,22 @@ export default class RedBrand extends Component { @@ -155,61 +147,22 @@ export default class RedBrand extends Component {
155 return(<GoodsGroupList yh_exposureData={params} resource={rowData} onPressProductRecommend={this.props.onPressProductRecommend}/>); 147 return(<GoodsGroupList yh_exposureData={params} resource={rowData} onPressProductRecommend={this.props.onPressProductRecommend}/>);
156 } 148 }
157 } else if (sectionID == 'productList' || sectionID == 'newProductList') { 149 } else if (sectionID == 'productList' || sectionID == 'newProductList') {
158 - let similarIndex = this.props.similarIndex;  
159 let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal; 150 let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
160 let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft}; 151 let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
161 - let showSimilarGuider = this.props.showSimilarGuider  
162 - && this.state.scrollEnd  
163 - && rowID == this.state.selectedVisibleIndex  
164 - && rowID != similarIndex; 152 +
165 return ( 153 return (
166 <BrandProductListCell 154 <BrandProductListCell
167 style={[styles.listContainer, customStyle]} 155 style={[styles.listContainer, customStyle]}
168 key={'row' + rowID} 156 key={'row' + rowID}
169 rowID={rowID} 157 rowID={rowID}
170 data={rowData} 158 data={rowData}
171 - similarIndex={similarIndex}  
172 onPressProduct={this.props.onPressProductCell} 159 onPressProduct={this.props.onPressProductCell}
173 - onLongPressProduct={this.props.onLongPressProduct}  
174 - onPressFindSimilar={this.props.onPressFindSimilar}  
175 - onPressDislike={this.props.onPressDislike}  
176 - showSimilarGuider={showSimilarGuider}  
177 /> 160 />
178 ); 161 );
179 } 162 }
180 return null; 163 return null;
181 } 164 }
182 165
183 - _onChangeVisibleRows(visibleRows, changedRows) {  
184 - if (Object.keys(visibleRows).length == 0) {  
185 - return;  
186 - }  
187 -  
188 - let selectedIndex = -1;  
189 - let sectionIDs = Object.keys(visibleRows);  
190 - let targetSection = 'productList';  
191 - if (!sectionIDs.includes(targetSection)) {  
192 - return;  
193 - }  
194 -  
195 - let rowIndexs = Object.keys(visibleRows[targetSection]);  
196 - if (rowIndexs.length > 0) {  
197 - selectedIndex = rowIndexs[0];  
198 - }  
199 - if (rowIndexs.length > 3) {  
200 - selectedIndex = rowIndexs[2];  
201 - }  
202 -  
203 - this.setState({selectedVisibleIndex: selectedIndex});  
204 - }  
205 -  
206 - _onMomentumScrollBegin(event) {  
207 - this.setState({scrollEnd: false});  
208 - }  
209 -  
210 - _onMomentumScrollEnd(event) {  
211 - this.setState({scrollEnd: true});  
212 - }  
213 166
214 render() { 167 render() {
215 168
@@ -73,9 +73,6 @@ class RedPersonBrandContainer extends Component { @@ -73,9 +73,6 @@ class RedPersonBrandContainer extends Component {
73 this.resetReceiveCouponResult=this.resetReceiveCouponResult.bind(this); 73 this.resetReceiveCouponResult=this.resetReceiveCouponResult.bind(this);
74 this._onPressCollection = this._onPressCollection.bind(this); 74 this._onPressCollection = this._onPressCollection.bind(this);
75 this._onPressLink = this._onPressLink.bind(this); 75 this._onPressLink = this._onPressLink.bind(this);
76 - this._onLongPressProduct = this._onLongPressProduct.bind(this);  
77 - this._onPressFindSimilar = this._onPressFindSimilar.bind(this);  
78 - this._onPressProductRecommend = this._onPressProductRecommend.bind(this);  
79 } 76 }
80 77
81 componentDidMount() { 78 componentDidMount() {
@@ -86,31 +83,12 @@ class RedPersonBrandContainer extends Component { @@ -86,31 +83,12 @@ class RedPersonBrandContainer extends Component {
86 this.props.actions.getShopCouponList(); 83 this.props.actions.getShopCouponList();
87 this.props.actions.getFavoriteCount(); 84 this.props.actions.getFavoriteCount();
88 this.props.actions.getFavoriteState(); 85 this.props.actions.getFavoriteState();
89 - // this.props.actions.setShowSimilarGuider(true);  
90 } 86 }
91 87
92 componentWillUnmount() { 88 componentWillUnmount() {
93 89
94 } 90 }
95 91
96 - _onLongPressProduct(rowID) {  
97 - if (rowID) {  
98 - this.props.actions.setSimilarIndex(rowID);  
99 - }  
100 - }  
101 -  
102 - _onPressFindSimilar(product) {  
103 - if (!product) {  
104 - return;  
105 - }  
106 -  
107 - ReactNative.NativeModules.YH_CommonHelper.jumpFindSimilar(product.toJS());  
108 - ReactNative.NativeModules.YH_CommonHelper.setSimilarGuiderVisible(false);  
109 - this.props.actions.setSimilarIndex(-1);  
110 - this.props.actions.setShowSimilarGuider(false, false);  
111 - }  
112 -  
113 -  
114 _onPressCollection(isCollected) { 92 _onPressCollection(isCollected) {
115 if (!isCollected) { 93 if (!isCollected) {
116 this.props.actions.addFavorite(); 94 this.props.actions.addFavorite();
@@ -301,14 +279,11 @@ class RedPersonBrandContainer extends Component { @@ -301,14 +279,11 @@ class RedPersonBrandContainer extends Component {
301 filterNameFactors, 279 filterNameFactors,
302 receiveCouponResult, 280 receiveCouponResult,
303 coupon, 281 coupon,
304 - similarIndex,  
305 - showSimilarGuider,  
306 } = this.props.redBrand; 282 } = this.props.redBrand;
307 283
308 return ( 284 return (
309 <RedBrand 285 <RedBrand
310 shopId={shopId} 286 shopId={shopId}
311 - similarIndex = {similarIndex}  
312 productList={productList} 287 productList={productList}
313 productListForNew={productListForNew} 288 productListForNew={productListForNew}
314 launchProfile={launchProfile} 289 launchProfile={launchProfile}
@@ -337,9 +312,6 @@ class RedPersonBrandContainer extends Component { @@ -337,9 +312,6 @@ class RedPersonBrandContainer extends Component {
337 onPressLink={this._onPressLink} 312 onPressLink={this._onPressLink}
338 onPressProductCell={this._onPressProductCell} 313 onPressProductCell={this._onPressProductCell}
339 onPressProductRecommend={this._onPressProductRecommend} 314 onPressProductRecommend={this._onPressProductRecommend}
340 - onLongPressProduct={this._onLongPressProduct}  
341 - onPressFindSimilar={this._onPressFindSimilar}  
342 - showSimilarGuider={showSimilarGuider}  
343 /> 315 />
344 ); 316 );
345 } 317 }