Authored by 戴强

增加逛详情中点击商品详情的埋点.reviewedby sunkai

@@ -283,6 +283,7 @@ export default class Detail extends Component { @@ -283,6 +283,7 @@ export default class Detail extends Component {
283 {!isFetching?<Animated.View style={{flex: 1,top:this.state.viewMarginTop}}> 283 {!isFetching?<Animated.View style={{flex: 1,top:this.state.viewMarginTop}}>
284 <ListView 284 <ListView
285 ref={(ref)=>this.listView=ref} 285 ref={(ref)=>this.listView=ref}
  286 + yh_viewVisible = {true}//自动曝光开关
286 initialListSize={1} 287 initialListSize={1}
287 contentContainerStyle={styles.contentContainer} 288 contentContainerStyle={styles.contentContainer}
288 enableEmptySections={true} 289 enableEmptySections={true}
@@ -120,8 +120,7 @@ export default class GuangDetailProductCell extends Component { @@ -120,8 +120,7 @@ export default class GuangDetailProductCell extends Component {
120 render() { 120 render() {
121 let {data, sourceType, similarIndex, rowID} = this.props; 121 let {data, sourceType, similarIndex, rowID} = this.props;
122 let name = data.get('product_name') ? data.get('product_name') : ''; 122 let name = data.get('product_name') ? data.get('product_name') : '';
123 - let yh_exposureData = data.get('yh_exposureData', null);  
124 - 123 + let yh_exposureData = data.get('yh_exposureData', null).toJS();
125 let prd_id = data.get('product_id') ? data.get('product_id') : ''; 124 let prd_id = data.get('product_id') ? data.get('product_id') : '';
126 let isGlobal = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品 125 let isGlobal = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
127 let is_limitbuy = data.get('is_limitbuy') && data.get('is_limitbuy') == 'Y'; // product.is_limitbuy=='Y'?true:false; 126 let is_limitbuy = data.get('is_limitbuy') && data.get('is_limitbuy') == 'Y'; // product.is_limitbuy=='Y'?true:false;
@@ -44,8 +44,10 @@ export default class RecommentProducts extends React.Component { @@ -44,8 +44,10 @@ export default class RecommentProducts extends React.Component {
44 let price = '¥' + salePrice.toFixed(2); 44 let price = '¥' + salePrice.toFixed(2);
45 let product_id = rowData.get('product_id')?rowData.get('product_id'):0; 45 let product_id = rowData.get('product_id')?rowData.get('product_id'):0;
46 let rec_id = rowData.get('rec_id')?rowData.get('rec_id'):''; 46 let rec_id = rowData.get('rec_id')?rowData.get('rec_id'):'';
  47 + let yh_exposureData = rowData.get('yh_exposureData', null).toJS();
  48 +
47 return ( 49 return (
48 - <TouchableOpacity activeOpacity={0.5} onPress={() => { 50 + <TouchableOpacity activeOpacity={0.5} yh_exposureData={yh_exposureData} onPress={() => {
49 let pos_id = 104; 51 let pos_id = 104;
50 let params = { 52 let params = {
51 REC_POSE: 100023, 53 REC_POSE: 100023,
@@ -74,6 +74,8 @@ class DetailContainer extends Component { @@ -74,6 +74,8 @@ class DetailContainer extends Component {
74 this.props.actions.getWeChatAtten(); 74 this.props.actions.getWeChatAtten();
75 this.props.actions.getCommentsList(); 75 this.props.actions.getCommentsList();
76 this.props.actions.getPraiseForArtivle(); 76 this.props.actions.getPraiseForArtivle();
  77 +
  78 + NativeModules.YH_CommonHelper.logEvent('YB_STROLL_CONT', {});
77 } 79 }
78 80
79 componentWillUnmount() { 81 componentWillUnmount() {
@@ -4,6 +4,7 @@ import ReactNative from 'react-native'; @@ -4,6 +4,7 @@ import ReactNative from 'react-native';
4 import DetailService from '../../services/DetailService'; 4 import DetailService from '../../services/DetailService';
5 import md5 from 'md5'; 5 import md5 from 'md5';
6 import helper from '../../../common/utils/helper'; 6 import helper from '../../../common/utils/helper';
  7 +import {Platform} from 'react-native';
7 8
8 const { 9 const {
9 SET_ARTICLE_ID, 10 SET_ARTICLE_ID,
@@ -230,7 +231,7 @@ export function getArticleContent(reload = false) { @@ -230,7 +231,7 @@ export function getArticleContent(reload = false) {
230 dispatch(getArticleContentRequest()); 231 dispatch(getArticleContentRequest());
231 return new DetailService(app.serviceHost).getArticleContent(articleId) 232 return new DetailService(app.serviceHost).getArticleContent(articleId)
232 .then(json => { 233 .then(json => {
233 - let payload = parseArticleContent(json); 234 + let payload = parseArticleContent(json,articleId);
234 payload.map((item, i) => { 235 payload.map((item, i) => {
235 if (item.template_name == 'goods') { 236 if (item.template_name == 'goods') {
236 dispatch(goodsProductBySkns(item, i)); 237 dispatch(goodsProductBySkns(item, i));
@@ -250,7 +251,7 @@ export function getArticleContent(reload = false) { @@ -250,7 +251,7 @@ export function getArticleContent(reload = false) {
250 }; 251 };
251 } 252 }
252 253
253 -function parseArticleContent(json) { 254 +function parseArticleContent(json,articleId) {
254 let contents = []; 255 let contents = [];
255 json && json.map((item, i) => { 256 json && json.map((item, i) => {
256 for (let i in item) { 257 for (let i in item) {
@@ -292,6 +293,15 @@ function parseArticleContent(json) { @@ -292,6 +293,15 @@ function parseArticleContent(json) {
292 }else { 293 }else {
293 prod_ids = prod_ids + ',' + pro_id; 294 prod_ids = prod_ids + ',' + pro_id;
294 } 295 }
  296 + let param = {
  297 + P_NAME : Platform.OS === 'ios'?'iFP_GuangDetail':'aFP_GuangDetail',
  298 + P_PARAM : articleId,
  299 + I_INDEX : j,
  300 + PRD_SKN : pro.product_skn,
  301 + // C_ID:
  302 + exposureEnd : 1,
  303 + }
  304 + pro.yh_exposureData = param;
295 } 305 }
296 let params = { 306 let params = {
297 REC_POSE: 100023, 307 REC_POSE: 100023,
@@ -388,6 +398,7 @@ export function goodsProductBySkns(item, contentIndex) { @@ -388,6 +398,7 @@ export function goodsProductBySkns(item, contentIndex) {
388 } 398 }
389 399
390 let {app, detail} = getState(); 400 let {app, detail} = getState();
  401 + let {articleId} = detail;
391 402
392 dispatch(productBySknsRequest()); 403 dispatch(productBySknsRequest());
393 return new DetailService(app.host).productInfoBySkns(skns) 404 return new DetailService(app.host).productInfoBySkns(skns)
@@ -402,6 +413,15 @@ export function goodsProductBySkns(item, contentIndex) { @@ -402,6 +413,15 @@ export function goodsProductBySkns(item, contentIndex) {
402 item3.tags = []; 413 item3.tags = [];
403 } 414 }
404 item3.default_images = helper.image(item3.default_images, 235, 314); 415 item3.default_images = helper.image(item3.default_images, 235, 314);
  416 + let param = {
  417 + P_NAME : Platform.OS === 'ios'?'iFP_GuangDetail':'aFP_GuangDetail',
  418 + P_PARAM : articleId,
  419 + I_INDEX : i3,
  420 + PRD_SKN : item3.product_skn,
  421 + // C_ID:
  422 + exposureEnd : 1,
  423 + }
  424 + item3.yh_exposureData = param;
405 productList.push(item3); 425 productList.push(item3);
406 }); 426 });
407 dispatch(productBySknsSuccess({ 427 dispatch(productBySknsSuccess({
@@ -431,6 +451,7 @@ export function goodsGroupProductBySkns(item, contentIndex) { @@ -431,6 +451,7 @@ export function goodsGroupProductBySkns(item, contentIndex) {
431 } 451 }
432 452
433 let {app, detail} = getState(); 453 let {app, detail} = getState();
  454 + let {articleId} = detail;
434 455
435 dispatch(productBySknsRequest()); 456 dispatch(productBySknsRequest());
436 return new DetailService(app.host).productInfoBySkns(skns) 457 return new DetailService(app.host).productInfoBySkns(skns)
@@ -442,6 +463,17 @@ export function goodsGroupProductBySkns(item, contentIndex) { @@ -442,6 +463,17 @@ export function goodsGroupProductBySkns(item, contentIndex) {
442 } else { 463 } else {
443 item4.tags = []; 464 item4.tags = [];
444 } 465 }
  466 +
  467 + let param = {
  468 + P_NAME : Platform.OS === 'ios'?'iFP_GuangDetail':'aFP_GuangDetail',
  469 + P_PARAM : articleId,
  470 + // I_INDEX : i3,
  471 + PRD_SKN : item4.product_skn,
  472 + // C_ID:
  473 + exposureEnd : 1,
  474 + }
  475 + item4.yh_exposureData = param;
  476 +
445 item4.default_images = helper.image(item4.default_images, 235, 314); 477 item4.default_images = helper.image(item4.default_images, 235, 314);
446 }); 478 });
447 479
@@ -499,6 +531,7 @@ export function recommendProductBySkns(item, contentIndex) { @@ -499,6 +531,7 @@ export function recommendProductBySkns(item, contentIndex) {
499 } 531 }
500 532
501 let {app, detail} = getState(); 533 let {app, detail} = getState();
  534 + let {articleId} = detail;
502 535
503 dispatch(productBySknsRequest()); 536 dispatch(productBySknsRequest());
504 return new DetailService(app.host).productInfoBySkns(skns) 537 return new DetailService(app.host).productInfoBySkns(skns)
@@ -513,6 +546,17 @@ export function recommendProductBySkns(item, contentIndex) { @@ -513,6 +546,17 @@ export function recommendProductBySkns(item, contentIndex) {
513 } else { 546 } else {
514 item3.tags = []; 547 item3.tags = [];
515 } 548 }
  549 +
  550 + let param = {
  551 + P_NAME : Platform.OS === 'ios'?'iFP_GuangDetail':'aFP_GuangDetail',
  552 + P_PARAM : articleId,
  553 + I_INDEX : i3,
  554 + PRD_SKN : item3.product_skn,
  555 + // C_ID:
  556 + exposureEnd : 1,
  557 + }
  558 + item3.yh_exposureData = param;
  559 +
516 item3.default_images = helper.image(item3.default_images, 235, 314); 560 item3.default_images = helper.image(item3.default_images, 235, 314);
517 productList.push(item3); 561 productList.push(item3);
518 }); 562 });