Authored by 于良

好店推荐数据上报index调整 review by 孙凯

... ... @@ -40,6 +40,7 @@ export default class ShopRecommend extends Component{
onClick(event: Event) {
let type = event.nativeEvent.type;
let index = event.nativeEvent.index;
let realIndex = 0;
if (type == 'favorite') {
let shopId = event.nativeEvent.shopId;
this.props.onPressShopFavorite && this.props.onPressShopFavorite(shopId, index);
... ... @@ -49,24 +50,28 @@ export default class ShopRecommend extends Component{
let shopId = event.nativeEvent.shopId;
let type = event.nativeEvent.type;
let imageUrl = '';
for (var i = 0; i < list.length; i++) {
let shopItem = list[i];
if (shopId == shopItem.shopId) {
if (type == 'top') {
realIndex = i * 4 + 1;
imageUrl = shopItem.src && SlicedImage.getSlicedUrl(shopItem.src, 240*DEVICE_WIDTH_RATIO, 116*DEVICE_WIDTH_RATIO, 2);
} else if (type == 'left') {
realIndex = i * 4 + 2;
imageUrl = shopItem.goods0 && shopItem.goods0.src && SlicedImage.getSlicedUrl(shopItem.goods0.src, 80*DEVICE_WIDTH_RATIO, 106*DEVICE_WIDTH_RATIO, 2);
} else if (type == 'right') {
realIndex = i * 4 + 4;
imageUrl = shopItem.goods2 && shopItem.goods2.src && SlicedImage.getSlicedUrl(shopItem.goods2.src, 80*DEVICE_WIDTH_RATIO, 106*DEVICE_WIDTH_RATIO, 2);
} else if (type == 'center') {
realIndex = i * 4 + 3;
imageUrl = shopItem.goods1 && shopItem.goods1.src && SlicedImage.getSlicedUrl(shopItem.goods1.src, 80*DEVICE_WIDTH_RATIO, 106*DEVICE_WIDTH_RATIO, 2);
}
break;
}
}
this.props.onPressShopRecommendItem && this.props.onPressShopRecommendItem(url, imageUrl, index);
this.props.onPressShopRecommendItem && this.props.onPressShopRecommendItem(url, imageUrl, realIndex);
}
}
... ...