Authored by QC-L

添加了新埋点,Review 传参代码 review by sunkai

... ... @@ -16,6 +16,7 @@ export default class EditorTalk extends Component {
constructor(props) {
super(props);
this._handleData = this._handleData.bind(this);
this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this);
}
shouldComponentUpdate(nextProps) {
... ... @@ -40,6 +41,18 @@ export default class EditorTalk extends Component {
}
}
_handleParamsJumpWithUrl(id, name, url) {
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let params = {
F_ID: id,
F_NAME: name,
F_URL: url
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'talk', params);
}
render() {
let { mainTitlelist, subTitlelist, contextlist, url } = this._handleData();
let image = this.props.image;
... ... @@ -53,12 +66,7 @@ export default class EditorTalk extends Component {
activeOpacity={1}
style={{width: width, height: sliderHeight}}
onPress={() => {
let params = {
F_ID: resource.get('template_id'),
F_NAME: resource.get('template_name'),
F_URL: url
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'talk', params);
this._handleParamsJumpWithUrl(resource.get('template_id'), resource.get('template_name'), url);
}}
>
<Image
... ...
... ... @@ -14,6 +14,7 @@ export default class ImageFour extends React.Component {
constructor(props) {
super(props);
this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this);
}
shouldComponentUpdate(nextProps) {
... ... @@ -24,6 +25,16 @@ export default class ImageFour extends React.Component {
}
}
_handleParamsJumpWithUrl(id, url) {
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let params = {
ID: id
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'icon', params);
}
render() {
let {resource} = this.props;
... ... @@ -51,10 +62,7 @@ export default class ImageFour extends React.Component {
// if (i === 2) {
// this.props.jumpWithUrl && this.props.jumpWithUrl('达人排行', 'talentRank');
// } else {
let params = {
ID: i + 1
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url, 'icon', params);
this._handleParamsJumpWithUrl(i + 1, item.url);
// }
// this.props.jumpWithUrl && this.props.jumpWithUrl('商品详情', 'shareDetail');
... ...
... ... @@ -14,6 +14,7 @@ export default class ImageSingle extends React.Component {
constructor(props) {
super(props);
this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this);
}
shouldComponentUpdate(nextProps) {
... ... @@ -24,6 +25,23 @@ export default class ImageSingle extends React.Component {
}
}
_handleParamsJumpWithUrl(id, name, url) {
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let params = {
F_ID: id,
F_NAME: name,
F_URL: url
};
if (this.props.messageResourceInfo) {
params = {
ID: id,
};
}
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'one', params);
}
render() {
let {resource} = this.props;
... ... @@ -46,17 +64,7 @@ export default class ImageSingle extends React.Component {
yh_exposureData={list[0].yh_exposureData}
style={[{width: sliderWidth, height: sliderHeight},this.props.style]}
onPress={() => {
let params = {
F_ID: resource.get('template_id'),
F_NAME: resource.get('template_name'),
F_URL: list[0].url
};
if (this.props.messageResourceInfo) {
params = {
ID: resource.get('template_id'),
};
}
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(list[0].url, 'one', params);
this._handleParamsJumpWithUrl(resource.get('template_id'), resource.get('template_name'), list[0].url);
}}
>
<YH_Image
... ...
... ... @@ -19,6 +19,7 @@ export default class ImageSlider extends React.Component {
constructor(props) {
super(props);
this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this);
}
shouldComponentUpdate(nextProps) {
... ... @@ -31,6 +32,17 @@ export default class ImageSlider extends React.Component {
}
}
_handleParamsJumpWithUrl(index, url) {
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let params = {
I_INDEX: index,
F_URL: url
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'banner', params);
}
render() {
let {resource, sliderWidth, sliderHeight} = this.props;
... ... @@ -47,7 +59,7 @@ export default class ImageSlider extends React.Component {
yh_exposureData={data[0].yh_exposureData}
style={{width: sliderWidth, height: sliderHeight}}
onPress={() => {
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(data[0].url);
this._handleParamsJumpWithUrl(1, data[0].url)
}}
>
<YH_Image
... ... @@ -83,7 +95,7 @@ export default class ImageSlider extends React.Component {
activeOpacity={1}
yh_exposureData={item.yh_exposureData}
onPress={() => {
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url);
this._handleParamsJumpWithUrl(i + 1, item.url);
}}
>
<YH_Image
... ...
... ... @@ -15,6 +15,7 @@ export default class ImageTwo extends React.Component {
constructor(props) {
super(props);
this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this);
}
shouldComponentUpdate(nextProps) {
... ... @@ -25,6 +26,19 @@ export default class ImageTwo extends React.Component {
}
}
_handleParamsJumpWithUrl(id, name, url, i_index) {
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let params = {
F_ID: id,
F_NAME: name,
F_URL: url,
I_INDEX: i_index
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'two', params);
}
render() {
let {resource} = this.props;
... ... @@ -52,13 +66,7 @@ export default class ImageTwo extends React.Component {
yh_exposureData={item.yh_exposureData}
style={{width: sliderWidth, height: sliderHeight, marginRight:15}}
onPress={() => {
let params = {
F_ID: resource.get('template_id'),
F_NAME: resource.get('template_name'),
F_URL: item.url,
I_INDEX: i + 1
};
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url, 'two', params);
this._handleParamsJumpWithUrl(resource.get('template_id'), resource.get('template_name'), item.url, i + 1);
}}
>
<YH_Image
... ...
... ... @@ -114,10 +114,12 @@ class HomeContainer extends Component {
if (!url) {
return;
}
if (type && type !== 'icon' && params) {
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ACTIVITY_C', params);
} else if (type === 'icon' && params) {
if (type === 'icon' && params) {
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ICON_C', params);
} else if (type === 'banner' && params) {
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_BANNER_C', params);
} else if (type && params) {
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ACTIVITY_C', params);
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
... ... @@ -153,9 +155,6 @@ class HomeContainer extends Component {
productPool,
skns,
} = this.props.app;
console.log(data.get('sort_id'));
console.log('------->Skns')
console.log(skns);
this.props.actions.setAppSelectedCategory(productPool, skns, data.get('sort_id'), data.get('sort_name'), index);
let params = {
... ...