Authored by 🍓

店铺模块化埋点&删除log,留埋点log验收后删,review by redding

... ... @@ -24,7 +24,7 @@ export default class GoodsGroupList extends React.Component {
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
this.renderRow = this.renderRow.bind(this);
this._onPressProductCell = this._onPressProductCell.bind(this);
this._onPressProductRecommend = this._onPressProductRecommend.bind(this);
}
shouldComponentUpdate(nextProps){
... ... @@ -35,11 +35,11 @@ export default class GoodsGroupList extends React.Component {
}
}
_onPressProductCell(data, rowID) {
_onPressProductRecommend(data, rowID) {
let {resource} = this.props;
let moduleOrder = resource.get('module_order') + 1;
let moduleType = resource.get('module_type');
this.props.onPressProductCell && this.props.onPressProductCell(data, rowID,moduleOrder,moduleType)
this.props.onPressProductRecommend && this.props.onPressProductRecommend(data, rowID,moduleOrder,moduleType)
}
renderRow(rowData, sectionID, rowID, highlightRow) {
... ... @@ -53,7 +53,7 @@ export default class GoodsGroupList extends React.Component {
key={'row' + rowID}
rowID={rowID}
data={rowData}
onPressProduct={this._onPressProductCell}
onPressProduct={this._onPressProductRecommend}
/>
);
}
... ...
... ... @@ -137,7 +137,7 @@ export default class RedBrand extends Component {
}else if (rowData.get('module_type') == 'FourImage') {
return(<FourImages resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}else if (rowData.get('module_type') == 'AppRecommendProduct') {
return(<GoodsGroupList resource={rowData} onPressProductCell={this.props.onPressProductCell}/>);
return(<GoodsGroupList resource={rowData} onPressProductRecommend={this.props.onPressProductRecommend}/>);
}
} else if (sectionID == 'productList' || sectionID == 'newProductList') {
let similarIndex = this.props.similarIndex;
... ... @@ -147,7 +147,6 @@ export default class RedBrand extends Component {
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
&& rowID != similarIndex;
rowData.tabID = this.props.fliter;
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
... ...
... ... @@ -57,6 +57,7 @@ class RedPersonBrandContainer extends Component {
this._onPressLink = this._onPressLink.bind(this);
this._onLongPressProduct = this._onLongPressProduct.bind(this);
this._onPressFindSimilar = this._onPressFindSimilar.bind(this);
this._onPressProductRecommend = this._onPressProductRecommend.bind(this);
}
componentDidMount() {
... ... @@ -151,7 +152,7 @@ class RedPersonBrandContainer extends Component {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
_onPressProductCell(product, rowId=0, moduleOrder, moduleType) {
_onPressProductRecommend(product, rowId=0, moduleOrder, moduleType) {
let productSkn = product && product.get('product_skn', 0);
if (!productSkn) {
return;
... ... @@ -173,6 +174,47 @@ class RedPersonBrandContainer extends Component {
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_BRAND_SHOP_HOME_FLR_C', param);
}
_onPressProductCell(product, rowId=0) {
let productSkn = product && product.get('product_skn', 0);
if (!productSkn) {
return;
}
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let tabID = this.props.redBrand.fliter;
let tabName = '首页';
if (tabID == '1') {
tabName = '新品';
} else if (tabID == '2') {
tabName = '全部商品';
}
let orderName = this.props.redBrand.productList.orderName;
let sortType = 0;
if (orderName == '最新') {
sortType = 1;
}else if (orderName == '价格') {
sortType = 2;
}else if (orderName == '折扣') {
sortType = 3;
}
let param = {
SHOP_ID: this.props.redBrand.shopId,
TAB_ID: tabID,
TAB_NAME: tabName,
PRD_ID: productSkn,
TEMPLATE_TYPE: this.props.redBrand.shopIntro.shop_template_type,
IS_RED: 1,
SORT_TYPE: 1,
}
if (tabID != '1') {
param.FILTER_VALUE = this.props.redBrand.filterNameFactors.toJS();
param.SORT_TYPE = sortType;
}
console.log('------点击品牌店铺页中全部TAB中的商品列表时---red---');
console.log(param);
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_BRAND_SHOP_HOME_FLR_C', param);
}
_onPressProduct(linkType,linkReource,moduleOrder,moduleType,i_index){
let url = '';
if (!linkReource) {
... ... @@ -304,6 +346,7 @@ class RedPersonBrandContainer extends Component {
onPressCollection={this._onPressCollection}
onPressLink={this._onPressLink}
onPressProductCell={this._onPressProductCell}
onPressProductRecommend={this._onPressProductRecommend}
onLongPressProduct={this._onLongPressProduct}
onPressFindSimilar={this._onPressFindSimilar}
showSimilarGuider={showSimilarGuider}
... ...
... ... @@ -627,8 +627,6 @@ export function getRedBrandDecorator() {
if (rooms) {
dispatch(getVideoLiveCount(rooms));
}
console.log('---->>>>>floor');
console.log(payload);
dispatch(getProduct(payload));
dispatch(getRedBrandDecoratorSuccess(payload));
... ... @@ -714,8 +712,6 @@ export function appRecommendProduct(dataSource) {
return new RedBrandService(app.host).searchProductBySkn(SKNs)
.then(json => {
let product_list = json.product_list;
console.log('----<<<<<<<<product_list');
console.log(product_list);
item.list = product_list;
dispatch(productSuccess(dataSource));
})
... ... @@ -728,8 +724,6 @@ export function appRecommendProduct(dataSource) {
return new RedBrandService(app.host).productList(shopId, channel, order, 1, pageSize)
.then(json => {
let product_list = json.product_list;
console.log('----------111111');
console.log(product_list);
item.list = product_list;
dispatch(productSuccess(dataSource));
... ... @@ -749,10 +743,6 @@ export function getProduct(dataSource) {
let originJson = json;
let list = originJson.modules;
let sknList = [];
console.log('----originJson');
console.log(originJson);
list.map((item, i) => {
if (item.module_type == 'SknList') {
sknList = item.module_data.data;
... ... @@ -766,17 +756,11 @@ export function getProduct(dataSource) {
SKNs = SKNs + ',' + item;
}
});
console.log(SKNs);
console.log('SKNs');
dispatch(productRequest());
return new RedBrandService(app.host).searchProductBySkn(SKNs)
.then(json => {
let product_list = json.product_list;
console.log(json);
console.log('json');
console.log(list);
list.map((item, i) => {
let data = item.module_data.data;
data.map((m, i) => {
... ...