Merge branch '5.5.0' of http://git.yoho.cn/mobile/YH_RNComponent into 5.5.0_local
Showing
7 changed files
with
95 additions
and
9 deletions
@@ -38,7 +38,7 @@ export default class List extends Component { | @@ -38,7 +38,7 @@ export default class List extends Component { | ||
38 | } | 38 | } |
39 | break; | 39 | break; |
40 | case 'list': { | 40 | case 'list': { |
41 | - return <ListCell resource={rowData} onPressDetail={this.props.onPressDetail}/>; | 41 | + return <ListCell resource={rowData} onPressDetail={this.props.onPressDetail} index={rowID}/>; |
42 | } | 42 | } |
43 | break; | 43 | break; |
44 | } | 44 | } |
@@ -70,7 +70,7 @@ export default class ListBannerSwiper extends React.Component { | @@ -70,7 +70,7 @@ export default class ListBannerSwiper extends React.Component { | ||
70 | key={i} | 70 | key={i} |
71 | activeOpacity={1} | 71 | activeOpacity={1} |
72 | onPress={() => { | 72 | onPress={() => { |
73 | - this.props.onPressBanner && this.props.onPressBanner(item.url); | 73 | + this.props.onPressBanner && this.props.onPressBanner(item.url, i); |
74 | }} | 74 | }} |
75 | > | 75 | > |
76 | <SlicedImage source={{uri: item.src}} style={{width, height}}/> | 76 | <SlicedImage source={{uri: item.src}} style={{width, height}}/> |
@@ -37,7 +37,7 @@ export default class ListCell extends Component { | @@ -37,7 +37,7 @@ export default class ListCell extends Component { | ||
37 | } = data; | 37 | } = data; |
38 | default_images = default_images.replace('{width}', 240).replace('{height}', 320).replace('{mode}',2); | 38 | default_images = default_images.replace('{width}', 240).replace('{height}', 320).replace('{mode}',2); |
39 | return ( | 39 | return ( |
40 | - <TouchableOpacity style={styles.container} onPress={() => {this.props.onPressDetail && this.props.onPressDetail(product_skn)}}> | 40 | + <TouchableOpacity style={styles.container} onPress={() => {this.props.onPressDetail && this.props.onPressDetail(product_skn,this.props.index)}}> |
41 | <View style={styles.container}> | 41 | <View style={styles.container}> |
42 | <Image style={styles.image} source={{uri:default_images}}/> | 42 | <Image style={styles.image} source={{uri:default_images}}/> |
43 | 43 |
@@ -68,6 +68,12 @@ class DetailContainer extends Component { | @@ -68,6 +68,12 @@ class DetailContainer extends Component { | ||
68 | 68 | ||
69 | let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`; | 69 | let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`; |
70 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 70 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
71 | + | ||
72 | + let param = { | ||
73 | + PRD_SKN: product_skn, | ||
74 | + AB_TYPE: 'A', | ||
75 | + } | ||
76 | + NativeModules.YH_CommonHelper.logEvent('YB_GOOD_GDS_VIEW_C', param); | ||
71 | } | 77 | } |
72 | 78 | ||
73 | _onPressTag(tag) { | 79 | _onPressTag(tag) { |
@@ -66,18 +66,32 @@ class ListContainer extends Component { | @@ -66,18 +66,32 @@ class ListContainer extends Component { | ||
66 | this.props.actions.getProductList(true); | 66 | this.props.actions.getProductList(true); |
67 | } | 67 | } |
68 | 68 | ||
69 | - _onPressDetail(product_skn) { | 69 | + _onPressDetail(product_skn, index) { |
70 | if (!product_skn) { | 70 | if (!product_skn) { |
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | ReactNative.NativeModules.YH_CommonHelper.pushGoodGoodsRecommendDetailWithProductSKN(product_skn + ''); | 73 | ReactNative.NativeModules.YH_CommonHelper.pushGoodGoodsRecommendDetailWithProductSKN(product_skn + ''); |
74 | + let param = { | ||
75 | + I_INDEX: parseInt(index) + 1 + '', | ||
76 | + PRD_SKN: product_skn, | ||
77 | + AB_TYPE: 'A', | ||
78 | + F_ID: 1002, | ||
79 | + } | ||
80 | + NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_FLR_C', logParam); | ||
74 | } | 81 | } |
75 | 82 | ||
76 | - _onPressBanner(url) { | 83 | + _onPressBanner(url, index) { |
77 | if (!url) { | 84 | if (!url) { |
78 | return; | 85 | return; |
79 | } | 86 | } |
80 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 87 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
88 | + let param = { | ||
89 | + I_INDEX: parseInt(index) + 1 + '', | ||
90 | + F_URL: url, | ||
91 | + AB_TYPE: 'A', | ||
92 | + F_ID: 1002, | ||
93 | + } | ||
94 | + NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_FLR_C', logParam); | ||
81 | } | 95 | } |
82 | 96 | ||
83 | _onEndReached() { | 97 | _onEndReached() { |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -import ReactNative from 'react-native'; | 3 | +import ReactNative, { |
4 | + NativeModules, | ||
5 | +} from 'react-native' | ||
4 | import DetailService from '../../services/DetailService'; | 6 | import DetailService from '../../services/DetailService'; |
5 | import Immutable, {Map} from 'immutable'; | 7 | import Immutable, {Map} from 'immutable'; |
6 | 8 | ||
@@ -39,6 +41,11 @@ export function getDetail() { | @@ -39,6 +41,11 @@ export function getDetail() { | ||
39 | return new DetailService(app.singleHost).getFavoriteStatusWithProductID(json.product_id) | 41 | return new DetailService(app.singleHost).getFavoriteStatusWithProductID(json.product_id) |
40 | .then(json => { | 42 | .then(json => { |
41 | dispatch(setFavoriteStatus(json)); | 43 | dispatch(setFavoriteStatus(json)); |
44 | + let param = { | ||
45 | + PRD_SKN: product_skn, | ||
46 | + AB_TYPE: 'A', | ||
47 | + } | ||
48 | + NativeModules.YH_CommonHelper.logEvent('YB_GOOD_GDS_DETAIL_L', param); | ||
42 | }) | 49 | }) |
43 | .catch(error => { | 50 | .catch(error => { |
44 | dispatch(setFavoriteStatus(false)); | 51 | dispatch(setFavoriteStatus(false)); |
@@ -61,6 +68,12 @@ export function changeFavoriteStatus(favorite) { | @@ -61,6 +68,12 @@ export function changeFavoriteStatus(favorite) { | ||
61 | if (product_id && !favorite) { | 68 | if (product_id && !favorite) { |
62 | new DetailService(app.host).addFavorite(product_id); | 69 | new DetailService(app.host).addFavorite(product_id); |
63 | } | 70 | } |
71 | + let param = { | ||
72 | + PRD_SKN: detail.product_skn, | ||
73 | + AB_TYPE: 'A', | ||
74 | + COL_TYPE: favorite? '2': '1', | ||
75 | + } | ||
76 | + NativeModules.YH_CommonHelper.logEvent('YB_GOOD_GDS_COLLECT_C', param); | ||
64 | dispatch(setFavoriteStatus(!favorite)); | 77 | dispatch(setFavoriteStatus(!favorite)); |
65 | } | 78 | } |
66 | ReactNative.NativeModules.YH_CommonHelper.uid() | 79 | ReactNative.NativeModules.YH_CommonHelper.uid() |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -import ReactNative from 'react-native'; | 3 | +import ReactNative, { |
4 | + NativeModules, | ||
5 | +} from 'react-native' | ||
4 | import ListService from '../../services/ListService'; | 6 | import ListService from '../../services/ListService'; |
5 | 7 | ||
6 | import helper from '../../../common/utils/helper'; | 8 | import helper from '../../../common/utils/helper'; |
@@ -27,7 +29,10 @@ export function getProductList(reload = false) { | @@ -27,7 +29,10 @@ export function getProductList(reload = false) { | ||
27 | dispatch(getProductListRequest()); | 29 | dispatch(getProductListRequest()); |
28 | return new ListService(app.host).getProductListData(channel, gender, uid, page, pageSize) | 30 | return new ListService(app.host).getProductListData(channel, gender, uid, page, pageSize) |
29 | .then(json => { | 31 | .then(json => { |
30 | - let payload = parseProductList(json); | 32 | + let payload = parseProductList(json, products.list.toJS()&&products.list.toJS().length); |
33 | + | ||
34 | + NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_L', payload.logParam); | ||
35 | + | ||
31 | payload.endReached = payload.currentPage == payload.pageCount; | 36 | payload.endReached = payload.currentPage == payload.pageCount; |
32 | 37 | ||
33 | if (payload.currentPage > 1 && !reload) { | 38 | if (payload.currentPage > 1 && !reload) { |
@@ -61,17 +66,34 @@ export function getProductList(reload = false) { | @@ -61,17 +66,34 @@ export function getProductList(reload = false) { | ||
61 | }; | 66 | }; |
62 | } | 67 | } |
63 | 68 | ||
64 | -function parseProductList(json) { | 69 | +function parseProductList(json, count) { |
65 | let currentPage = json && json.page ? json.page : 1; | 70 | let currentPage = json && json.page ? json.page : 1; |
66 | let pageCount = json && json.page_total ? json.page_total : 0; | 71 | let pageCount = json && json.page_total ? json.page_total : 0; |
67 | let total = json && json.total ? json.total : 0; | 72 | let total = json && json.total ? json.total : 0; |
68 | let list = json && json.product_list ? json.product_list : []; | 73 | let list = json && json.product_list ? json.product_list : []; |
69 | 74 | ||
75 | + let logList = []; | ||
76 | + for (var i = 0; i < list.length; i++) { | ||
77 | + let item = list[i]; | ||
78 | + logList.push({ | ||
79 | + I_INDEX: count + i + 1, | ||
80 | + PRD_SKN: item.product_skn, | ||
81 | + }) | ||
82 | + } | ||
83 | + let data = { | ||
84 | + F_ID: 1002, | ||
85 | + LIST: logList, | ||
86 | + } | ||
87 | + let logParam = { | ||
88 | + AB_TYPE: 'A', | ||
89 | + DATA:[data], | ||
90 | + } | ||
70 | return { | 91 | return { |
71 | list, | 92 | list, |
72 | currentPage, | 93 | currentPage, |
73 | pageCount, | 94 | pageCount, |
74 | total, | 95 | total, |
96 | + logParam, | ||
75 | }; | 97 | }; |
76 | } | 98 | } |
77 | 99 | ||
@@ -106,6 +128,7 @@ export function fetchBanner() { | @@ -106,6 +128,7 @@ export function fetchBanner() { | ||
106 | dispatch(fetchBannerRequest()); | 128 | dispatch(fetchBannerRequest()); |
107 | return new ListService(app.serviceHost).fetchBannerData() | 129 | return new ListService(app.serviceHost).fetchBannerData() |
108 | .then(json => { | 130 | .then(json => { |
131 | + dispatch(logBanner(json)); | ||
109 | dispatch(fetchBannerSuccess(json)); | 132 | dispatch(fetchBannerSuccess(json)); |
110 | }) | 133 | }) |
111 | .catch(error => { | 134 | .catch(error => { |
@@ -114,6 +137,36 @@ export function fetchBanner() { | @@ -114,6 +137,36 @@ export function fetchBanner() { | ||
114 | } | 137 | } |
115 | } | 138 | } |
116 | 139 | ||
140 | +function logBanner(json) { | ||
141 | + let bannerData = []; | ||
142 | + if (json.data && josn.data.length()) { | ||
143 | + let bannerDataArray = json.data; | ||
144 | + if (bannerDataArray.length > 0) { | ||
145 | + bannerData = bannerDataArray[0].data; | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + let logList = []; | ||
150 | + for (var i = 0; i < bannerData.length; i++) { | ||
151 | + let item = bannerData[i]; | ||
152 | + logList.push({ | ||
153 | + I_INDEX: i + 1, | ||
154 | + F_URL: item.url, | ||
155 | + }) | ||
156 | + } | ||
157 | + let data = { | ||
158 | + F_ID: 1001, | ||
159 | + LIST: logList, | ||
160 | + } | ||
161 | + let logParam = { | ||
162 | + AB_TYPE: 'A', | ||
163 | + DATA:[data], | ||
164 | + } | ||
165 | + | ||
166 | + NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_L', logParam); | ||
167 | + | ||
168 | +} | ||
169 | + | ||
117 | export function fetchBannerRequest() { | 170 | export function fetchBannerRequest() { |
118 | return { | 171 | return { |
119 | type: FETCH_BANNER_REQUEST | 172 | type: FETCH_BANNER_REQUEST |
-
Please register or login to post a comment