Authored by 于良

领券中心增加埋点 review by 盖剑秋

... ... @@ -69,7 +69,7 @@ export default class Banner extends React.Component {
<TouchableOpacity
activeOpacity={1}
onPress={() => {
this.props.onPress && this.props.onPress(item.get('url'));
this.props.onPress && this.props.onPress(item.get('url'), 0);
}}
>
<SlicedImage source={{uri: item.get('src')}} style={{width, height}}/>
... ... @@ -94,7 +94,7 @@ export default class Banner extends React.Component {
key={i}
activeOpacity={1}
onPress={() => {
this.props.onPress && this.props.onPress(item.get('url'));
this.props.onPress && this.props.onPress(item.get('url'), i);
}}
>
<SlicedImage source={{uri: item.get('src')}} style={{width, height}}/>
... ...
... ... @@ -24,6 +24,7 @@ import CouponCenterContainer from './containers/CouponCenterContainer';
import {
setPlatform,
setChannel,
} from './reducers/app/appActions';
import {
... ... @@ -46,6 +47,8 @@ export default function native(platform) {
render() {
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
let channel = this.props.channel;
channel && store.dispatch(setChannel(channel));
if(this.props.contentCode){
store.dispatch(setContentCode(this.props.contentCode));
}
... ...
... ... @@ -31,7 +31,9 @@ export default class CouponCenter extends Component {
_renderRow(rowData: object, sectionID: number, rowID: number) {
let data = rowData.get('data');
switch (rowData.get('templateName')) {
let templateId = rowData.get('templateId');
let templateName = rowData.get('templateName');
switch (templateName) {
case 'carousel_banner':
case 'focus':
return (
... ... @@ -39,7 +41,10 @@ export default class CouponCenter extends Component {
data={data}
width={width}
height={bannerHeight}
onPress={this.props.onPressBanner}
onPress={(item, index) => {
this.props.onPressBanner
&& this.props.onPressBanner(item, index, rowID, templateId, templateName);
}}
/>
);
case 'text':
... ... @@ -52,7 +57,8 @@ export default class CouponCenter extends Component {
<TouchableOpacity
activeOpacity={0.8}
onPress={() => {
this.props.onPressImage && this.props.onPressImage(data.get('url'));
this.props.onPressImage
&& this.props.onPressImage(data.get('url'), 0, rowID, templateId, templateName);
}}
>
<AutoSizeImage src={src}/>
... ... @@ -87,7 +93,8 @@ export default class CouponCenter extends Component {
style={styles.couponLeft}
activeOpacity={0.8}
onPress={() => {
this.props.onPressCoupon && this.props.onPressCoupon(data.get('image').get('url'));
this.props.onPressCoupon
&& this.props.onPressCoupon(data.get('image').get('url'), 0, rowID, templateId, templateName);
}}
>
</TouchableOpacity>
... ... @@ -98,7 +105,8 @@ export default class CouponCenter extends Component {
if (data.get('status') == 1) {
this.props.onGetCoupon && this.props.onGetCoupon(data.get('couponID'));
} else {
this.props.onPressCoupon && this.props.onPressCoupon(data.get('image').get('url'));
this.props.onPressCoupon
&& this.props.onPressCoupon(data.get('image').get('url'), 0, rowID, templateId, templateName);
}
}}
>
... ...
... ... @@ -3,7 +3,8 @@ import keyMirror from 'key-mirror';
export default keyMirror({
SET_PLATFORM: null,
SET_HOST:null,
SET_HOST: null,
SET_CHANNEL: null,
SET_CONTENT_CODE: null,
COUPON_CENTER_REQUEST: null,
... ...
... ... @@ -50,6 +50,7 @@ class CouponCenterContainer extends Component {
this._onGetCoupon = this._onGetCoupon.bind(this);
this._onPromptHidden = this._onPromptHidden.bind(this);
this._onNetPromptHidden = this._onNetPromptHidden.bind(this);
this.logEvent = this.logEvent.bind(this);
// this.subscription = NativeAppEventEmitter.addListener(
// 'UserDidLoginEvent',
... ... @@ -67,16 +68,35 @@ class CouponCenterContainer extends Component {
// this.subscription && this.subscription.remove();
}
_onPressBanner(url) {
_onPressBanner(url, index=0, floorIndex=0, templateId='', templateName='') {
this.props.actions.jumpWithUrl(url);
this.logEvent(templateId, templateName, url, floorIndex, index);
}
_onPressImage(url) {
_onPressImage(url, index=0, floorIndex=0, templateId='', templateName='') {
this.props.actions.jumpWithUrl(url);
this.logEvent(templateId, templateName, url, floorIndex, index);
}
_onPressCoupon(url) {
_onPressCoupon(url, index=0, floorIndex=0, templateId='', templateName='') {
this.props.actions.jumpWithUrl(url);
this.logEvent(templateId, templateName, url, floorIndex, index);
}
logEvent(templateId, templateName, url, floorIndex, index) {
let channel = this.props.app.channel;
let params = {
C_I: channel,
F_ID: templateId,
F_NAME: templateName,
F_URL: url,
F_INDEX: (parseInt(floorIndex) + 1) + '',
I_INDEX: (parseInt(index) + 1) + '',
};
NativeModules.YH_CommonHelper.logEvent('YB_LEADING_CENTER_FLR_C', params);
}
_onGetCoupon(couponID) {
... ...
... ... @@ -152,6 +152,11 @@ function parseFloors(json) {
templateName = item.templateName;
}
let templateId = item.template_id;
if (!templateId) {
templateId = item.templateId;
}
let data;
if (templateName == 'carousel_banner') {
data = carousel_banner(item.data);
... ... @@ -175,6 +180,7 @@ function parseFloors(json) {
let floor = {
data,
templateName,
templateId,
};
floors.push(floor);
});
... ...
... ... @@ -14,7 +14,7 @@
"moment": "^2.13.0",
"object-assign": "^4.1.0",
"query-string": "^4.2.2",
"react": "^15.3.1",
"react": "15.3.1",
"react-immutable-proptypes": "^2.1.0",
"react-native": "0.32.0",
"react-native-device-info": "0.9.5",
... ...