添加了新埋点,Review 传参代码 review by sunkai
Showing
6 changed files
with
79 additions
and
36 deletions
@@ -16,6 +16,7 @@ export default class EditorTalk extends Component { | @@ -16,6 +16,7 @@ export default class EditorTalk extends Component { | ||
16 | constructor(props) { | 16 | constructor(props) { |
17 | super(props); | 17 | super(props); |
18 | this._handleData = this._handleData.bind(this); | 18 | this._handleData = this._handleData.bind(this); |
19 | + this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this); | ||
19 | } | 20 | } |
20 | 21 | ||
21 | shouldComponentUpdate(nextProps) { | 22 | shouldComponentUpdate(nextProps) { |
@@ -40,6 +41,18 @@ export default class EditorTalk extends Component { | @@ -40,6 +41,18 @@ export default class EditorTalk extends Component { | ||
40 | } | 41 | } |
41 | } | 42 | } |
42 | 43 | ||
44 | + _handleParamsJumpWithUrl(id, name, url) { | ||
45 | + // 为埋点提供参数组装 | ||
46 | + // 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件 | ||
47 | + // 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行 | ||
48 | + let params = { | ||
49 | + F_ID: id, | ||
50 | + F_NAME: name, | ||
51 | + F_URL: url | ||
52 | + }; | ||
53 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'talk', params); | ||
54 | + } | ||
55 | + | ||
43 | render() { | 56 | render() { |
44 | let { mainTitlelist, subTitlelist, contextlist, url } = this._handleData(); | 57 | let { mainTitlelist, subTitlelist, contextlist, url } = this._handleData(); |
45 | let image = this.props.image; | 58 | let image = this.props.image; |
@@ -53,12 +66,7 @@ export default class EditorTalk extends Component { | @@ -53,12 +66,7 @@ export default class EditorTalk extends Component { | ||
53 | activeOpacity={1} | 66 | activeOpacity={1} |
54 | style={{width: width, height: sliderHeight}} | 67 | style={{width: width, height: sliderHeight}} |
55 | onPress={() => { | 68 | onPress={() => { |
56 | - let params = { | ||
57 | - F_ID: resource.get('template_id'), | ||
58 | - F_NAME: resource.get('template_name'), | ||
59 | - F_URL: url | ||
60 | - }; | ||
61 | - this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'talk', params); | 69 | + this._handleParamsJumpWithUrl(resource.get('template_id'), resource.get('template_name'), url); |
62 | }} | 70 | }} |
63 | > | 71 | > |
64 | <Image | 72 | <Image |
@@ -14,6 +14,7 @@ export default class ImageFour extends React.Component { | @@ -14,6 +14,7 @@ export default class ImageFour extends React.Component { | ||
14 | 14 | ||
15 | constructor(props) { | 15 | constructor(props) { |
16 | super(props); | 16 | super(props); |
17 | + this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this); | ||
17 | } | 18 | } |
18 | 19 | ||
19 | shouldComponentUpdate(nextProps) { | 20 | shouldComponentUpdate(nextProps) { |
@@ -24,6 +25,16 @@ export default class ImageFour extends React.Component { | @@ -24,6 +25,16 @@ export default class ImageFour extends React.Component { | ||
24 | } | 25 | } |
25 | } | 26 | } |
26 | 27 | ||
28 | + _handleParamsJumpWithUrl(id, url) { | ||
29 | + // 为埋点提供参数组装 | ||
30 | + // 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件 | ||
31 | + // 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行 | ||
32 | + let params = { | ||
33 | + ID: id | ||
34 | + }; | ||
35 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'icon', params); | ||
36 | + } | ||
37 | + | ||
27 | render() { | 38 | render() { |
28 | let {resource} = this.props; | 39 | let {resource} = this.props; |
29 | 40 | ||
@@ -51,10 +62,7 @@ export default class ImageFour extends React.Component { | @@ -51,10 +62,7 @@ export default class ImageFour extends React.Component { | ||
51 | // if (i === 2) { | 62 | // if (i === 2) { |
52 | // this.props.jumpWithUrl && this.props.jumpWithUrl('达人排行', 'talentRank'); | 63 | // this.props.jumpWithUrl && this.props.jumpWithUrl('达人排行', 'talentRank'); |
53 | // } else { | 64 | // } else { |
54 | - let params = { | ||
55 | - ID: i + 1 | ||
56 | - }; | ||
57 | - this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url, 'icon', params); | 65 | + this._handleParamsJumpWithUrl(i + 1, item.url); |
58 | 66 | ||
59 | // } | 67 | // } |
60 | // this.props.jumpWithUrl && this.props.jumpWithUrl('商品详情', 'shareDetail'); | 68 | // this.props.jumpWithUrl && this.props.jumpWithUrl('商品详情', 'shareDetail'); |
@@ -14,6 +14,7 @@ export default class ImageSingle extends React.Component { | @@ -14,6 +14,7 @@ export default class ImageSingle extends React.Component { | ||
14 | 14 | ||
15 | constructor(props) { | 15 | constructor(props) { |
16 | super(props); | 16 | super(props); |
17 | + this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this); | ||
17 | } | 18 | } |
18 | 19 | ||
19 | shouldComponentUpdate(nextProps) { | 20 | shouldComponentUpdate(nextProps) { |
@@ -24,6 +25,23 @@ export default class ImageSingle extends React.Component { | @@ -24,6 +25,23 @@ export default class ImageSingle extends React.Component { | ||
24 | } | 25 | } |
25 | } | 26 | } |
26 | 27 | ||
28 | + _handleParamsJumpWithUrl(id, name, url) { | ||
29 | + // 为埋点提供参数组装 | ||
30 | + // 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件 | ||
31 | + // 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行 | ||
32 | + let params = { | ||
33 | + F_ID: id, | ||
34 | + F_NAME: name, | ||
35 | + F_URL: url | ||
36 | + }; | ||
37 | + if (this.props.messageResourceInfo) { | ||
38 | + params = { | ||
39 | + ID: id, | ||
40 | + }; | ||
41 | + } | ||
42 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'one', params); | ||
43 | + } | ||
44 | + | ||
27 | render() { | 45 | render() { |
28 | 46 | ||
29 | let {resource} = this.props; | 47 | let {resource} = this.props; |
@@ -46,17 +64,7 @@ export default class ImageSingle extends React.Component { | @@ -46,17 +64,7 @@ export default class ImageSingle extends React.Component { | ||
46 | yh_exposureData={list[0].yh_exposureData} | 64 | yh_exposureData={list[0].yh_exposureData} |
47 | style={[{width: sliderWidth, height: sliderHeight},this.props.style]} | 65 | style={[{width: sliderWidth, height: sliderHeight},this.props.style]} |
48 | onPress={() => { | 66 | onPress={() => { |
49 | - let params = { | ||
50 | - F_ID: resource.get('template_id'), | ||
51 | - F_NAME: resource.get('template_name'), | ||
52 | - F_URL: list[0].url | ||
53 | - }; | ||
54 | - if (this.props.messageResourceInfo) { | ||
55 | - params = { | ||
56 | - ID: resource.get('template_id'), | ||
57 | - }; | ||
58 | - } | ||
59 | - this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(list[0].url, 'one', params); | 67 | + this._handleParamsJumpWithUrl(resource.get('template_id'), resource.get('template_name'), list[0].url); |
60 | }} | 68 | }} |
61 | > | 69 | > |
62 | <YH_Image | 70 | <YH_Image |
@@ -19,6 +19,7 @@ export default class ImageSlider extends React.Component { | @@ -19,6 +19,7 @@ export default class ImageSlider extends React.Component { | ||
19 | 19 | ||
20 | constructor(props) { | 20 | constructor(props) { |
21 | super(props); | 21 | super(props); |
22 | + this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this); | ||
22 | } | 23 | } |
23 | 24 | ||
24 | shouldComponentUpdate(nextProps) { | 25 | shouldComponentUpdate(nextProps) { |
@@ -31,6 +32,17 @@ export default class ImageSlider extends React.Component { | @@ -31,6 +32,17 @@ export default class ImageSlider extends React.Component { | ||
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
35 | + _handleParamsJumpWithUrl(index, url) { | ||
36 | + // 为埋点提供参数组装 | ||
37 | + // 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件 | ||
38 | + // 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行 | ||
39 | + let params = { | ||
40 | + I_INDEX: index, | ||
41 | + F_URL: url | ||
42 | + }; | ||
43 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'banner', params); | ||
44 | + } | ||
45 | + | ||
34 | render() { | 46 | render() { |
35 | 47 | ||
36 | let {resource, sliderWidth, sliderHeight} = this.props; | 48 | let {resource, sliderWidth, sliderHeight} = this.props; |
@@ -47,7 +59,7 @@ export default class ImageSlider extends React.Component { | @@ -47,7 +59,7 @@ export default class ImageSlider extends React.Component { | ||
47 | yh_exposureData={data[0].yh_exposureData} | 59 | yh_exposureData={data[0].yh_exposureData} |
48 | style={{width: sliderWidth, height: sliderHeight}} | 60 | style={{width: sliderWidth, height: sliderHeight}} |
49 | onPress={() => { | 61 | onPress={() => { |
50 | - this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(data[0].url); | 62 | + this._handleParamsJumpWithUrl(1, data[0].url) |
51 | }} | 63 | }} |
52 | > | 64 | > |
53 | <YH_Image | 65 | <YH_Image |
@@ -83,7 +95,7 @@ export default class ImageSlider extends React.Component { | @@ -83,7 +95,7 @@ export default class ImageSlider extends React.Component { | ||
83 | activeOpacity={1} | 95 | activeOpacity={1} |
84 | yh_exposureData={item.yh_exposureData} | 96 | yh_exposureData={item.yh_exposureData} |
85 | onPress={() => { | 97 | onPress={() => { |
86 | - this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url); | 98 | + this._handleParamsJumpWithUrl(i + 1, item.url); |
87 | }} | 99 | }} |
88 | > | 100 | > |
89 | <YH_Image | 101 | <YH_Image |
@@ -15,6 +15,7 @@ export default class ImageTwo extends React.Component { | @@ -15,6 +15,7 @@ export default class ImageTwo extends React.Component { | ||
15 | 15 | ||
16 | constructor(props) { | 16 | constructor(props) { |
17 | super(props); | 17 | super(props); |
18 | + this._handleParamsJumpWithUrl = this._handleParamsJumpWithUrl.bind(this); | ||
18 | } | 19 | } |
19 | 20 | ||
20 | shouldComponentUpdate(nextProps) { | 21 | shouldComponentUpdate(nextProps) { |
@@ -25,6 +26,19 @@ export default class ImageTwo extends React.Component { | @@ -25,6 +26,19 @@ export default class ImageTwo extends React.Component { | ||
25 | } | 26 | } |
26 | } | 27 | } |
27 | 28 | ||
29 | + _handleParamsJumpWithUrl(id, name, url, i_index) { | ||
30 | + // 为埋点提供参数组装 | ||
31 | + // 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件 | ||
32 | + // 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行 | ||
33 | + let params = { | ||
34 | + F_ID: id, | ||
35 | + F_NAME: name, | ||
36 | + F_URL: url, | ||
37 | + I_INDEX: i_index | ||
38 | + }; | ||
39 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url, 'two', params); | ||
40 | + } | ||
41 | + | ||
28 | render() { | 42 | render() { |
29 | let {resource} = this.props; | 43 | let {resource} = this.props; |
30 | 44 | ||
@@ -52,13 +66,7 @@ export default class ImageTwo extends React.Component { | @@ -52,13 +66,7 @@ export default class ImageTwo extends React.Component { | ||
52 | yh_exposureData={item.yh_exposureData} | 66 | yh_exposureData={item.yh_exposureData} |
53 | style={{width: sliderWidth, height: sliderHeight, marginRight:15}} | 67 | style={{width: sliderWidth, height: sliderHeight, marginRight:15}} |
54 | onPress={() => { | 68 | onPress={() => { |
55 | - let params = { | ||
56 | - F_ID: resource.get('template_id'), | ||
57 | - F_NAME: resource.get('template_name'), | ||
58 | - F_URL: item.url, | ||
59 | - I_INDEX: i + 1 | ||
60 | - }; | ||
61 | - this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url, 'two', params); | 69 | + this._handleParamsJumpWithUrl(resource.get('template_id'), resource.get('template_name'), item.url, i + 1); |
62 | }} | 70 | }} |
63 | > | 71 | > |
64 | <YH_Image | 72 | <YH_Image |
@@ -114,10 +114,12 @@ class HomeContainer extends Component { | @@ -114,10 +114,12 @@ class HomeContainer extends Component { | ||
114 | if (!url) { | 114 | if (!url) { |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | - if (type && type !== 'icon' && params) { | ||
118 | - ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ACTIVITY_C', params); | ||
119 | - } else if (type === 'icon' && params) { | 117 | + if (type === 'icon' && params) { |
120 | ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ICON_C', params); | 118 | ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ICON_C', params); |
119 | + } else if (type === 'banner' && params) { | ||
120 | + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_BANNER_C', params); | ||
121 | + } else if (type && params) { | ||
122 | + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_ACTIVITY_C', params); | ||
121 | } | 123 | } |
122 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 124 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
123 | } | 125 | } |
@@ -153,9 +155,6 @@ class HomeContainer extends Component { | @@ -153,9 +155,6 @@ class HomeContainer extends Component { | ||
153 | productPool, | 155 | productPool, |
154 | skns, | 156 | skns, |
155 | } = this.props.app; | 157 | } = this.props.app; |
156 | - console.log(data.get('sort_id')); | ||
157 | - console.log('------->Skns') | ||
158 | - console.log(skns); | ||
159 | this.props.actions.setAppSelectedCategory(productPool, skns, data.get('sort_id'), data.get('sort_name'), index); | 158 | this.props.actions.setAppSelectedCategory(productPool, skns, data.get('sort_id'), data.get('sort_name'), index); |
160 | 159 | ||
161 | let params = { | 160 | let params = { |
-
Please register or login to post a comment