Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
张文文
6 years ago
Commit
5f8a576090aea91eddedacfd66809286de841eed
1 parent
6bf4efe5
点击事件及埋点修改
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
156 additions
and
127 deletions
js/newArrival/components/newArrival/NewArrival.js
js/newArrival/constants/actionTypes.js
js/newArrival/containers/NewArrivalContainer.js
js/newArrival/reducers/newArrival/newArrivalActions.js
js/newArrival/reducers/newArrival/newArrivalInitialState.js
js/newArrival/reducers/newArrival/newArrivalReducer.js
js/newArrival/components/newArrival/NewArrival.js
View file @
5f8a576
...
...
@@ -114,7 +114,7 @@ export default class NewArrival extends React.PureComponent {
_clickCategorySelector
(
rowData
)
{
let
params
=
{
animated
:
true
,
sectionIndex
:
1
,
sectionIndex
:
0
,
itemIndex
:
0
,
viewOffset
:
44
}
...
...
@@ -365,15 +365,12 @@ export default class NewArrival extends React.PureComponent {
<
Image
resizeMode
=
{
'contain'
}
source
=
{
require
(
'../../image/shoppingbag.png'
)}
/
>
<
/TouchableOpacity
>
{
cart_goods_count
>
0
?
<
View
style
=
{
styles
.
cart_goods_countView
}
>
<
Text
style
=
{
styles
.
cart_goods_count
}
>
{
cart_goods_countString
}
<
/Text
>
<
/View> : null
}
{
cart_goods_count
>
0
?
<
View
style
=
{
styles
.
cart_goods_countView
}
>
<
Text
style
=
{
styles
.
cart_goods_count
}
>
{
cart_goods_countString
}
<
/Text
>
<
/View> : null
}
<
/Animated.View
>
{
this
.
state
.
showBackToTopButton
?
<
TouchableOpacity
style
=
{
styles
.
backToTopButton
}
...
...
@@ -406,19 +403,13 @@ export default class NewArrival extends React.PureComponent {
<
/TouchableOpacity>: nul
l
}
{
isFetching
?
<
LoadingIndicator
isVisible
=
{
isFetching
}
/
>
:
null
}
{
isFetching
?
<
LoadingIndicator
isVisible
=
{
isFetching
}
/> :null
}
<
/View
>
);
}
}
let
{
width
,
height
}
=
Dimensions
.
get
(
'window'
);
let
yPosition
=
0
;
const
DEVICE_WIDTH_RATIO
=
width
/
320
;
let
rowHeight
=
Math
.
ceil
(
254
*
DEVICE_WIDTH_RATIO
);
let
rowMarginTop
=
Math
.
ceil
(
10
*
DEVICE_WIDTH_RATIO
);
...
...
js/newArrival/constants/actionTypes.js
View file @
5f8a576
...
...
@@ -39,4 +39,5 @@ export default keyMirror({
RESOURCE_INFO_SUCCESS
:
null
,
RESOURCE_INFO_FAILURE
:
null
,
SET_SELECTED_CATEGORY
:
null
,
SET_SELECTED_TABCONTENT
:
null
,
});
...
...
js/newArrival/containers/NewArrivalContainer.js
View file @
5f8a576
...
...
@@ -54,6 +54,7 @@ class NewArrivalContainer extends Component {
this
.
_onPressCategory
=
this
.
_onPressCategory
.
bind
(
this
);
this
.
_onPressHotSearch
=
this
.
_onPressHotSearch
.
bind
(
this
);
this
.
_onPressProductListShop
=
this
.
_onPressProductListShop
.
bind
(
this
);
this
.
_onPressArticle
=
this
.
_onPressArticle
.
bind
(
this
);
this
.
_onLongPressProduct
=
this
.
_onLongPressProduct
.
bind
(
this
);
this
.
_onPressFindSimilar
=
this
.
_onPressFindSimilar
.
bind
(
this
);
...
...
@@ -90,10 +91,50 @@ class NewArrivalContainer extends Component {
_resourceJumpWithUrl
(
url
,
type
,
params
)
{
if
(
!
url
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
let
param
;
if
(
type
===
'banner'
&&
params
)
{
param
=
{
F_ID
:
1001
,
F_URL
:
url
};
}
if
(
type
===
'icon'
&&
params
)
{
param
=
{
F_ID
:
1003
,
F_URL
:
url
};
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
}
_onPressCategoryTab
(
data
,
index
)
{
this
.
props
.
actions
.
setAppSelectedCategory
(
index
);
this
.
props
.
actions
.
setSelectedTabContent
(
data
.
get
(
'tab_name'
),
index
);
}
_onPressArticle
(
url
,
index
=
0
,
article_id
)
{
if
(
!
url
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
// let I_INDEX = parseInt(index) + 1;
// I_INDEX = I_INDEX.toString();
// let F_INDEX = 1;
// F_INDEX = F_INDEX.toString();
// let param = {
// F_ID: 1004,
// F_NM: '最新上架',
// F_INDEX,
// I_INDEX,
// SORT_NM: this.props.newArrival.productList.order,
// FILTER_VALUE: this.props.newArrival.filterFactors.toJS(),
// RECOMMEND_TYPE: 'fashionArticle',
// ARTICLE_ID: article_id,
// }
// ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
}
_onPressCategory
(
data
,
l_index
=
0
,
index
=
0
)
{
...
...
@@ -118,32 +159,23 @@ class NewArrivalContainer extends Component {
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpToCategory
(
value
,
parseInt
(
0
),
parseInt
(
this
.
props
.
app
.
channel
));
let
I_INDEX
=
parseInt
(
index
)
+
1
;
I_INDEX
=
I_INDEX
.
toString
();
let
F_INDEX
=
1
;
if
(
this
.
props
.
newArrival
.
topPart
.
topList
&&
this
.
props
.
newArrival
.
topPart
.
topList
.
size
)
{
F_INDEX
++
;
}
if
(
this
.
props
.
newArrival
.
topPart
.
brandList
&&
this
.
props
.
newArrival
.
topPart
.
brandList
.
size
)
{
F_INDEX
++
;
}
if
(
this
.
props
.
newArrival
.
topPart
.
featuredList
&&
this
.
props
.
newArrival
.
topPart
.
featuredList
.
size
)
{
F_INDEX
++
;
}
F_INDEX
=
F_INDEX
.
toString
();
let
param
=
{
F_ID
:
1004
,
F_NM
:
'最新上架'
,
F_INDEX
,
I_INDEX
,
SORT_NM
:
this
.
props
.
newArrival
.
productList
.
order
,
FILTER_VALUE
:
this
.
props
.
newArrival
.
filterFactors
.
toJS
(),
RECOMMEND_TYPE
:
'seasonSort'
,
CATE_ID
:
categoryId
,
L_INDEX
:
l_index
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
//
// let I_INDEX = parseInt(index) + 1;
// I_INDEX = I_INDEX.toString();
// let F_INDEX = 1;
// F_INDEX = F_INDEX.toString();
// let param = {
// F_ID: 1004,
// F_NM: '最新上架',
// F_INDEX,
// I_INDEX,
// SORT_NM: this.props.newArrival.productList.order,
// FILTER_VALUE: this.props.newArrival.filterFactors.toJS(),
// RECOMMEND_TYPE: 'seasonSort',
// CATE_ID: categoryId,
// L_INDEX: l_index,
// }
// ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
}
_onPressHotSearch
(
data
,
l_index
=
0
,
index
=
0
)
{
...
...
@@ -151,6 +183,23 @@ class NewArrivalContainer extends Component {
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
hotSearchWithKeyword
(
data
);
// let I_INDEX = parseInt(index) + 1;
// I_INDEX = I_INDEX.toString();
// let F_INDEX = 1;
// F_INDEX = F_INDEX.toString();
// let param = {
// F_ID: 1004,
// F_NM: '最新上架',
// F_INDEX,
// I_INDEX,
// SORT_NM: this.props.newArrival.productList.order,
// FILTER_VALUE: this.props.newArrival.filterFactors.toJS(),
// RECOMMEND_TYPE: 'hotSearchTerm',
// KEYWORD: data,
// L_INDEX: l_index,
// }
// ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
}
...
...
@@ -192,33 +241,25 @@ class NewArrivalContainer extends Component {
let
url
=
`
http
:
//m.yohobuy.com?openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shops_id}","shop_template_type":"${shop_template_type}","shop_name":"${shop_name}","is_red_shop":"${is_red_shop}","brand_id":"${brand_id}"}}`;
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
let
I_INDEX
=
parseInt
(
index
)
+
1
;
I_INDEX
=
I_INDEX
+
""
;
let
F_INDEX
=
1
;
if
(
this
.
props
.
newArrival
.
topPart
.
topList
&&
this
.
props
.
newArrival
.
topPart
.
topList
.
size
)
{
F_INDEX
++
;
}
if
(
this
.
props
.
newArrival
.
topPart
.
brandList
&&
this
.
props
.
newArrival
.
topPart
.
brandList
.
size
)
{
F_INDEX
++
;
}
if
(
this
.
props
.
newArrival
.
topPart
.
featuredList
&&
this
.
props
.
newArrival
.
topPart
.
featuredList
.
size
)
{
F_INDEX
++
;
}
F_INDEX
=
F_INDEX
.
toString
();
let
param
=
{
F_ID
:
1004
,
F_NM
:
'最新上架'
,
F_INDEX
,
I_INDEX
,
SORT_NM
:
this
.
props
.
newArrival
.
productList
.
order
,
FILTER_VALUE
:
this
.
props
.
newArrival
.
filterFactors
.
toJS
(),
RECOMMEND_TYPE
:
'hotShop'
,
BRAND_ID
:
brand_id
,
SHOP_ID
:
shops_id
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
// let I_INDEX = parseInt(index) + 1;
// I_INDEX = I_INDEX + "";
// let F_INDEX = 1;
// F_INDEX = F_INDEX.toString();
// let param = {
// F_ID: 1004,
// F_NM: '最新上架',
// F_INDEX,
// I_INDEX,
// SORT_NM: this.props.newArrival.productList.order,
// FILTER_VALUE: this.props.newArrival.filterFactors.toJS(),
// RECOMMEND_TYPE: 'hotShop',
// BRAND_ID: brand_id,
// SHOP_ID: shops_id,
// }
// ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
}
_onPressShop
(
data
,
index
=
0
)
{
let
{
shop_name
,
...
...
@@ -234,19 +275,9 @@ class NewArrivalContainer extends Component {
let
url
=
`
http
:
//m.yohobuy.com?openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shops_id}","shop_template_type":"${shop_template_type}","shop_name":"${shop_name}","is_red_shop":"${is_red_shop}","brand_id":"${brand_id}"}}`;
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
let
I_INDEX
=
parseInt
(
index
)
+
1
;
I_INDEX
=
I_INDEX
.
toString
();
let
F_INDEX
=
1
;
if
(
this
.
props
.
newArrival
.
topPart
.
topList
.
size
)
{
F_INDEX
=
2
;
}
F_INDEX
=
F_INDEX
.
toString
();
let
param
=
{
F_ID
:
1002
,
F_NM
:
'为您推荐'
,
F_INDEX
,
I_INDEX
,
BRAND_ID
:
brand_id
,
F_URL
:
url
,
SHOP_ID
:
shops_id
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
...
...
@@ -258,58 +289,32 @@ class NewArrivalContainer extends Component {
return
;
}
let
{
selectedTabIndex
,
selectedTabName
}
=
this
.
props
.
newArrival
;
let
url
=
`
http
:
//m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}","from_page_name":"${Platform.OS === 'ios'?'iFP_NewArrival':'aFP_NewArrival'}"}}`;
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
let
I_INDEX
=
parseInt
(
rowId
)
+
1
;
I_INDEX
=
I_INDEX
.
toString
();
let
F_INDEX
=
1
;
if
(
this
.
props
.
newArrival
.
topPart
.
topList
&&
this
.
props
.
newArrival
.
topPart
.
topList
.
size
)
{
F_INDEX
++
;
}
if
(
this
.
props
.
newArrival
.
topPart
.
brandList
&&
this
.
props
.
newArrival
.
topPart
.
brandList
.
size
)
{
F_INDEX
++
;
}
if
(
this
.
props
.
newArrival
.
topPart
.
featuredList
&&
this
.
props
.
newArrival
.
topPart
.
featuredList
.
size
)
{
F_INDEX
++
;
}
F_INDEX
=
F_INDEX
.
toString
();
let
param
=
{
F_ID
:
1004
,
F_NM
:
'最新上架'
,
F_INDEX
,
I_INDEX
,
SORT_NM
:
this
.
sortNameWithParam
(
this
.
props
.
newArrival
.
productList
.
order
),
FILTER_VALUE
:
this
.
props
.
newArrival
.
filterFactors
.
toJS
(),
F_ID
:
1005
,
F_URL
:
url
,
PRD_SKN
:
productSkn
,
TAB_ID
:
selectedTabIndex
,
TAB_NAME
:
selectedTabName
}
// console.log(param);
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
}
sortNameWithParam
(
param
)
{
if
(
param
==
's_p_asc'
||
param
==
's_p_desc'
)
{
return
'价格'
;
}
if
(
param
==
'p_d_asc'
||
param
==
'p_d_desc'
)
{
return
'折扣'
;
}
return
'新品'
;
}
_goToRecommendForYou
()
{
this
.
props
.
actions
.
goToRecommendForYou
();
}
render
()
{
let
{
newArrival
}
=
this
.
props
;
let
{
resourceInfo
,
productList
,
showSimilarGuider
,
cart_goods_count
,
}
=
newArrival
;
let
{
resourceInfo
,
productList
,
showSimilarGuider
,
cart_goods_count
,
}
=
this
.
props
.
newArrival
;
let
isFetching
=
resourceInfo
.
isFetching
||
(
productList
.
list
.
size
==
0
&&
productList
.
isFetching
)
||
(
productList
.
list
.
size
>
0
&&
productList
.
isFetching
&&
productList
.
currentPage
==
0
);
return
(
<
View
style
=
{
styles
.
container
}
>
...
...
@@ -318,21 +323,23 @@ class NewArrivalContainer extends Component {
productList
=
{
productList
}
resourceInfo
=
{
resourceInfo
}
cart_goods_count
=
{
cart_goods_count
}
showSimilarGuider
=
{
showSimilarGuider
}
goShopCar
=
{
this
.
_goShopCar
}
onEndReached
=
{
this
.
_onEndReached
}
goToRecommendForYou
=
{
this
.
_goToRecommendForYou
}
onPressShop
=
{
this
.
_onPressShop
}
onPressCategory
=
{
this
.
_onPressCategory
}
onPressHotSearch
=
{
this
.
_onPressHotSearch
}
onPressArticle
=
{
this
.
_onPressArticle
}
onPressProductListShop
=
{
this
.
_onPressProductListShop
}
onPressProductListProduct
=
{
this
.
_onPressProductListProduct
}
onLongPressProduct
=
{
this
.
_onLongPressProduct
}
onPressFindSimilar
=
{
this
.
_onPressFindSimilar
}
goShopCar
=
{
this
.
_goShopCar
}
showSimilarGuider
=
{
showSimilarGuider
}
resourceJumpWithUrl
=
{
this
.
_resourceJumpWithUrl
}
onPressShop
=
{
this
.
_onPressShop
}
goToRecommendForYou
=
{
this
.
_goToRecommendForYou
}
onPressCategoryTab
=
{
this
.
_onPressCategoryTab
}
/
>
<
/View
>
...
...
@@ -348,7 +355,6 @@ let styles = StyleSheet.create({
width
:
width
,
height
:
height
-
64
-
44
,
},
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
NewArrivalContainer
);
...
...
js/newArrival/reducers/newArrival/newArrivalActions.js
View file @
5f8a576
...
...
@@ -35,6 +35,7 @@ const {
FILTER_DATA_SUCCESS
,
SET_SELECTED_CATEGORY
,
SET_SELECTED_TABCONTENT
,
RESOURCE_INFO_REQUEST
,
RESOURCE_INFO_SUCCESS
,
...
...
@@ -95,8 +96,18 @@ export function getResourceInfo(callback) {
dispatch
(
getResourceRequest
());
return
new
NewArrivalService
(
app
.
host
).
fetchResourceInfo
(
'1f2e07cb63811680154ba693c954dd62'
)
.
then
(
json
=>
{
dispatch
(
getResourceSuccess
(
json
));
callback
&&
typeof
callback
===
'function'
&&
callback
(
json
)
json
&&
json
.
forEach
(
item
=>
{
if
(
item
.
template_name
===
'guessLike'
&&
item
.
data
)
{
let
tmpData
=
item
.
data
[
0
];
let
tmpName
=
tmpData
.
tab_name
;
dispatch
(
setSelectedTabContent
(
0
,
tmpName
));
}
})
dispatch
(
getResourceSuccess
(
json
));
})
.
catch
(
error
=>
{
dispatch
(
getResourceFailure
(
error
));
...
...
@@ -1414,8 +1425,17 @@ export function setAppSelectedCategory(index) {
return
(
dispatch
,
getState
)
=>
{
dispatch
({
type
:
SET_SELECTED_CATEGORY
,
payload
:
{
index
}
payload
:
{
index
}
,
});
dispatch
(
getProductList
());
};
}
export
function
setSelectedTabContent
(
tabName
,
index
)
{
return
(
dispatch
,
getState
)
=>
{
dispatch
({
type
:
SET_SELECTED_TABCONTENT
,
payload
:
{
index
,
tabName
},
});
};
}
...
...
js/newArrival/reducers/newArrival/newArrivalInitialState.js
View file @
5f8a576
...
...
@@ -21,6 +21,7 @@ let InitialState = Record({
categoryFilterList
:
List
(),
filterCategoryDetailFilterList
:
List
(),
filterDataReady
:
false
,
//只加载一次
productList
:
new
(
Record
({
isFetching
:
false
,
isFilter
:
false
,
...
...
@@ -56,15 +57,19 @@ let InitialState = Record({
sort
:
'所有品类'
,
//品类
brand
:
'所有品牌'
,
//品牌
})),
recommendForYou
:
new
(
Record
({
isFetching
:
false
,
hotBrandList
:
List
(),
browseBrandList
:
List
(),
newBrandList
:
List
(),
})),
showSimilarGuider
:
false
,
moreFilterSelectOrder
:
''
,
cart_goods_count
:
0
,
selectedTabIndex
:
0
,
selectedTabName
:
''
,
});
export
default
InitialState
;
...
...
js/newArrival/reducers/newArrival/newArrivalReducer.js
View file @
5f8a576
...
...
@@ -33,6 +33,7 @@ const {
FILTER_DATA_SUCCESS
,
SET_SELECTED_CATEGORY
,
SET_SELECTED_TABCONTENT
,
RESOURCE_INFO_REQUEST
,
RESOURCE_INFO_SUCCESS
,
...
...
@@ -186,16 +187,21 @@ export default function newArrivalReducer(state=initialState, action) {
case
SET_SELECTED_CATEGORY
:
{
let
{
index
}
=
action
.
payload
;
return
state
.
setIn
([
'productList'
,
'selectedCategoryIndex'
],
index
)
.
setIn
([
'productList'
,
'currentPage'
],
0
)
// .setIn(['productList', 'product_list'], List())
.
setIn
([
'productList'
,
'total'
],
0
)
.
setIn
([
'productList'
,
'endReached'
],
false
)
.
setIn
([
'productList'
,
'error'
],
null
);
return
state
.
setIn
([
'productList'
,
'selectedCategoryIndex'
],
index
)
.
setIn
([
'productList'
,
'currentPage'
],
0
)
// .setIn(['productList', 'product_list'], List())
.
setIn
([
'productList'
,
'total'
],
0
)
.
setIn
([
'productList'
,
'endReached'
],
false
)
.
setIn
([
'productList'
,
'error'
],
null
);
}
case
SET_SELECTED_TABCONTENT
:
{
let
{
index
,
tabName
}
=
action
.
payload
;
return
state
.
set
(
'selectedTabIndex'
,
index
)
.
set
(
'selectedTabName'
,
tabName
);
}
}
return
state
;
}
...
...
Please
register
or
login
to post a comment