Authored by 于良

店铺去掉找相似 review by chenlin

... ... @@ -37,19 +37,11 @@ export default class BrandStore extends Component {
this.renderRow = this.renderRow.bind(this);
this._onPressProductFilter = this._onPressProductFilter.bind(this);
this._onPressStoreFilter = this._onPressStoreFilter.bind(this);
this._onChangeVisibleRows = this._onChangeVisibleRows.bind(this);
this._onMomentumScrollBegin = this._onMomentumScrollBegin.bind(this);
this._onMomentumScrollEnd = this._onMomentumScrollEnd.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
});
this.state = {
selectedVisibleIndex: -1,
scrollEnd: false,
};
}
componentDidUpdate() {
... ... @@ -216,9 +208,6 @@ export default class BrandStore extends Component {
resource={rowData}
onPressProduct={this.props.onPressFloorProduct}
onPressMoreProducts={this.props.onPressMoreProducts}
similarIndex={this.props.similarIndex}
onLongPressProduct={this.props.onLongPressProduct}
onPressFindSimilar={this.props.onPressFindSimilar}
/>
);
}
... ... @@ -229,30 +218,20 @@ export default class BrandStore extends Component {
} else if (sectionID == 'storeFilter') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
&& rowID != this.props.similarIndex;
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
key={'row' + rowID}
rowID={rowID}
data={rowData}
similarIndex={this.props.similarIndex}
onPressProduct={this.props.onPressProduct}
onLongPressProduct={this.props.onLongPressProduct}
onPressFindSimilar={this.props.onPressFindSimilar}
showSimilarGuider={showSimilarGuider}
/>
);
} else if (sectionID == 'productList') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
&& rowID != this.props.similarIndex;
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
... ... @@ -260,10 +239,6 @@ export default class BrandStore extends Component {
rowID={rowID}
data={rowData}
onPressProduct={this.props.onPressProductListProduct}
similarIndex={this.props.similarIndex}
onLongPressProduct={this.props.onLongPressProduct}
onPressFindSimilar={this.props.onPressFindSimilar}
showSimilarGuider={showSimilarGuider}
/>
);
}
... ... @@ -271,45 +246,6 @@ export default class BrandStore extends Component {
return null;
}
_onChangeVisibleRows(visibleRows, changedRows) {
if (Object.keys(visibleRows).length == 0) {
return;
}
let selectedIndex = -1;
let sectionIDs = Object.keys(visibleRows);
let targetSection = 'storeFilter';
let targetSection2 = 'productList';
if (sectionIDs.includes(targetSection)) {
let rowIndexs = Object.keys(visibleRows[targetSection]);
if (rowIndexs.length > 0) {
selectedIndex = rowIndexs[0];
}
if (rowIndexs.length > 3) {
selectedIndex = rowIndexs[2];
}
this.setState({selectedVisibleIndex: selectedIndex});
} else if (sectionIDs.includes(targetSection2)) {
let rowIndexs = Object.keys(visibleRows[targetSection2]);
if (rowIndexs.length > 0) {
selectedIndex = rowIndexs[0];
}
if (rowIndexs.length > 3) {
selectedIndex = rowIndexs[2];
}
this.setState({selectedVisibleIndex: selectedIndex});
}
}
_onMomentumScrollBegin(event) {
this.setState({scrollEnd: false});
}
_onMomentumScrollEnd(event) {
this.setState({scrollEnd: true});
}
render() {
... ...
... ... @@ -51,9 +51,6 @@ export default class HotProducts extends React.Component {
rowID={rowID}
data={rowData}
onPressProduct={this.props.onPressProduct}
similarIndex={this.props.similarIndex}
onLongPressProduct={this.props.onLongPressProduct}
onPressFindSimilar={this.props.onPressFindSimilar}
/>
);
}
... ...
... ... @@ -79,8 +79,6 @@ class BrandStoreContainer extends Component {
this._onPressCloseMoreFilter=this._onPressCloseMoreFilter.bind(this);
this.resetReceiveCouponResult=this.resetReceiveCouponResult.bind(this);
this._onLongPressProduct = this._onLongPressProduct.bind(this);
this._onPressFindSimilar = this._onPressFindSimilar.bind(this);
}
componentDidMount() {
... ... @@ -88,7 +86,6 @@ class BrandStoreContainer extends Component {
this.props.actions.getShopCouponList();
this.props.actions.getShopResources();
this.props.actions.getFavoriteState();
// this.props.actions.setShowSimilarGuider(true);
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_BRAND_SHOP_L', {SHOP_ID: this.props.brandStore.shopId, BRAND_ID: this.props.brandStore.resource.brandBrowse.brandId});
}
... ... @@ -97,23 +94,6 @@ class BrandStoreContainer extends Component {
}
_onLongPressProduct(rowID) {
if (rowID) {
this.props.actions.setSimilarIndex(rowID);
}
}
_onPressFindSimilar(product) {
if (!product) {
return;
}
ReactNative.NativeModules.YH_CommonHelper.jumpFindSimilar(product.toJS());
ReactNative.NativeModules.YH_CommonHelper.setSimilarGuiderVisible(false);
this.props.actions.setSimilarIndex(-1);
this.props.actions.setShowSimilarGuider(false, false);
}
resetReceiveCouponResult(){
this.props.actions.resetReceiveCouponResult();
}
... ... @@ -387,8 +367,6 @@ class BrandStoreContainer extends Component {
filterCategoryDetailFilterList,
filterNameFactors,
filterFactors,
similarIndex,
showSimilarGuider,
} = this.props.brandStore;
let isFetching = (storeFilter == 0 && resource.isFetching)
... ... @@ -429,10 +407,6 @@ class BrandStoreContainer extends Component {
resetReceiveCouponResult={this.resetReceiveCouponResult}
onPressFloorProduct={this._onPressFloorProduct}
onPressProductListProduct={this._onPressProductListProduct}
onLongPressProduct={this._onLongPressProduct}
onPressFindSimilar={this._onPressFindSimilar}
similarIndex={similarIndex}
showSimilarGuider={showSimilarGuider}
/>
);
}
... ...
... ... @@ -55,9 +55,11 @@ export default class ProductListCell extends Component {
_renderImages() {
let {data, sourceType, similarIndex, rowID, showSimilarGuider} = this.props;
let url = YH_Image.getSlicedUrl(data.get('default_images', ''), 290, 386, 2); // 商品缩略图
let url = data.get('default_images', '').replace('{mode}', 2)
.replace(/{width}/g, 290)
.replace(/{height}/g, 386)
let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
... ...
... ... @@ -38,8 +38,12 @@ export default class YH_Image extends Component {
return '';
}
width = PixelRatio.getPixelSizeForLayoutSize(width);
height = PixelRatio.getPixelSizeForLayoutSize(height);
// width = PixelRatio.getPixelSizeForLayoutSize(width);
// height = PixelRatio.getPixelSizeForLayoutSize(height);
width = Math.ceil(width * 2);
height = Math.ceil(height * 2);
let newSrc = src;
if (src.indexOf('imageView') === -1 && src.indexOf('imageMogr') === -1) {
newSrc = src + '?imageView2/' + mode + '/w/' + width + '/h/' + height;
... ...
... ... @@ -220,7 +220,7 @@ export default class MineListHeader extends React.Component {
let favStringFontSize = profile.uid != '0' ? 11 : 15;
return (
<View style={[styles.container,{height:oHigh}]}>
<View style={[styles.container,{height:oHigh, marginBottom: 13}]}>
<Image source={bgImage}
style={{width: width, height: bgHeight, paddingTop: bgPaddingTop, marginTop: bgMarginTop}}
resizeMode={'cover'}>
... ... @@ -727,8 +727,8 @@ export default class MineListHeader extends React.Component {
height: 10,
backgroundColor: '#f0f0f0',
}}/>
<Text style={[styles.icon_text, {fontSize: 16, height: 120, marginTop:15, marginBottom: bgMarginTop,}]} numberOfLines={1}>
为您优选新品
<Text style={[styles.icon_text, {fontSize: 16, height: 120, marginTop:15,}]} numberOfLines={1}>
为您优选
</Text>
</View>
);
... ...
... ... @@ -39,19 +39,11 @@ export default class RedBrand extends Component {
this._onPressProductFilter = this._onPressProductFilter.bind(this);
this._onPressFilter = this._onPressFilter.bind(this);
this._onPressLaunchProfile = this._onPressLaunchProfile.bind(this);
this._onChangeVisibleRows = this._onChangeVisibleRows.bind(this);
this._onMomentumScrollBegin = this._onMomentumScrollBegin.bind(this);
this._onMomentumScrollEnd = this._onMomentumScrollEnd.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
});
this.state = {
selectedVisibleIndex: -1,
scrollEnd: false,
};
}
_onPressLaunchProfile(value){
... ... @@ -127,25 +119,16 @@ export default class RedBrand extends Component {
return(<TripleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}
} else if (sectionID == 'productList') {
let similarIndex = this.props.similarIndex;
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
&& rowID != similarIndex;
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
key={'row' + rowID}
rowID={rowID}
data={rowData}
similarIndex={similarIndex}
onPressProduct={this.props.onPressProductCell}
onLongPressProduct={this.props.onLongPressProduct}
onPressFindSimilar={this.props.onPressFindSimilar}
onPressDislike={this.props.onPressDislike}
showSimilarGuider={showSimilarGuider}
/>
);
}
... ...
... ... @@ -55,8 +55,6 @@ class RedPersonBrandContainer extends Component {
this.resetReceiveCouponResult=this.resetReceiveCouponResult.bind(this);
this._onPressCollection = this._onPressCollection.bind(this);
this._onPressLink = this._onPressLink.bind(this);
this._onLongPressProduct = this._onLongPressProduct.bind(this);
this._onPressFindSimilar = this._onPressFindSimilar.bind(this);
}
componentDidMount() {
... ... @@ -66,31 +64,12 @@ class RedPersonBrandContainer extends Component {
this.props.actions.getShopCouponList();
this.props.actions.getFavoriteCount();
this.props.actions.getFavoriteState();
// this.props.actions.setShowSimilarGuider(true);
}
componentWillUnmount() {
}
_onLongPressProduct(rowID) {
if (rowID) {
this.props.actions.setSimilarIndex(rowID);
}
}
_onPressFindSimilar(product) {
if (!product) {
return;
}
ReactNative.NativeModules.YH_CommonHelper.jumpFindSimilar(product.toJS());
ReactNative.NativeModules.YH_CommonHelper.setSimilarGuiderVisible(false);
this.props.actions.setSimilarIndex(-1);
this.props.actions.setShowSimilarGuider(false, false);
}
_onPressCollection(isCollected) {
if (!isCollected) {
this.props.actions.addFavorite();
... ... @@ -208,13 +187,10 @@ class RedPersonBrandContainer extends Component {
filterNameFactors,
receiveCouponResult,
coupon,
similarIndex,
showSimilarGuider,
} = this.props.redBrand;
return (
<RedBrand
similarIndex = {similarIndex}
productList={productList}
launchProfile={launchProfile}
fliter={fliter}
... ... @@ -241,9 +217,6 @@ class RedPersonBrandContainer extends Component {
onPressCollection={this._onPressCollection}
onPressLink={this._onPressLink}
onPressProductCell={this._onPressProductCell}
onLongPressProduct={this._onLongPressProduct}
onPressFindSimilar={this._onPressFindSimilar}
showSimilarGuider={showSimilarGuider}
/>
);
}
... ...