Authored by 孙凯

add home product 数据自动曝光 review by hongmo

... ... @@ -67,7 +67,7 @@ export default class ProductListCell extends Component {
let showAlmostSoldOut = !isGlobalProduct && data.get('tags', []).indexOf('is_soon_sold_out') !== -1; // 非全球购的即将售罄
let showSoldOut = !isGlobalProduct && data.get('tags', []).indexOf('is_solded') !== -1; // 非全球购的即将售罄
let showOutletSoldOut = sourceType == 2 && data.get('storage_num') && data.get('storage_num') == 0; // 数据源是奥莱才显示
return (
<View style={styles.imageContainer}>
<YH_Image style={styles.image} url={url}>
... ... @@ -82,7 +82,7 @@ export default class ProductListCell extends Component {
{showAlmostSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_jjsq.png')}/> : null}
{showOutletSoldOut ? <Image style={styles.soldOutImage} source={require('../../images/tag/outlet_sellout_bg.png')}/> : null}
{showGPSoldOut ? <Image style={styles.gpSoldOutImage} source={require('../../images/tag/gp_tip_SQ.png')}/> : null}
{showSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_ysq.png')}/> : null}
{showSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_ysq.png')}/> : null}
{showSimilarGuider ? <SimilarProductGuider /> : null}
</YH_Image>
</View>
... ... @@ -135,11 +135,13 @@ export default class ProductListCell extends Component {
render() {
let {data, sourceType, similarIndex, rowID, style} = this.props;
let name = data.get('product_name') ? data.get('product_name') : '';
let yh_exposureData = data.get('yh_exposureData') ? data.get('yh_exposureData') : null;
return (
<TouchableOpacity
style={[styles.container, style]}
activeOpacity={1}
yh_exposureData={yh_exposureData}
onPress={() => {
if (rowID == similarIndex) {
this.props.onLongPressProduct&&this.props.onLongPressProduct(-1);
... ...
... ... @@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable';
const {
Dimensions,
Platform,
} = ReactNative;
function channelCacheKey(channelKey) {
... ... @@ -835,8 +836,14 @@ function parseBoyGirlFavorite(json, channel) {
let total = json && json.total ? json.total : 0;
let list = json && json.product_list ? json.product_list : [];
list = exposePruductListData(list, channel);
let rec_id = json && json.rec_id ? json.rec_id : '';
try {
list = exposePruductListData(list, channel,rec_id,-1);
} catch (e) {
} finally {
}
return {
currentPage,
... ... @@ -853,7 +860,13 @@ function parseKidsFavorite(json, channel) {
let total = json && json.total ? json.total : 0;
let list = json && json.product_list ? json.product_list : [];
list = exposePruductListData(list, channel);
try {
list = exposePruductListData(list, channel,'',-1);
} catch (e) {
} finally {
}
return {
currentPage,
... ... @@ -867,8 +880,15 @@ function parseLifeStyleFavorite(json, channel) {
let product_list = json && json.product_list ? json.product_list : {};
let newList = product_list && product_list.new ? product_list.new : [];
let hotList = product_list && product_list.top ? product_list.top : [];
newList = exposePruductListData(newList, channel);
hotList = exposePruductListData(hotList, channel);
try {
newList = exposePruductListData(newList, channel,'',0);
hotList = exposePruductListData(hotList, channel,'',1);
} catch (e) {
} finally {
}
return {
newList,
hotList
... ... @@ -1156,30 +1176,55 @@ function parseReportProductList(json) {
return reportData;
}
function exposePruductListData(list, channel=1) {
function exposePruductListData(list, channel ,rec_id,tab_id) {
if (!list) {
return list;
}
let pageName = 'iFP_Home'
let channlStr = 'boy';
if (channel == 1) {
channlStr = 'boy';
}else if (channel == 2){
channlStr = 'girl';
}else if (channel == 3){
channlStr = 'kid';
}else if (channel == 4){
channlStr = 'lifestyle';
let rec_pose = '';
if (channel == '1') {
rec_pose = '100001';
}else if (channel == '2'){
rec_pose = '100002';
}else if (channel == '3'){
rec_pose = '100006';
}else if (channel == '4'){
rec_pose = '100011';
}
let pageName = 'iFP_Home';
if (Platform.OS === 'android') {
pageName = 'aFP_Home';
}
for (var i = 0; i < list.length; i++) {
let item = list[i];
let skn = item.product_skn;
let inFloorIndex = parseInt(i) + 1 + '';
let params = autoReportData(channlStr,'','','',inFloorIndex,'',skn);
let params = {
P_NAME : pageName,
I_INDEX : inFloorIndex,
PRD_SKN : skn,
REC_POS : rec_pose,
REC_ID : rec_id,
exposureEnd : 1,
};
if (tab_id != -1) {
params = {
P_NAME : pageName,
I_INDEX : inFloorIndex,
PRD_SKN : skn,
REC_POS : rec_pose,
REC_ID : rec_id,
TAB_ID : tab_id,
exposureEnd : 1,
};
}
item.yh_exposureData = params;
}
return list;
}
... ...