Authored by 盖剑秋

Log event. reviewed by Boss Yin.

... ... @@ -38,7 +38,7 @@ export default class List extends Component {
}
break;
case 'list': {
return <ListCell resource={rowData} onPressDetail={this.props.onPressDetail}/>;
return <ListCell resource={rowData} onPressDetail={this.props.onPressDetail} index={rowID}/>;
}
break;
}
... ...
... ... @@ -70,7 +70,7 @@ export default class ListBannerSwiper extends React.Component {
key={i}
activeOpacity={1}
onPress={() => {
this.props.onPressBanner && this.props.onPressBanner(item.url);
this.props.onPressBanner && this.props.onPressBanner(item.url, i);
}}
>
<SlicedImage source={{uri: item.src}} style={{width, height}}/>
... ...
... ... @@ -37,7 +37,7 @@ export default class ListCell extends Component {
} = data;
default_images = default_images.replace('{width}', 240).replace('{height}', 320).replace('{mode}',2);
return (
<TouchableOpacity style={styles.container} onPress={() => {this.props.onPressDetail && this.props.onPressDetail(product_skn)}}>
<TouchableOpacity style={styles.container} onPress={() => {this.props.onPressDetail && this.props.onPressDetail(product_skn,this.props.index)}}>
<View style={styles.container}>
<Image style={styles.image} source={{uri:default_images}}/>
... ...
... ... @@ -68,6 +68,12 @@ class DetailContainer extends Component {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let param = {
PRD_SKN: product_skn,
AB_TYPE: 'A',
}
NativeModules.YH_CommonHelper.logEvent('YB_GOOD_GDS_VIEW_C', param);
}
_onPressTag(tag) {
... ...
... ... @@ -66,18 +66,32 @@ class ListContainer extends Component {
this.props.actions.getProductList(true);
}
_onPressDetail(product_skn) {
_onPressDetail(product_skn, index) {
if (!product_skn) {
return;
}
ReactNative.NativeModules.YH_CommonHelper.pushGoodGoodsRecommendDetailWithProductSKN(product_skn + '');
let param = {
I_INDEX: parseInt(index) + 1 + '',
PRD_SKN: product_skn,
AB_TYPE: 'A',
F_ID: 1002,
}
NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_FLR_C', logParam);
}
_onPressBanner(url) {
_onPressBanner(url, index) {
if (!url) {
return;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let param = {
I_INDEX: parseInt(index) + 1 + '',
F_URL: url,
AB_TYPE: 'A',
F_ID: 1002,
}
NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_FLR_C', logParam);
}
_onEndReached() {
... ...
'use strict';
import ReactNative from 'react-native';
import ReactNative, {
NativeModules,
} from 'react-native'
import DetailService from '../../services/DetailService';
import Immutable, {Map} from 'immutable';
... ... @@ -39,6 +41,11 @@ export function getDetail() {
return new DetailService(app.singleHost).getFavoriteStatusWithProductID(json.product_id)
.then(json => {
dispatch(setFavoriteStatus(json));
let param = {
PRD_SKN: product_skn,
AB_TYPE: 'A',
}
NativeModules.YH_CommonHelper.logEvent('YB_GOOD_GDS_DETAIL_L', param);
})
.catch(error => {
dispatch(setFavoriteStatus(false));
... ... @@ -61,6 +68,12 @@ export function changeFavoriteStatus(favorite) {
if (product_id && !favorite) {
new DetailService(app.host).addFavorite(product_id);
}
let param = {
PRD_SKN: detail.product_skn,
AB_TYPE: 'A',
COL_TYPE: favorite? '2': '1',
}
NativeModules.YH_CommonHelper.logEvent('YB_GOOD_GDS_COLLECT_C', param);
dispatch(setFavoriteStatus(!favorite));
}
ReactNative.NativeModules.YH_CommonHelper.uid()
... ...
'use strict';
import ReactNative from 'react-native';
import ReactNative, {
NativeModules,
} from 'react-native'
import ListService from '../../services/ListService';
import helper from '../../../common/utils/helper';
... ... @@ -27,7 +29,10 @@ export function getProductList(reload = false) {
dispatch(getProductListRequest());
return new ListService(app.host).getProductListData(channel, gender, uid, page, pageSize)
.then(json => {
let payload = parseProductList(json);
let payload = parseProductList(json, products.list.toJS()&&products.list.toJS().length);
NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_L', payload.logParam);
payload.endReached = payload.currentPage == payload.pageCount;
if (payload.currentPage > 1 && !reload) {
... ... @@ -61,17 +66,34 @@ export function getProductList(reload = false) {
};
}
function parseProductList(json) {
function parseProductList(json, count) {
let currentPage = json && json.page ? json.page : 1;
let pageCount = json && json.page_total ? json.page_total : 0;
let total = json && json.total ? json.total : 0;
let list = json && json.product_list ? json.product_list : [];
let logList = [];
for (var i = 0; i < list.length; i++) {
let item = list[i];
logList.push({
I_INDEX: count + i + 1,
PRD_SKN: item.product_skn,
})
}
let data = {
F_ID: 1002,
LIST: logList,
}
let logParam = {
AB_TYPE: 'A',
DATA:[data],
}
return {
list,
currentPage,
pageCount,
total,
logParam,
};
}
... ... @@ -106,6 +128,7 @@ export function fetchBanner() {
dispatch(fetchBannerRequest());
return new ListService(app.serviceHost).fetchBannerData()
.then(json => {
dispatch(logBanner(json));
dispatch(fetchBannerSuccess(json));
})
.catch(error => {
... ... @@ -114,6 +137,36 @@ export function fetchBanner() {
}
}
function logBanner(json) {
let bannerData = [];
if (json.data && josn.data.length()) {
let bannerDataArray = json.data;
if (bannerDataArray.length > 0) {
bannerData = bannerDataArray[0].data;
}
}
let logList = [];
for (var i = 0; i < bannerData.length; i++) {
let item = bannerData[i];
logList.push({
I_INDEX: i + 1,
F_URL: item.url,
})
}
let data = {
F_ID: 1001,
LIST: logList,
}
let logParam = {
AB_TYPE: 'A',
DATA:[data],
}
NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_L', logParam);
}
export function fetchBannerRequest() {
return {
type: FETCH_BANNER_REQUEST
... ...