Authored by 孙凯

add 店铺 曝光 review by zhanglixia

... ... @@ -168,43 +168,93 @@ export default class BrandStore extends Component {
/>
);
} else if (sectionID == 'brandReource') {
let pageName = 'iFP_BrandStore';
if (Platform.OS === 'android') {
pageName = 'aFP_BrandStore';
}
switch (rowID) {
case '0': {
let params = {
P_NAME : pageName,
F_ID : rowID,
TAB_NAM : '首页',
TAB_ID : 0,
F_NAME : 'coupon',
exposureEnd : 1,
};
return(
<CouponCell
yh_exposureData={params}
resource={rowData}
onPressCoupon={this.props.onPressCoupon}
/>
);
}
case '1': {
let params = {
P_NAME : pageName,
F_ID : rowID,
TAB_NAM : '首页',
TAB_ID : 0,
F_NAME : 'brandBrowse',
exposureEnd : 1,
};
return (
<BrandListCell
yh_exposureData={params}
resource={rowData}
onPressBrandItem={this.props.onPressBrandItem}
/>
);
}
case '2': {
let params = {
P_NAME : pageName,
F_ID : rowID,
TAB_NAM : '首页',
TAB_ID : 0,
F_NAME : 'largeSlideImg_APP',
exposureEnd : 1,
};
return (
<BrandSwiper
yh_exposureData={params}
resource={rowData}
onPressSlideItem={this.props.onPressSlideItem}
/>
);
}
case '3': {
let params = {
P_NAME : pageName,
F_ID : rowID,
TAB_NAM : '首页',
TAB_ID : 0,
F_NAME : 'oneRowTwoColImages_APP',
exposureEnd : 1,
};
return (
<OneRowTwoColImages
yh_exposureData={params}
resource={rowData}
onPressOneRowTwoColImages={this.props.onPressOneRowTwoColImages}
/>
);
}
case '4': {
let params = {
P_NAME : pageName,
F_ID : rowID,
TAB_NAM : '首页',
TAB_ID : 0,
F_NAME : 'recommend_APP',
exposureEnd : 1,
};
return (
<Recommend
yh_exposureData={params}
resource={rowData}
onPressRecommendItem={this.props.onPressRecommendItem}
/>
... ... @@ -229,9 +279,9 @@ export default class BrandStore extends Component {
} else if (sectionID == 'storeFilter') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
&& rowID != this.props.similarIndex;
return (
<BrandProductListCell
... ... @@ -249,10 +299,11 @@ export default class BrandStore extends Component {
} else if (sectionID == 'productList') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
let showSimilarGuider = this.props.showSimilarGuider
&& this.state.scrollEnd
&& rowID == this.state.selectedVisibleIndex
&& rowID != this.props.similarIndex;
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
... ... @@ -284,7 +335,7 @@ export default class BrandStore extends Component {
let rowIndexs = Object.keys(visibleRows[targetSection]);
if (rowIndexs.length > 0) {
selectedIndex = rowIndexs[0];
}
}
if (rowIndexs.length > 3) {
selectedIndex = rowIndexs[2];
}
... ... @@ -294,7 +345,7 @@ export default class BrandStore extends Component {
let rowIndexs = Object.keys(visibleRows[targetSection2]);
if (rowIndexs.length > 0) {
selectedIndex = rowIndexs[0];
}
}
if (rowIndexs.length > 3) {
selectedIndex = rowIndexs[2];
}
... ... @@ -370,6 +421,7 @@ export default class BrandStore extends Component {
<View style={styles.container}>
<ListView
ref='brandStoreList'
yh_viewVisible = {true}
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
... ...
... ... @@ -37,8 +37,16 @@ export default class BrandListCell extends React.Component {
}
renderRow(rowData,sectionID,rowID,highlightRow) {
let yh_exposureData = this.props.yh_exposureData?this.props.yh_exposureData:null;
if (yh_exposureData) {
yh_exposureData = {
I_INDEX: rowID,
...yh_exposureData,
}
}
return (
<TouchableOpacity activeOpacity={0.5} onPress={() => {
<TouchableOpacity activeOpacity={0.5} yh_exposureData={yh_exposureData} onPress={() => {
this.props.onPressBrandItem && this.props.onPressBrandItem(rowData.url, rowID);
}}>
<View style={styles.row}>
... ...
... ... @@ -64,9 +64,19 @@ export default class BrandSwiper extends React.Component {
let data = this.props.resource.toJS();
let yh_exposureData = this.props.yh_exposureData?this.props.yh_exposureData:null;
if (data.length == 1) {
if (yh_exposureData) {
yh_exposureData = {
I_INDEX: 1,
...yh_exposureData,
}
}
return (
<TouchableOpacity
yh_exposureData={yh_exposureData}
activeOpacity={1}
style={{width: width, height: swiperHeight}}
onPress={() => {
... ... @@ -94,8 +104,15 @@ export default class BrandSwiper extends React.Component {
height={swiperHeight}
>
{data.map((item, i) => {
if (yh_exposureData) {
yh_exposureData = {
I_INDEX: i,
...yh_exposureData,
}
}
return (
<TouchableOpacity
yh_exposureData={yh_exposureData}
key={i}
activeOpacity={1}
onPress={() => {
... ...
... ... @@ -39,6 +39,7 @@ export default class CouponCell extends React.Component {
renderRow(rowData,sectionID,rowID,highlightRow) {
let data = this.props.resource.toJS();
let yh_exposureData = this.props.yh_exposureData?this.props.yh_exposureData:null;
let backgroundImage;
let backImage;
... ... @@ -52,6 +53,12 @@ export default class CouponCell extends React.Component {
let statesTitleStyle;
let states;
let statesTitle = rowData.status ? '立即领取':'已领取';
if (yh_exposureData) {
yh_exposureData = {
I_INDEX: rowID,
...yh_exposureData,
}
}
if (data.list.length == 1) {
backgroundImage = require('../../../../image/coupons_s_r.png');
... ... @@ -80,7 +87,7 @@ export default class CouponCell extends React.Component {
}
return (
<TouchableOpacity activeOpacity={0.5} onPress={() => {
<TouchableOpacity activeOpacity={0.5} yh_exposureData={yh_exposureData} onPress={() => {
this.props.onPressCoupon && this.props.onPressCoupon(rowData,data.resourceId,rowID);
}}>
<View style={[styles.row,backImage]}>
... ... @@ -116,6 +123,7 @@ export default class CouponCell extends React.Component {
render() {
let data = this.props.resource.toJS();
let yh_exposureData = data.yh_exposureData;
if (!data.list || data.list.length == 0) {
return null;
... ...
... ... @@ -34,9 +34,25 @@ export default class OneRowTwoColImages extends React.Component {
}
let data = this.props.resource.toJS();
let yh_exposureData = this.props.yh_exposureData?this.props.yh_exposureData:null;
let yh_exposureData0 = null;
let yh_exposureData1 = null;
if (yh_exposureData) {
yh_exposureData0 = {
I_INDEX: 0,
...yh_exposureData,
};
yh_exposureData1 = {
I_INDEX: 1,
...yh_exposureData,
};
}
return (
<View style={styles.viewStyle}>
<TouchableOpacity onPress={() => {this.props.onPressOneRowTwoColImages(data[0].url, 0, data[0].resourceId)}} >
<TouchableOpacity yh_exposureData={yh_exposureData0} onPress={() => {this.props.onPressOneRowTwoColImages(data[0].url, 0, data[0].resourceId)}} >
<Image
source={{uri: data[0].src}}
style={styles.thumbnail}
... ... @@ -44,7 +60,7 @@ export default class OneRowTwoColImages extends React.Component {
></Image>
</TouchableOpacity>
<TouchableOpacity onPress={() => {this.props.onPressOneRowTwoColImages(data[1].url, 1, data[0].resourceId)}} >
<TouchableOpacity yh_exposureData={yh_exposureData1} onPress={() => {this.props.onPressOneRowTwoColImages(data[1].url, 1, data[0].resourceId)}} >
<Image
source={{uri: data[1].src}}
style={styles.thumbnail}
... ...
... ... @@ -39,8 +39,17 @@ export default class Recommend extends React.Component {
}
renderRow(rowData, sectionID, rowID, highlightRow) {
let yh_exposureData = this.props.yh_exposureData?this.props.yh_exposureData:null;
if (yh_exposureData) {
yh_exposureData = {
I_INDEX: rowID,
...yh_exposureData,
};
}
return (
<TouchableOpacity activeOpacity={0.5} onPress={() => {
<TouchableOpacity yh_exposureData={yh_exposureData} activeOpacity={0.5} onPress={() => {
this.props.onPressRecommendItem && this.props.onPressRecommendItem(rowData.get('url'), rowID);
}}>
<View style={styles.rowContainer}>
... ...
'use strict';
import ReactNative from 'react-native';
import ReactNative, {
Platform,
} from 'react-native';
import BrandStoreService from '../../services/BrandStoreService';
import * as _ from 'lodash';
import {parseShopResources} from '../../utils/ResourceParser';
... ... @@ -445,6 +447,15 @@ export function getHotProduct() {
json.product_list[key].tags[0] = 'is_hot';
});
let payload = json.product_list;
let order = '';
try {
payload = exposePruductListData(payload,order,app.channel,0);
} catch (e) {
} finally {
}
dispatch(hotProductSuccess(payload));
// 数据曝光
... ... @@ -567,7 +578,7 @@ export function getProductList(reload=false) {
dispatch(productListRequest());
return new BrandStoreService(app.host).productList(shopId, channel, order, page, pageSize, allFilterFactors,brandId)
.then(json => {
let payload = parseProductList(json);
let payload = parseProductList(json,order,app.channel,0);
payload.endReached = payload.currentPage == payload.pageCount || payload.list.length < pageSize;
// 数据曝光 新格式
... ... @@ -643,13 +654,21 @@ function randomString(len) {
  return pwd;
}
function parseProductList(json) {
function parseProductList(json,order,channel,index) {
let list = json && json.product_list ? json.product_list : [];
try {
list = exposePruductListData(list,order,channel,index);
} catch (e) {
} finally {
}
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 filter = json && json.filter ? json.filter : {};
let list = json && json.product_list ? json.product_list : [];
let filterCategoryDetailFilterList = {};
let categoryFilterList = [];
... ... @@ -838,6 +857,73 @@ function parseProductList(json) {
}
function exposePruductListData(list,order,channel,index) {
if (!list) {
return list;
}
let tab_name = '默认';
let tab_num = 0;
if (order == 's_t_desc') {
tab_name = '最新';
tab_num = 0;
}
if (order == 's_p_asc' || order == 's_p_desc') {
tab_name = '价格';
tab_num = 1;
}
if (order == 'p_d_asc' || order == 'p_d_desc') {
tab_name = '折扣';
tab_num = 2;
}
let pageName = 'iFP_BrandStore';
if (Platform.OS === 'android') {
pageName = 'aFP_BrandStore';
}
let channelStr = 'boy';
if (channel == '1') {
channelStr = 'boy';
}else if (channel == '2') {
channelStr = 'girl';
}else if (channel == '3') {
channelStr = 'kid';
}else if (channel == '4') {
channelStr = 'leftStyle';
}
let l2_TAB_NAM = '首页';
if (index == 0) {
l2_TAB_NAM = '首页';
}else if (channel == 1) {
l2_TAB_NAM = '上新';
}else if (channel == 3) {
l2_TAB_NAM = '人气';
}
for (var i = 0; i < list.length; i++) {
let item = list[i];
let skn = item.product_skn;
let inFloorIndex = parseInt(i) + 1 + '';
let params = {
P_NAME : pageName,
I_INDEX : inFloorIndex,
PRD_SKN : skn,
TAB_NAM : tab_name,
TAB_ID : tab_num,
P_PARAM : channelStr,
C_ID: channel,
L2_TAB_ID: index,
L2_TAB_NAM: l2_TAB_NAM,
exposureEnd : 1,
};
item.yh_exposureData = params;
}
return list;
}
function toArray(obj) {
if (_.isArray(obj)) {
... ... @@ -936,7 +1022,7 @@ export function getProductListForPersopn(reload=false) {
return new BrandStoreService(app.host).productListForPerson(shopId, channel, order, page, pageSize,brandId)
.then(json => {
let payload = parseProductList(json);
let payload = parseProductList(json,order,app.channel,2);
payload.endReached = payload.currentPage == payload.pageCount;
if (payload.currentPage > 1) {
... ... @@ -1008,7 +1094,7 @@ export function getProductListForNew(reload=false) {
return new BrandStoreService(app.host).productListForNew(shopId, channel, order, page, pageSize,brandId)
.then(json => {
let payload = parseProductList(json);
let payload = parseProductList(json,order,app.channel,1);
payload.endReached = payload.currentPage == payload.pageCount;
if (payload.currentPage > 1) {
... ...