Authored by hongyong.zhao

新品到着埋点添加

... ... @@ -145,10 +145,12 @@ export default class NewArrival extends React.PureComponent {
let resourceList = resourceInfo.resourceList ? resourceInfo.resourceList.toArray() : [];
let categoryList;
let template_id = ''
resourceList && resourceList.map((item, i) => {
let template_name = item.get('template_name');
if (template_name === 'guessLike') {
categoryList = item.get('data');
template_id = item.get('template_id');
}
});
... ... @@ -157,7 +159,7 @@ export default class NewArrival extends React.PureComponent {
data={categoryList}
selectedCategoryIndex={productList.selectedCategoryIndex}
onPressCategoryTab={(rowData, rowID) => {
this.props.onPressCategoryTab && this.props.onPressCategoryTab(rowData, rowID);
this.props.onPressCategoryTab && this.props.onPressCategoryTab(rowData, rowID, template_id);
}}
changeCategorySelectorTitle={this._clickCategorySelector}
/>
... ...
... ... @@ -32,11 +32,11 @@ export default class ImageSlider extends React.Component {
}
}
_handleParamsJumpWithUrl(index, url) {
_handleParamsJumpWithUrl(index, url, yh_exposeData) {
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let params = {
let params = yh_exposeData ? yh_exposeData : {
I_INDEX: index,
F_URL: url
};
... ... @@ -59,7 +59,7 @@ export default class ImageSlider extends React.Component {
yh_exposureData={data[0].yh_exposureData}
style={{width: sliderWidth, height: sliderHeight}}
onPress={() => {
this._handleParamsJumpWithUrl(1, data[0].url)
this._handleParamsJumpWithUrl(1, data[0].url, data[0].yh_exposureData)
}}
>
<YH_Image
... ... @@ -95,7 +95,7 @@ export default class ImageSlider extends React.Component {
activeOpacity={1}
yh_exposureData={item.yh_exposureData}
onPress={() => {
this._handleParamsJumpWithUrl(i + 1, item.url);
this._handleParamsJumpWithUrl(i + 1, item.url, item.yh_exposureData);
}}
>
<YH_Image
... ...
... ... @@ -123,29 +123,30 @@ class NewArrivalContainer extends Component {
let {contentCode} = this.props.app;
let param;
if (type === 'banner' && params) {
param = {
F_ID: this.state.focusFloorId,
F_URL: url,
CONTENT_CODE: contentCode
};
}
let param = {...params};
// if (type === 'banner' && params) {
// param = {
// F_ID: this.state.focusFloorId,
// F_URL: url,
// CONTENT_CODE: contentCode
// };
// }
//
// if (type === 'icon' && params) {
// param = {
// F_ID: this.state.jointFloorId,
// F_URL: url,
// CONTENT_CODE: contentCode
// };
// }
if (type === 'icon' && params) {
param = {
F_ID: this.state.jointFloorId,
F_URL: url,
CONTENT_CODE: contentCode
};
}
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
}
_onPressCategoryTab(data, index) {
_onPressCategoryTab(data, index, template_id) {
let queryList = data.get('query').toJS();
data && this.props.actions.storeCurrentTabValue(index, data.get('tab_name'), queryList);
data && this.props.actions.storeCurrentTabValue(index, data.get('tab_name'), queryList, template_id);
}
_onPressArticle(url, index=0, article_id) {
... ...
... ... @@ -68,7 +68,7 @@ export function setShowSimilarGuider(requestNative, show=false) {
}
}
export function storeCurrentTabValue(index, tabName, queryList) {
export function storeCurrentTabValue(index, tabName, queryList, template_id) {
return (dispatch, getState) => {
dispatch({
type: STORE_CURRENT_TAB_VALUE,
... ... @@ -83,7 +83,7 @@ export function storeCurrentTabValue(index, tabName, queryList) {
}
paramsDic = res;
})
dispatch(getProductList(paramsDic));
dispatch(getProductList(paramsDic, template_id));
};
}
... ... @@ -146,39 +146,83 @@ function exposeResourceInfoData(json, contentCode) {
let floorname = item.template_name
let floorid = item.template_id
if (floorname === 'newFocus') {
let list = item.data;
for (let j = 0; j< list.length; j ++) {
let subitem = list[j]
subitem.yh_exposureData = {
F_ID: floorid,
F_NAME: floorname,
F_INDEX: i + 1,
I_INDEX: parseInt(j) + 1 + "",
P_NAME: pageName,
F_URL: subitem.url,
CONTENT_CODE: contentCode,
exposureEnd: 1,
}
}
}
if (floorname === 'newProductShopListFloor') {
let list = item.list;
for (let j = 0; j< list.length; j ++) {
let subitem = list[j]
subitem.yh_exposureData = {
F_ID: floorid,
F_NAME: floorname,
P_NAME: pageName,
F_INDEX: i + 1,
I_INDEX: parseInt(j) + 1 + "",
SHOP_ID: subitem.shops_id,
CONTENT_CODE: contentCode,
exposureEnd: 1,
}
}
}
switch (floorname) {
case 'newFocus': {
let list = item.data;
for (let j = 0; j< list.length; j ++) {
let subitem = list[j]
subitem.yh_exposureData = {
F_ID: floorid,
F_NAME: floorname,
F_INDEX: i + 1,
I_INDEX: parseInt(j) + 1 + "",
P_NAME: pageName,
F_URL: subitem.url,
CODE: contentCode,
exposureEnd: 1,
}
}
}
break;
case 'newProductShopListFloor': {
let list = item.list;
for (let j = 0; j< list.length; j ++) {
let subitem = list[j]
subitem.yh_exposureData = {
F_ID: floorid,
F_NAME: floorname,
P_NAME: pageName,
F_INDEX: i + 1,
I_INDEX: parseInt(j) + 1 + "",
SHOP_ID: subitem.shops_id,
CODE: contentCode,
exposureEnd: 1,
}
}
}
break;
case 'divideImage': {
let list = item.data
for (let j=0; j< list.length; j++) {
let subitem = list[j]
subitem.yh_exposureData = {
F_ID: floorid,
F_NAME: floorname,
P_NAME: pageName,
F_INDEX: i + 1,
I_INDEX: parseInt(j) + 1 + "",
CODE: contentCode,
F_URL: subitem.url,
exposureEnd: 1,
}
}
}
break;
case 'splitJointImg': {
let url = ''
url = item.urls && item.urls[0] ? item.urls[0] : ''
item.yh_exposureData = {
F_ID: floorid,
F_NAME: floorname,
P_NAME: pageName,
F_INDEX: i + 1,
I_INDEX: 1 + "",
CODE: contentCode,
F_URL: url,
exposureEnd: 1,
}
}
break;
}
}
} catch(error){ }
... ... @@ -216,7 +260,7 @@ export function productListFailure(error) {
/*
* 底部产品列表
*/
export function getProductList(paramsDic) {
export function getProductList(paramsDic, template_id) {
return (dispatch, getState) => {
let {app, newArrival} = getState();
let { productList, filterFactors, searchResourceList, prdFloorId, prdFloorName, prdFloorIndex} = newArrival;
... ... @@ -252,7 +296,7 @@ export function getProductList(paramsDic) {
return new NewArrivalService(app.host).fetchProductList(channel, order, page, pageSize, allFilterFactors, paramsDic)
.then(json => {
let payload = exposeProductListData(json, order, channel, pageSize, tabId, tabName, prdFloorId, prdFloorName, prdFloorIndex);
let payload = exposeProductListData(json, order, channel, pageSize, tabId, tabName, prdFloorId, prdFloorName, prdFloorIndex, template_id);
payload.endReached = payload.currentPage == payload.pageCount;
if (payload.currentPage > 1) {
... ... @@ -286,7 +330,7 @@ function reShuffleJumpList(jumplist, pageindex, pagesize) {
}
}
function exposeProductListData(json, order, channel, pageSize, tabId, tabName, prdFloorId, prdFloorName, prdFloorIndex) {
function exposeProductListData(json, order, channel, pageSize, tabId, tabName, prdFloorId, prdFloorName, prdFloorIndex, template_id) {
let res = json;
try {
let list = json ? json.product_list : [];
... ... @@ -314,7 +358,7 @@ function exposeProductListData(json, order, channel, pageSize, tabId, tabName, p
PRD_CHANNEL: prdChannel,
RECALL_TYPE: recallType,
PRD_TYPE: prdType,
CODE: template_id ? template_id: '',
F_NAME: prdFloorName,
F_INDEX: prdFloorIndex,
F_ID:prdFloorId,
... ...