Authored by zhuangjiajia

BLK品类品牌树相关埋点

review by ---盖剑秋
... ... @@ -31,7 +31,7 @@ export default class BLKBrandCell extends React.Component {
img = img.replace('{width}', cellWidth*2).replace('{height}', (cellWidth-10)*2).replace('{mode}',2);
let brandName = rowData.get('brand_name');
return (
<TouchableOpacity style={styles.cell} onPress={()=>{this.props.onPressBrandItem && this.props.onPressBrandItem(rowData.toJS());}}>
<TouchableOpacity style={styles.cell} onPress={()=>{this.props.onPressBrandItem && this.props.onPressBrandItem(rowData.toJS(),false,rowID);}}>
<Image style={styles.cellImg} source={{uri:img}} resizeMode={'contain'}/>
<Text style={styles.cellTitle}>{brandName}</Text>
</TouchableOpacity>
... ...
... ... @@ -98,7 +98,7 @@ export default class Brand extends Component {
// }
return (
<View onLayout={this.onLayout.bind(this, sectionID)}>
<BLKBrandCell title={title} rowData={rowData} onPressBrandItem={this.props.onPressBrandItem}/>
<BLKBrandCell rowID={rowID} title={title} rowData={rowData} onPressBrandItem={this.props.onPressBrandItem}/>
</View>
);
}
... ...
... ... @@ -79,14 +79,15 @@ class BrandContainer extends Component {
}
//原生跳转
_onPressBrandItem(data, fromSearch=false){
_onPressBrandItem(data, fromSearch=false,index){
//blk品牌跳转需要:如果发现是店铺,全部跳基础店铺。----顺老板。
if (data&&data.type == '2') {
data.is_red_shop == '0';
data.shop_template_type = '1';
}
ReactNative.NativeModules.YH_CommonHelper.blkPushBrandVC(data);
// let eventName = '';
let eventName = 'YB_STROLL_PLUSSTAR_BRAND_FLR_C';
// let params = {};
//
// if (this.props.brand.brandFliter == 1 || this.props.brand.brandFliter == 2) {
... ... @@ -99,88 +100,144 @@ class BrandContainer extends Component {
// eventName = 'YB_CATEGORY_BRAND_LIST_TEXT';
// }
//
// let brandId = data.shop_id ? data.shop_id : '';
let brandId = data.shop_id ? data.shop_id : '';
// // 0-girl 1-boy 2-child 3-lifestyle
// let gender = 0;
// if (this.props.brand.selectedChannelId == 1) {
// gender = 1;
// } else if (this.props.brand.selectedChannelId == 2) {
// gender = 0;
// } else if (this.props.brand.selectedChannelId == 3) {
// gender = 2;
// } else if (this.props.brand.selectedChannelId == 4) {
// gender = 3;
// }
// if (!brandId) {
// brandId = data.id ? data.id : '';
// }
// params = {
// BR_ID: brandId,
// GDER: gender + '',
// };
// // console.log(eventName)
// // console.log(params)
// NativeModules.YH_CommonHelper.logEvent(eventName, params);
let gender = 0;
if (this.props.brand.selectedChannelId == 1) {
gender = 1;
} else if (this.props.brand.selectedChannelId == 2) {
gender = 2;
} else if (this.props.brand.selectedChannelId == 3) {
gender = 2;
} else if (this.props.brand.selectedChannelId == 4) {
gender = 3;
}
if (!brandId) {
brandId = data.id ? data.id : '';
}
let _index = parseInt(index)+1;
let params = {
BRAND_ID: brandId,
GENDER: gender + '',
FLR_ID:1003,
I_INDEX:_index+'',
};
// 3.GENDER:男士/女士频道唯一id,后台如果有,则取后台,没有时,1-男士,2-女士;
// 4.FLR_ID:楼层唯一id,从1001开始,依次递增;
// 5.I_INDEX:内部顺序号,从1开始,依次递增;
// 6.BRAND_ID:所点击的品牌id;
// console.log("点击了品牌第三楼层:");
// console.log(params);
NativeModules.YH_CommonHelper.logEvent(eventName, params);
}
//URL 拼装跳转规则跳转
_onPressSlideItem(url, index=0) {
let newUrl = this._handleBLKBannerURL(url);
let brandId = this._handlerBLKBannerID(url);
if (newUrl.length) {
url = newUrl;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
// // 0-girl 1-boy 2-child 3-lifestyle
// let gender = 0;
// if (this.props.brand.selectedChannelId == 1) {
// gender = 1;
// } else if (this.props.brand.selectedChannelId == 2) {
// gender = 0;
// } else if (this.props.brand.selectedChannelId == 3) {
// gender = 2;
// } else if (this.props.brand.selectedChannelId == 4) {
// gender = 3;
// }
//
// let params = {
// BAN_NUM: parseInt(index) + 1 + '',
// TOURL: url,
// GDER: gender + '',
// };
// let brandId = data.shop_id ? data.shop_id : '';
let gender = 0;
if (this.props.brand.selectedChannelId == 1) {
gender = 1;
} else if (this.props.brand.selectedChannelId == 2) {
gender = 2;
} else if (this.props.brand.selectedChannelId == 3) {
gender = 2;
} else if (this.props.brand.selectedChannelId == 4) {
gender = 3;
}
//
// NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BAN', params);
// if (!brandId) {
// brandId = data.id ? data.id : '';
// }
let params = {
BRAND_ID: brandId,
I_INDEX: parseInt(index) + 1 + '',
GENDER: gender + '',
FLR_ID:1001,
};
// console.log("点击了品牌楼第一层:");
// console.log(params);
NativeModules.YH_CommonHelper.logEvent('YB_STROLL_PLUSSTAR_BRAND_FLR_C', params);
}
_onPressRecommendItem(data, index=0) {
_onPressRecommendItem(data, index) {
let url = data.url;
let newUrl = this._handleBLKBannerURL(url);
if (newUrl.length) {
url = newUrl;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
// let brandId = brandId = data.id ? data.id : '';
// // 0-girl 1-boy 2-child 3-lifestyle
// let gender = 0;
// if (this.props.brand.selectedChannelId == 1) {
// gender = 1;
// } else if (this.props.brand.selectedChannelId == 2) {
// gender = 0;
// } else if (this.props.brand.selectedChannelId == 3) {
// gender = 2;
// } else if (this.props.brand.selectedChannelId == 4) {
// gender = 3;
// let brandId = data.id ? data.id : '';
// 0-girl 1-boy 2-child 3-lifestyle
let gender = 0;
if (this.props.brand.selectedChannelId == 1) {
gender = 1;
} else if (this.props.brand.selectedChannelId == 2) {
gender = 2;
} else if (this.props.brand.selectedChannelId == 3) {
gender = 2;
} else if (this.props.brand.selectedChannelId == 4) {
gender = 3;
}
// if (!brandId) {
// brandId = data.id ? data.id : '';
// }
// let params = {
// BAN_NUM: parseInt(index) + 1 + '',
// BR_ID: brandId,
// GDER: gender + '',
// };
// NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BR', params);
let brandId = this._handlerBLKBannerID(url);
let params = {
I_INDEX: parseInt(index) + 1 + '',
GENDER: gender + '',
FLR_ID:1002,
BRAND_ID:brandId
};
// console.log("点击了品牌楼第二层:");
// console.log(params);
NativeModules.YH_CommonHelper.logEvent('YB_STROLL_PLUSSTAR_BRAND_FLR_C', params);
}
_handlerBLKBannerID(url){
let strs= new Array();
let dataString = '';
let bannerId = '';
if (url.indexOf('yohobuy=') !== -1) {
strs = url.split("yohobuy=");
if (strs.length == 1) {
dataString = strs[0];
} else {
dataString = strs[1];
}
} else {
strs = url.split("yohobuy=");
if (strs.length == 1) {
dataString = strs[0];
} else {
dataString = strs[1];
}
}
try {
var obj = {};
var params = {};
if (dataString.length > 1) {
obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象
}
//若发现BLK banner 跳转规则中 有go.brand,则只跳 品牌列表页
//有go.shop,则只跳 基础店铺页
// bannerId = this._handlerBrandId(obj.params);
params = obj.params;
bannerId = params.brand_id ? params.brand_id : params.shop_id;
return bannerId;
} catch (e) {
return '';
}
return '';
}
_handleBLKBannerURL(url) {
let strs= new Array();
let dataString = '';
... ... @@ -219,7 +276,6 @@ class BrandContainer extends Component {
if (strs.length > 1) {
totalUrlWithType = strs[0] + totalUrlWithType;
}
return totalUrlWithType;
} catch (e) {
return '';
... ... @@ -279,11 +335,12 @@ class BrandContainer extends Component {
this.props.actions.setInitialListSize(0);
this.props.actions.setBrandSelectedChannel(channelId);
// let params = {
// CAT_NUM: channelId + '',
// };
//
// NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_CH', params);
let params = {
TAB_ID: 1,
GENDER:channelId+""
};
console.log('点击品牌'+params.toString());
NativeModules.YH_CommonHelper.logEvent('YB_STROLL_PLUSSTAR_CLASS_CHANNEL_C', params);
}
_onPressSearch() {
... ...
... ... @@ -79,6 +79,13 @@ class CategoryContainer extends Component {
_onSelectChannel(channel) {
this.props.actions.setCurrentCateId(0);
this.props.actions.setCurrentChannelId(channel.value);
let params = {
TAB_ID: 2,
GENDER:channel.id
};
console.log("点击品类:"+params.TAB_ID);
NativeModules.YH_CommonHelper.logEvent('YB_STROLL_PLUSSTAR_CLASS_CHANNEL_C', params);
}
_pressLeftRow(value,rowID) {
... ... @@ -88,28 +95,35 @@ class CategoryContainer extends Component {
_pressSubCateRow(value, index) {
let currentChannelId = this.props.category.currentChannelId;
this.props.actions.jumpToCategory(value, index, currentChannelId);
// let catNum = this.props.category.currentCateId;
// let navCatId = index == 0 ? '0' : value.category_id;
// let channel = 1;
// let l1Cate=value.parent_id;
// if (currentChannelId == 'boy') {
// channel = 1;
// } else if (currentChannelId == 'girl') {
// channel = 2;
// } else if (currentChannelId == 'kids') {
// channel = 3;
// } else if (currentChannelId == 'lifestyle') {
// channel = 4;
// }
// let params = {
// CAT_NUM: parseInt(catNum) + 1 + '',
// NAV_CAT_ID: parseInt(navCatId) + '',
// GDER: channel + '',
// L1_CATE:parseInt(l1Cate) + '',
// };
//
// NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_CAT_LIST', params);
let catNum = this.props.category.currentCateId;
let navCatId = index == 0 ? '0' : value.category_id;
let channel = 1;
let l1Cate=value.parent_id;
if (currentChannelId == 'boy') {
channel = 1;
} else if (currentChannelId == 'girl') {
channel = 2;
} else if (currentChannelId == 'kids') {
channel = 3;
} else if (currentChannelId == 'lifestyle') {
channel = 4;
}
let l2_index = index==0 ? "":index;
let params = {
L1_INDEX: parseInt(catNum) + 1 + '',
L2_INDEX:l2_index,
L1_CATE:parseInt(l1Cate) + '',
L2_CATE: parseInt(navCatId) + '',
GENDER: channel + '',
};
//3.GENDER:男士/女士频道唯一id,后台如果有,则取后台,没有时,1-男士,2-女士;
// 4.L1_INDEX:一级品类所在的顺序号,从1开始,依次递增;
// 5.L1_CATE:一级品类代码;
// 6.L2_INDEX:二级品类所在的顺序号,从1开始,依次递增,点全部时传0;
// 7.L2_CATE:二级品类代码,点全部时传空;
// console.log("=======");
// console.log(params);
NativeModules.YH_CommonHelper.logEvent('YB_STROLL_PLUSSTAR_CATEGORY_FLR_C', params);
}
render() {
... ...