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
Plain Diff
Browse Files
Authored by
陈林
6 years ago
Commit
5f2a965b81b98cf3d85d502fca50dafdd22a51b2
2 parents
b94d523d
e4887ae7
Merge branch 'V6.9.2' into 'master'
V6.9.2 See merge request
!31
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1340 additions
and
1590 deletions
js/alliance/components/cell/ImageSlider.js
js/message/components/content/ContentLikedListCell.js
js/message/components/content/ContentMessageCell.js
js/message/containers/ContentListContainer.js
js/message/containers/ContentMessageContainer.js
js/message/reducers/content/contentActions.js
js/newArrival/components/newArrival/BrandCell.js
js/newArrival/components/newArrival/CategorySelector.js
js/newArrival/components/newArrival/NewArrival.js
js/newArrival/components/newArrival/NewArrivalCell.js
js/newArrival/components/newArrival/NewArrivalHeader.js
js/newArrival/components/newArrival/ProductListRow.js
js/newArrival/components/newArrival/RecommendCell.js
js/newArrival/components/newArrival/floor/FocusCell.js
js/newArrival/components/newArrival/floor/ImageSlider.js
js/newArrival/components/newArrival/floor/JointCell.js
js/newArrival/constants/actionTypes.js
js/newArrival/containers/NewArrivalContainer.js
js/newArrival/containers/RecForYouContainer.js
js/newArrival/reducers/newArrival/newArrivalActions.js
js/newArrival/reducers/newArrival/newArrivalInitialState.js
js/newArrival/reducers/newArrival/newArrivalReducer.js
js/newArrival/services/NewArrivalService.js
js/alliance/components/cell/ImageSlider.js
View file @
5f2a965
...
...
@@ -33,7 +33,7 @@ export default class ImageSlider extends React.Component {
}
_handleParamsJumpWithUrl
(
index
,
url
)
{
// 为埋点提供参数组装
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let
params
=
{
...
...
js/message/components/content/ContentLikedListCell.js
View file @
5f2a965
...
...
@@ -59,7 +59,7 @@ export default class ContentLikedListCell extends Component {
<
/View
>
<
/View
>
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
this
.
props
.
jumpToGrassDetailPage
&&
this
.
props
.
jumpToGrassDetailPage
(
rowData
.
articleId
)}
>
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
this
.
props
.
jumpToGrassDetailPage
&&
this
.
props
.
jumpToGrassDetailPage
(
rowData
.
articleId
,
rowData
.
rootCommentId
)}
>
<
View
style
=
{
styles
.
originView
}
>
<
Text
style
=
{
styles
.
copyText
}
>
原文
<
/Text
>
<
YH_Image
url
=
{
imageUrl
}
style
=
{
styles
.
imageStyle
}
/
>
...
...
js/message/components/content/ContentMessageCell.js
View file @
5f2a965
...
...
@@ -69,25 +69,30 @@ export default class ContentMessageCell extends Component {
{
status
?
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
this
.
props
.
jumpToGrassDetailPage
&&
this
.
props
.
jumpToGrassDetailPage
(
rowData
.
articleId
)}
>
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
this
.
props
.
jumpToGrassDetailPage
&&
this
.
props
.
jumpToGrassDetailPage
(
rowData
.
articleId
,
rowData
.
rootCommentId
)}
>
<
View
style
=
{
styles
.
ownerReplyView
}
>
<
Text
style
=
{{
paddingLeft
:
10
,
paddingTop
:
14
,
paddingRight
:
1
,
paddingBottom
:
12
}}
>
<
Text
style
=
{{
paddingLeft
:
10
,
paddingTop
:
14
,
paddingRight
:
1
,
paddingBottom
:
12
}}
numberOfLines
=
{
3
}
>
<
Text
style
=
{
styles
.
replyText
}
>
我的评论:
<
/Text
>
<
Text
style
=
{
styles
.
defaultReplyText
}
numberOfLines
=
{
2
}
>
{
rowData
.
parentCommentContent
}
<
/Text
>
<
Text
style
=
{
styles
.
defaultReplyText
}
>
{
rowData
.
parentCommentContent
}
<
/Text
>
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
:
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
this
.
props
.
jumpToGrassDetailPage
&&
this
.
props
.
jumpToGrassDetailPage
(
rowData
.
articleId
)}
>
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
this
.
props
.
jumpToGrassDetailPage
&&
this
.
props
.
jumpToGrassDetailPage
(
rowData
.
articleId
,
rowData
.
rootCommentId
)}
>
<
View
style
=
{
styles
.
originContainerView
}
>
<
Text
style
=
{
styles
.
copyText
}
>
原文
<
/Text
>
<
YH_Image
url
=
{
imageUrl
}
style
=
{
styles
.
imageStyle
}
/
>
{
imageUrl
?
<
YH_Image
url
=
{
imageUrl
}
style
=
{
styles
.
imageStyle
}
/> : null
}
{
rowData
.
content
?
<
Text
style
=
{
styles
.
originText
}
numberOfLines
=
{
1
}
>
{
rowData
.
content
}
<
/Text
>
:
<
View
style
=
{{
height
:
5
}}
/
>
<
Text
style
=
{
styles
.
originText
}
numberOfLines
=
{
1
}
>
<
Text
>
{
rowData
.
content
}
<
/Text
>
<
Text
>
{
'...'
}
<
/Text
>
<
/Text
>
:
<
View
style
=
{{
height
:
5
}}
/
>
}
<
/View
>
...
...
js/message/containers/ContentListContainer.js
View file @
5f2a965
...
...
@@ -80,16 +80,16 @@ class ContentListContainer extends Component {
let
url
=
communityHost
+
(
Platform
.
OS
===
'ios'
?
'/grass'
:
''
)
+
`
/
author
/
$
{
1
}
/${optUid}
`
let
action
,
params
;
if
(
Platform
.
OS
===
'ios'
)
{
action
=
'go.h5
hn
'
;
action
=
'go.h5'
;
params
=
{
url
,
headerid
:
-
1
,
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
else
{
action
=
'go.h5'
;
params
=
{
url
,
param
:
{
headerid
:
"-1"
}
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
let
jumpParams
=
{
...
...
@@ -100,22 +100,22 @@ class ContentListContainer extends Component {
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
path
);
}
_jumpToGrassDetailPage
(
articleId
)
{
_jumpToGrassDetailPage
(
articleId
,
rootCommentId
)
{
let
{
communityHost
}
=
this
.
props
let
url
=
communityHost
+
(
Platform
.
OS
===
'ios'
?
'/grass'
:
''
)
+
`
/
article
/
detail
/
$
{
articleId
}
`
let
url
=
communityHost
+
(
Platform
.
OS
===
'ios'
?
'/grass'
:
''
)
+
`
/
article
/
detail
/
$
{
articleId
}
`
+
`
?
commentId
=
$
{
rootCommentId
}
`
let
action
,
params
;
if
(
Platform
.
OS
===
'ios'
)
{
action
=
'go.h5
hn
'
;
action
=
'go.h5'
;
params
=
{
url
,
headerid
:
-
1
,
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
else
{
action
=
'go.h5'
;
params
=
{
url
,
param
:
{
headerid
:
"-1"
}
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
let
jumpParams
=
{
...
...
js/message/containers/ContentMessageContainer.js
View file @
5f2a965
...
...
@@ -111,16 +111,16 @@ class ContentMessageContainer extends Component {
let
url
=
communityHost
+
(
Platform
.
OS
===
'ios'
?
'/grass'
:
''
)
+
`
/
author
/
$
{
1
}
/${optUid}
`
let
action
,
params
;
if
(
Platform
.
OS
===
'ios'
)
{
action
=
'go.h5
hn
'
;
action
=
'go.h5'
;
params
=
{
url
,
headerid
:
-
1
,
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
else
{
action
=
'go.h5'
;
params
=
{
url
,
param
:
{
headerid
:
"-1"
}
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
let
jumpParams
=
{
...
...
@@ -131,23 +131,23 @@ class ContentMessageContainer extends Component {
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
path
);
}
_jumpToGrassDetailPage
(
articleId
)
{
_jumpToGrassDetailPage
(
articleId
,
rootCommentId
)
{
let
{
communityHost
}
=
this
.
props
let
url
=
communityHost
+
(
Platform
.
OS
===
'ios'
?
'/grass'
:
''
)
+
`
/
article
/
detail
/
$
{
articleId
}
`
+
`
?
commentId
=
$
{
rootCommentId
}
`
let
url
=
communityHost
+
(
Platform
.
OS
===
'ios'
?
'/grass'
:
''
)
+
`
/
article
/
detail
/
$
{
articleId
}
`
let
action
,
params
;
if
(
Platform
.
OS
===
'ios'
)
{
action
=
'go.h5
hn
'
;
action
=
'go.h5'
;
params
=
{
url
,
headerid
:
-
1
,
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
else
{
action
=
'go.h5'
;
params
=
{
url
,
param
:
{
headerid
:
"-1"
}
param
:
{
headerid
:
"-1"
,
toplayoutByH5
:
'Y'
}
}
}
let
jumpParams
=
{
...
...
js/message/reducers/content/contentActions.js
View file @
5f2a965
...
...
@@ -357,6 +357,7 @@ function parseContentList(json) {
parentCommentId
:
item
.
parentCommentId
,
commentContent
:
item
.
commentContent
,
parentContent
:
item
.
parentCommentContent
,
rootCommentId
:
item
.
rootCommentId
,
coverImg
:
item
.
coverImg
,
articleId
:
item
.
articleId
,
...
...
js/newArrival/components/newArrival/BrandCell.js
View file @
5f2a965
...
...
@@ -13,7 +13,7 @@ import ReactNative, {
Platform
,
}
from
'react-native'
;
import
YH_Image
from
'../../../common/components/YH_Image'
;
import
Immutable
,
{
Map
}
from
'immutable'
;
export
default
class
BrandCell
extends
Component
{
...
...
@@ -27,7 +27,7 @@ export default class BrandCell extends Component {
let
shop_logo
=
data
.
get
(
'shop_logo'
);
let
shops_id
=
data
.
get
(
'shops_id'
);
let
new_product_num
=
data
.
get
(
'new_product_num'
);
shop_logo
=
shop_logo
?
shop_logo
.
replace
(
'{width}'
,
166
).
replace
(
'{height}'
,
68
).
replace
(
'{mode}'
,
2
):
''
;
shop_logo
=
YH_Image
.
getSlicedUrl
(
shop_logo
,
100
,
50
,
2
)
;
let
yh_exposureData
=
data
.
get
(
'yh_exposureData'
);
return
(
<
TouchableOpacity
style
=
{
styles
.
container
}
yh_exposureData
=
{
yh_exposureData
}
onPress
=
{()
=>
{
this
.
props
.
onPressShop
&&
this
.
props
.
onPressShop
(
data
,
index
);}}
>
...
...
@@ -35,7 +35,6 @@ export default class BrandCell extends Component {
<
Image
style
=
{
styles
.
image
}
source
=
{{
uri
:
shop_logo
}}
/
>
<
View
style
=
{
styles
.
footerContainer
}
>
<
Text
style
=
{
styles
.
text
}
numberOfLines
=
{
1
}
>
上新
{
new_product_num
}
款
<
/Text
>
<
Image
style
=
{
styles
.
arrowImage
}
source
=
{
require
(
'../../image/arrow_small_ic.png'
)}
/
>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
...
...
@@ -47,43 +46,30 @@ let {width, height} = Dimensions.get('window');
let
styles
=
StyleSheet
.
create
({
container
:
{
height
:
102
,
width
:
83
,
height
:
76
,
width
:
80
,
backgroundColor
:
'white'
,
marginLeft
:
15
,
marginTop
:
5
,
marginTop
:
10
,
marginRight
:
4
,
},
image
:
{
marginTop
:
25
,
width
:
83
,
height
:
34
,
marginTop
:
0
,
width
:
80
,
height
:
40
,
resizeMode
:
'contain'
,
},
footerContainer
:
{
marginTop
:
20
,
marginLeft
:
9
,
width
:
65
,
marginTop
:
12
,
width
:
80
,
height
:
16
,
borderRadius
:
8
,
backgroundColor
:
'rgb(153,153,153)'
,
flexDirection
:
'row'
,
},
text
:
{
fontSize
:
9
,
color
:
'white'
,
marginLeft
:
5
,
marginTop
:
2
,
marginRight
:
0
,
width
:
46
,
height
:
12
,
fontSize
:
11
,
color
:
'#444444'
,
width
:
80
,
height
:
16
,
textAlign
:
'center'
,
},
arrowImage
:
{
width
:
4
,
height
:
8
,
marginTop
:
4
,
marginLeft
:
4
,
backgroundColor
:
'transparent'
,
},
});
...
...
js/newArrival/components/newArrival/CategorySelector.js
0 → 100644
View file @
5f2a965
'use strict'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Dimensions
,
ListView
,
StyleSheet
,
Text
,
TouchableOpacity
,
View
,}
from
'react-native'
;
import
Immutable
from
'immutable'
;
export
default
class
CategorySelector
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
dataSource
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
!
Immutable
.
is
(
r1
,
r2
),
});
this
.
renderRow
=
this
.
renderRow
.
bind
(
this
);
this
.
scrollToCenter
=
this
.
scrollToCenter
.
bind
(
this
);
this
.
listView
=
null
;
this
.
scrollContentWidth
=
0
;
this
.
rowPosition
=
{};
}
scrollToCenter
(
rowID
)
{
if
(
!
this
.
listView
)
{
return
;
}
let
rowLayout
=
this
.
rowPosition
[
rowID
];
if
(
!
rowLayout
)
{
return
;
}
let
rowX
=
rowLayout
.
x
;
let
rowWidth
=
rowLayout
.
width
;
if
(
this
.
scrollContentWidth
<
width
)
{
return
;
}
// 位于列表头,且x坐标 < 屏幕x中心距离
if
(
rowX
+
rowWidth
/
2
<
width
/
2
)
{
this
.
listView
&&
this
.
listView
.
scrollTo
({
x
:
0
,
y
:
0
,
animated
:
true
});
return
;
}
// 位于列表尾,且(容器宽度-x坐标)< 屏幕x中心距离
if
((
this
.
scrollContentWidth
-
rowX
-
rowWidth
/
2
)
<
width
/
2
)
{
this
.
listView
&&
this
.
listView
.
scrollTo
({
x
:
this
.
scrollContentWidth
-
width
,
y
:
0
,
animated
:
true
});
return
;
}
let
scrollX
=
rowX
+
rowWidth
/
2
-
width
/
2
+
5
;
this
.
listView
&&
this
.
listView
.
scrollTo
({
x
:
scrollX
,
y
:
0
,
animated
:
true
});
}
renderRow
(
rowData
,
sectionID
,
rowID
,
highlightRow
)
{
let
marginLeft
=
(
rowID
==
0
)
?
0
:
8
;
let
color
=
rowID
==
this
.
props
.
selectedCategoryIndex
?
'#222222'
:
'#444444'
;
let
fontWeight
=
rowID
==
this
.
props
.
selectedCategoryIndex
?
'bold'
:
'normal'
;
return
(
<
TouchableOpacity
key
=
{
'row'
+
rowID
}
activeOpacity
=
{
1
}
style
=
{
styles
.
rowContainer
}
onPress
=
{()
=>
{
this
.
scrollToCenter
(
rowID
);
this
.
props
.
onPressCategoryTab
&&
this
.
props
.
onPressCategoryTab
(
rowData
,
rowID
);
this
.
props
.
changeCategorySelectorTitle
&&
this
.
props
.
changeCategorySelectorTitle
(
rowData
);
}}
onLayout
=
{(
event
)
=>
{
this
.
rowPosition
[
rowID
]
=
event
.
nativeEvent
.
layout
;
}}
>
<
View
style
=
{[
styles
.
categoryContainer
,
{
marginLeft
}]}
>
<
Text
style
=
{[
styles
.
categoryName
,
{
color
,
fontWeight
}]}
>
{
rowData
.
get
(
'tab_name'
)}
<
/Text
>
<
/View
>
{
rowID
==
this
.
props
.
selectedCategoryIndex
?
<
View
style
=
{[
styles
.
tabLine
,
{
left
:
marginLeft
,
right
:
22
}]}
/> : null
}
<
/TouchableOpacity
>
);
}
render
()
{
let
data
=
this
.
props
.
data
;
if
(
!
data
)
{
return
null
;
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
ListView
ref
=
{(
c
)
=>
{
this
.
listView
=
c
;
}}
enableEmptySections
=
{
true
}
contentContainerStyle
=
{
styles
.
contentContainer
}
dataSource
=
{
this
.
dataSource
.
cloneWithRows
(
data
.
toArray
())}
renderRow
=
{
this
.
renderRow
}
horizontal
=
{
true
}
showsHorizontalScrollIndicator
=
{
false
}
onContentSizeChange
=
{(
contentWidth
,
contentHeight
)
=>
{
this
.
scrollContentWidth
=
contentWidth
;
}}
/
>
{
data
.
size
>
0
?
<
View
style
=
{
styles
.
line
}
/> : null
}
<
/View
>
);
}
};
let
{
width
}
=
Dimensions
.
get
(
'window'
);
let
styles
=
StyleSheet
.
create
({
container
:
{
height
:
44
,
backgroundColor
:
'white'
,
flexDirection
:
'row'
,
},
contentContainer
:
{
marginLeft
:
15
,
},
rowContainer
:
{
justifyContent
:
'center'
,
},
categoryContainer
:
{
marginRight
:
22
,
},
categoryName
:
{
fontSize
:
14
,
color
:
'#b0b0b0'
,
},
line
:
{
position
:
'absolute'
,
width
,
height
:
0.5
,
left
:
0
,
bottom
:
0
,
backgroundColor
:
'#e5e5e5'
,
},
tabLine
:
{
position
:
'absolute'
,
height
:
2
,
bottom
:
0
,
backgroundColor
:
'#222222'
,
},
});
...
...
js/newArrival/components/newArrival/NewArrival.js
View file @
5f2a965
...
...
@@ -14,17 +14,16 @@ import ReactNative, {
Platform
,
Animated
,
Easing
,
ListView
,
ImageBackground
}
from
'react-native'
;
import
LoadingIndicator
from
'../../../common/components/LoadingIndicator'
;
import
LoadMoreIndicator
from
'../../../common/components/LoadMoreIndicator'
;
import
Immutable
,
{
Map
,
List
}
from
'immutable'
;
import
NewArrivalCategoryList
from
'./NewArrivalCategoryList'
;
import
NewArrivalHeader
from
'./NewArrivalHeader'
;
import
ProductListRow
from
'./ProductListRow'
;
import
NewArrivalCell
from
'./NewArrivalCell'
;
import
SectionHeader
from
'./SectionHeader'
;
import
NewArrivalMoreFilter
from
'../../../redPersonBrand/components/redBrand/BrandProductMoreFilter'
import
CategorySelector
from
'./CategorySelector'
;
import
NewArrivalHeader
from
'./NewArrivalHeader'
;
const
VIEWABILITY_CONFIG
=
{
minimumViewTime
:
3000
,
...
...
@@ -32,16 +31,16 @@ const VIEWABILITY_CONFIG = {
waitForInteraction
:
true
,
};
export
default
class
NewArrival
extends
React
.
PureComponent
{
constructor
(
props
)
{
super
(
props
);
this
.
renderSectionHeader
=
this
.
renderSectionHeader
.
bind
(
this
);
this
.
_onPressProductFilter
=
this
.
_onPressProductFilter
.
bind
(
this
);
this
.
_renderRow
=
this
.
_renderRow
.
bind
(
this
);
this
.
_renderHeader
=
this
.
_renderHeader
.
bind
(
this
);
this
.
renderItem
=
this
.
renderItem
.
bind
(
this
);
this
.
_renderSectionHeader
=
this
.
_renderSectionHeader
.
bind
(
this
);
this
.
_clickCategorySelector
=
this
.
_clickCategorySelector
.
bind
(
this
);
this
.
_onMomentumScrollBeginAndEnd
=
this
.
_onMomentumScrollBeginAndEnd
.
bind
(
this
);
this
.
_onScroll
=
this
.
_onScroll
.
bind
(
this
);
...
...
@@ -51,6 +50,11 @@ export default class NewArrival extends React.PureComponent {
showBackToTopButton
:
false
,
animValue
:
new
Animated
.
Value
(
height
-
44
-
44
-
64
),
}
this
.
dataSource
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
!
Immutable
.
is
(
r1
,
r2
),
sectionHeaderHasChanged
:
(
s1
,
s2
)
=>
!
Immutable
.
is
(
s1
,
s2
),
});
}
componentDidMount
()
{
...
...
@@ -58,151 +62,43 @@ export default class NewArrival extends React.PureComponent {
}
_onScroll
(
e
)
{
let
{
topPart
}
=
this
.
props
;
let
banner
=
topPart
.
get
(
'topList'
,
List
());
let
recommend
=
topPart
.
get
(
'brandList'
,
List
());
let
feature
=
topPart
.
get
(
'featuredList'
,
List
());
let
containerHeight
=
this
.
sumContainerHeight
();
let
y
=
e
.
nativeEvent
.
contentOffset
.
y
;
let
offset
=
y
-
containerHeight
+
height
;
let
sCurrentPage
=
Math
.
ceil
(
Math
.
ceil
(
offset
/
realHeight
)
/
10
);
this
.
setState
({
showBackToTopButtonType
:
0
,
sCurrentPage
});
}
sumContainerHeight
()
{
let
{
resourceInfo
}
=
this
.
props
;
let
resourceListTest
=
resourceInfo
.
resourceList
?
resourceInfo
.
resourceList
:
[];
let
containerHeight
=
0
;
if
(
banner
&&
banner
.
size
>
0
)
{
containerHeight
=
containerHeight
+
132
;
}
if
(
recommend
&&
recommend
.
size
>
0
)
{
containerHeight
=
containerHeight
+
180
;
}
if
(
feature
&&
feature
.
size
>
0
)
{
let
realHeight11
=
0
;
if
(
feature
.
size
=
1
)
{
realHeight11
=
Platform
.
OS
===
'ios'
?
featuredHight
+
50
:
featuredHight
+
65
;
resourceListTest
&&
resourceListTest
.
map
((
item
,
i
)
=>
{
let
template_name
=
item
.
get
(
'template_name'
);
if
(
template_name
===
'newFocus'
)
{
let
imageWidth
=
item
.
get
(
'image_width'
);
let
imageHeight
=
item
.
get
(
'image_height'
);
containerHeight
=
containerHeight
+
Math
.
ceil
(
width
*
imageHeight
/
imageWidth
);
}
if
(
feature
.
size
=
2
)
{
realHeight11
=
Platform
.
OS
===
'ios'
?
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
58
:
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
64
;
if
(
template_name
===
'divideImage'
)
{
containerHeight
=
containerHeight
+
10
;
}
if
(
feature
.
size
>
2
)
{
realHeight11
=
181
;
if
(
template_name
===
'newProductShopListFloor'
)
{
containerHeight
=
containerHeight
+
138
;
}
containerHeight
=
containerHeight
+
Math
.
ceil
(
realHeight11
);
}
let
y
=
e
.
nativeEvent
.
contentOffset
.
y
;
let
offset
=
y
-
containerHeight
+
height
;
let
sCurrentPage
=
Math
.
ceil
(
Math
.
ceil
(
offset
/
realHeight
)
*
2
/
10
);
this
.
setState
({
showBackToTopButtonType
:
0
,
sCurrentPage
,});
if
(
template_name
===
'splitJointImg'
)
{
let
imageWidth
=
item
.
get
(
'image_width'
);
let
imageHeight
=
item
.
get
(
'image_height'
);
containerHeight
=
containerHeight
+
Math
.
ceil
(
width
*
imageHeight
/
imageWidth
);
}
});
return
containerHeight
;
}
_onMomentumScrollBeginAndEnd
(
e
)
{
this
.
setState
({
showBackToTopButtonType
:
1
});
}
_onPressProductFilter
(
value
){
let
{
topPart
}
=
this
.
props
;
let
banner
=
topPart
.
get
(
'topList'
,
List
());
let
recommend
=
topPart
.
get
(
'brandList'
,
List
());
let
feature
=
topPart
.
get
(
'featuredList'
,
List
());
let
containerHeight
=
0
;
if
(
banner
&&
banner
.
size
>
0
)
{
containerHeight
=
containerHeight
+
132
;
}
if
(
recommend
&&
recommend
.
size
>
0
)
{
containerHeight
=
containerHeight
+
180
;
}
if
(
feature
&&
feature
.
size
>
0
)
{
let
realHeight11
=
0
;
if
(
feature
.
size
=
1
)
{
realHeight11
=
Platform
.
OS
===
'ios'
?
featuredHight
+
50
:
featuredHight
+
65
;
}
if
(
feature
.
size
=
2
)
{
realHeight11
=
Platform
.
OS
===
'ios'
?
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
58
:
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
64
;
}
if
(
feature
.
size
>
2
)
{
realHeight11
=
181
;
}
containerHeight
=
containerHeight
+
Math
.
ceil
(
realHeight11
);
}
if
(
value
===
'filter'
){
// this.sectionList && this.sectionList.scrollToLocation({itemIndex: 0,sectionIndex: 0, viewOffset: 20 + containerHeight,viewPosition: 1, animated: false});
}
if
(
value
===
'default'
){
this
.
sectionList
&&
this
.
sectionList
.
scrollToLocation
({
itemIndex
:
0
,
sectionIndex
:
0
,
viewOffset
:
realHeight
,
animated
:
false
});
}
this
.
props
.
onPressProductFilter
&&
this
.
props
.
onPressProductFilter
(
value
);
}
_renderHeader
()
{
let
{
isFetching
,
topPart
,
}
=
this
.
props
;
return
(
<
NewArrivalHeader
data
=
{
topPart
}
onPressBanner
=
{
this
.
props
.
onPressBanner
}
onPressShop
=
{
this
.
props
.
onPressShop
}
goToRecommendForYou
=
{
this
.
props
.
goToRecommendForYou
}
onPressCarouselItem
=
{
this
.
props
.
onPressCarouselItem
}
/
>
);
}
renderItem
(
item
)
{
let
rowData
=
item
.
item
;
let
index
=
item
.
index
;
if
(
this
.
props
.
topPart
.
isFetching
||!
rowData
)
{
return
null
;
}
let
{
productList
,
}
=
this
.
props
;
let
similarIndex
=
productList
.
get
(
'similarIndex'
);
return
(
<
ProductListRow
left
=
{
rowData
.
left
}
right
=
{
rowData
.
right
}
index
=
{
index
}
similarIndex
=
{
similarIndex
}
onPressCategory
=
{
this
.
props
.
onPressCategory
}
onPressHotSearch
=
{
this
.
props
.
onPressHotSearch
}
onPressProductListShop
=
{
this
.
props
.
onPressProductListShop
}
onPressArticle
=
{
this
.
props
.
onPressArticle
}
onPressProductListProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
/
>
);
}
renderSectionHeader
(
section
)
{
if
(
section
.
section
.
key
==
'latest'
)
{
return
(
<
SectionHeader
filterFactors
=
{
this
.
props
.
filterFactors
}
productList
=
{
this
.
props
.
productList
}
topPart
=
{
this
.
props
.
topPart
}
onPressFilter
=
{
this
.
_onPressProductFilter
}
onLayout
=
{(
evt
)
=>
{
yPosition
=
evt
.
nativeEvent
.
layout
.
y
;
}}
moreFilterSelectOrder
=
{
this
.
props
.
moreFilterSelectOrder
}
/
>
);
}
}
getCellKey
(
item
,
index
)
{
if
(
!
item
)
{
return
index
+
''
;
...
...
@@ -215,73 +111,137 @@ export default class NewArrival extends React.PureComponent {
if
(
skn
)
{
return
skn
+
''
;
}
}
return
index
+
''
;
}
_clickCategorySelector
(
rowData
)
{
let
params
=
{
animated
:
false
,
sectionIndex
:
0
,
itemIndex
:
0
,
viewOffset
:
realHeight
}
this
.
sectionList
.
scrollToLocation
(
params
);
}
return
index
+
''
;
_renderHeader
()
{
let
{
resourceInfo
}
=
this
.
props
;
return
(
<
NewArrivalHeader
data
=
{
resourceInfo
}
resourceJumpWithUrl
=
{
this
.
props
.
resourceJumpWithUrl
}
onPressShop
=
{
this
.
props
.
onPressShop
}
goToRecommendForYou
=
{
this
.
props
.
goToRecommendForYou
}
/
>
);
}
render
()
{
_renderSectionHeader
({
section
:
{
title
}
})
{
switch
(
title
)
{
case
'categoryList'
:
{
let
{
resourceInfo
,
productList
}
=
this
.
props
;
let
resourceList
=
resourceInfo
.
resourceList
?
resourceInfo
.
resourceList
.
toArray
()
:
[];
let
categoryList
;
resourceList
&&
resourceList
.
map
((
item
,
i
)
=>
{
let
template_name
=
item
.
get
(
'template_name'
);
if
(
template_name
===
'guessLike'
)
{
categoryList
=
item
.
get
(
'data'
);
}
});
return
(
<
CategorySelector
data
=
{
categoryList
}
selectedCategoryIndex
=
{
productList
.
selectedCategoryIndex
}
onPressCategoryTab
=
{(
rowData
,
rowID
)
=>
{
this
.
props
.
onPressCategoryTab
&&
this
.
props
.
onPressCategoryTab
(
rowData
,
rowID
);
}}
changeCategorySelectorTitle
=
{
this
.
_clickCategorySelector
}
/
>
);
}
default
:
return
null
;
}
}
_renderRow
(
item
)
{
let
index
=
item
.
index
;
let
rowData
=
item
.
item
;
let
{
productList
}
=
this
.
props
;
let
similarIndex
=
productList
.
get
(
'similarIndex'
);
switch
(
item
.
section
.
title
)
{
case
'categoryList'
:
{
return
(
<
ProductListRow
left
=
{
rowData
.
left
}
right
=
{
rowData
.
right
}
index
=
{
index
}
similarIndex
=
{
similarIndex
}
onPressCategory
=
{
this
.
props
.
onPressCategory
}
onPressHotSearch
=
{
this
.
props
.
onPressHotSearch
}
onPressProductListShop
=
{
this
.
props
.
onPressProductListShop
}
onPressArticle
=
{
this
.
props
.
onPressArticle
}
onPressProductListProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
jumpWithLinkUrl
=
{
this
.
props
.
jumpWithLinkUrl
}
/
>
);
}
default
:
return
null
;
}
}
render
()
{
let
{
resourceInfo
,
isFetching
,
productList
,
categoryFilterList
,
filterCategoryDetailFilterList
,
filterNameFactors
,
topPart
,
recommendForYou
,
cart_goods_count
,
searchResourceList
}
=
this
.
props
;
let
cart_goods_countString
=
cart_goods_count
>
99
?
'99+'
:
cart_goods_count
;
let
latest
=
productList
.
get
(
'list'
)
&&
productList
.
get
(
'list'
).
size
?
productList
.
get
(
'list'
).
toArray
():[];
let
isLoadingMore
=
productList
.
isFetching
&&
productList
.
currentPage
>
0
;
let
endReached
=
productList
.
endReached
;
let
pageCount
=
productList
?
productList
.
get
(
'pageCount'
)
:
0
;
let
banner
=
topPart
.
get
(
'topList'
,
List
());
let
recommend
=
topPart
.
get
(
'brandList'
,
List
());
let
feature
=
topPart
.
get
(
'featuredList'
,
List
());
let
containerHeight
=
this
.
sumContainerHeight
();
let
containerHeight
=
0
;
if
(
banner
&&
banner
.
size
>
0
)
{
containerHeight
=
containerHeight
+
132
;
let
rawDatalist
=
productList
&&
productList
.
get
(
'list'
)
?
productList
.
get
(
'list'
).
toArray
()
:
[]
if
(
rawDatalist
.
length
>
0
)
{
let
jumplist
=
searchResourceList
&&
searchResourceList
.
toArray
()
jumplist
&&
jumplist
.
forEach
((
item
)
=>
{
rawDatalist
.
splice
(
parseInt
(
item
.
get
(
'index'
)),
0
,
item
)
})
}
if
(
recommend
&&
recommend
.
size
>
0
)
{
containerHeight
=
containerHeight
+
180
;
}
if
(
feature
&&
feature
.
size
>
0
)
{
let
realHeight11
=
0
;
if
(
feature
.
size
=
1
)
{
realHeight11
=
Platform
.
OS
===
'ios'
?
featuredHight
+
50
:
featuredHight
+
65
;
}
if
(
feature
.
size
=
2
)
{
realHeight11
=
Platform
.
OS
===
'ios'
?
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
58
:
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
64
;
}
if
(
feature
.
size
>
2
)
{
realHeight11
=
181
;
}
containerHeight
=
containerHeight
+
Math
.
ceil
(
realHeight11
);
}
let
dataSource
=
[];
let
dataSize
=
latest
.
length
/
2
;
let
productSource
=
[];
let
dataSize
=
rawDatalist
.
length
/
2
;
for
(
let
i
=
0
;
i
<
dataSize
;
i
++
)
{
let
leftIndex
=
i
*
2
;
let
rightIndex
=
i
*
2
+
1
;
let
left
=
latest
[
leftIndex
];
let
right
=
latest
[
rightIndex
];
let
left
=
rawDatalist
[
leftIndex
];
let
right
=
rawDatalist
[
rightIndex
];
let
key
=
this
.
getCellKey
(
left
,
leftIndex
)
+
this
.
getCellKey
(
right
,
rightIndex
);
data
Source
.
push
({
product
Source
.
push
({
left
,
right
,
key
,
});
}
let
dataSource
=
[
{
title
:
'categoryList'
,
data
:
productSource
?
productSource
:
[]},
];
return
(
<
View
style
=
{
styles
.
container
}
>
...
...
@@ -290,14 +250,16 @@ export default class NewArrival extends React.PureComponent {
this
.
sectionList
=
c
;
}}
yh_viewVisible
=
{
true
}
sections
=
{
dataSource
}
stickySectionHeadersEnabled
=
{
true
}
ListHeaderComponent
=
{
this
.
_renderHeader
}
renderSectionHeader
=
{
this
.
renderSectionHeader
}
renderSectionHeader
=
{
this
.
_
renderSectionHeader
}
removeClippedSubviews
=
{
true
}
enableVirtualization
=
{
true
}
debug
=
{
false
}
disableVirtualization
=
{
false
}
refreshing
=
{
false
}
renderItem
=
{
this
.
renderItem
}
renderItem
=
{
this
.
_renderRow
}
ListFooterComponent
=
{()
=>
{
if
(
endReached
)
{
return
<
View
style
=
{
styles
.
placeholder
}
/>
;
...
...
@@ -315,7 +277,6 @@ export default class NewArrival extends React.PureComponent {
getItemLayout
=
{(
data
,
index
)
=>
(
{
length
:
realHeight
,
offset
:
realHeight
*
index
+
containerHeight
,
index
}
)}
sections
=
{[{
data
:
dataSource
,
key
:
'latest'
}]}
viewabilityConfig
=
{
VIEWABILITY_CONFIG
}
onEndReachedThreshold
=
{
10
}
onEndReached
=
{()
=>
{
...
...
@@ -325,6 +286,7 @@ export default class NewArrival extends React.PureComponent {
}}
onScroll
=
{
this
.
_onScroll
}
onMomentumScrollEnd
=
{
this
.
_onMomentumScrollBeginAndEnd
}
onScrollEndDrag
=
{(
event
)
=>
{
if
(
this
.
state
.
showBackToTopButton
&&
event
.
nativeEvent
.
contentOffset
.
y
<
height
)
{
Animated
.
timing
(
this
.
state
.
animValue
,
{
...
...
@@ -345,51 +307,24 @@ export default class NewArrival extends React.PureComponent {
}}
/
>
{
productList
.
isFilter
?
<
NewArrivalCategoryList
productList
=
{
productList
}
onPressFilter
=
{
this
.
_onPressProductFilter
}
lastSelected
=
{
this
.
props
.
productList
.
isFilter
}
moreFilter
=
{
this
.
props
.
productList
.
isMoreFilter
}
selectOrder
=
{
this
.
props
.
productList
.
order
}
categoryFilterList
=
{
categoryFilterList
}
filterCategoryDetailFilterList
=
{
filterCategoryDetailFilterList
}
onPressProductFilterLeftItem
=
{
this
.
props
.
onPressProductFilterLeftItem
}
filterNameFactors
=
{
filterNameFactors
}
onPressProductFilterRightItem
=
{
this
.
props
.
onPressProductFilterRightItem
}
onPressCloseMoreFilter
=
{
this
.
props
.
onPressCloseMoreFilter
}
onPressMoreFilter
=
{
this
.
props
.
onPressMoreFilter
}
moreFilterSelectOrder
=
{
this
.
props
.
moreFilterSelectOrder
}
/> : null
}
{
productList
.
isMoreFilter
?
<
NewArrivalMoreFilter
style
=
{{
height
:
height
-
40
-
64
,
}}
productList
=
{
productList
}
onPressCloseMoreFilter
=
{
this
.
props
.
onPressCloseMoreFilter
}
onPressMoreFilter
=
{
this
.
props
.
onPressMoreFilter
}
moreFilterSelectOrder
=
{
this
.
props
.
moreFilterSelectOrder
}
/> : null
}
<
Animated
.
View
style
=
{[
styles
.
shopCarButton
,{
top
:
this
.
state
.
animValue
}]}
>
<
TouchableOpacity
style
=
{{
width
:
40
,
height
:
40
,}}
activeOpacity
=
{
1
}
onPress
=
{()
=>
{
this
.
props
.
goShopCar
&&
this
.
props
.
goShopCar
();
}}
>
<
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
}
<
/Animated.View
>
<
Animated
.
View
style
=
{[
styles
.
shopCarButton
,{
top
:
this
.
state
.
animValue
}]}
>
<
TouchableOpacity
style
=
{{
width
:
40
,
height
:
40
,}}
activeOpacity
=
{
1
}
onPress
=
{()
=>
{
this
.
props
.
goShopCar
&&
this
.
props
.
goShopCar
();
}}
>
<
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
}
<
/Animated.View
>
{
this
.
state
.
showBackToTopButton
?
<
TouchableOpacity
style
=
{
styles
.
backToTopButton
}
...
...
@@ -422,26 +357,18 @@ 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
);
let
rowMarginBottom
=
Math
.
ceil
(
4
*
DEVICE_WIDTH_RATIO
);
let
realHeight
=
rowHeight
+
rowMarginTop
+
rowMarginBottom
;
let
featuredHight
=
Math
.
ceil
(((
width
-
30
)
*
220
)
/
690
);
let
styles
=
StyleSheet
.
create
({
container
:
{
...
...
@@ -479,7 +406,6 @@ let styles = StyleSheet.create({
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
cart_goods_countView
:
{
backgroundColor
:
'red'
,
position
:
'absolute'
,
...
...
@@ -490,10 +416,10 @@ let styles = StyleSheet.create({
paddingLeft
:
3
,
paddingRight
:
3
,
},
cart_goods_count
:
{
color
:
'white'
,
fontSize
:
12
,
textAlign
:
'center'
,
}
});
...
...
js/newArrival/components/newArrival/NewArrivalCell.js
View file @
5f2a965
...
...
@@ -18,12 +18,13 @@ import TagsCell from './TagsCell';
import
ShopCell
from
'./ShopCell'
;
import
ArticleCell
from
'./ArticleCell'
;
import
Immutable
,
{
Map
,
List
}
from
'immutable'
;
import
YH_Image
from
'../../../common/components/YH_Image'
;
export
default
class
NewArrivalCell
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
jumpWithLinkUrl
=
this
.
jumpWithLinkUrl
.
bind
(
this
);
}
shouldComponentUpdate
(
nextProps
){
...
...
@@ -36,6 +37,18 @@ export default class NewArrivalCell extends Component {
}
}
jumpWithLinkUrl
(
url
)
{
this
.
props
.
jumpWithLinkUrl
&&
this
.
props
.
jumpWithLinkUrl
(
url
);
}
renderJumpRow
=
(
rowData
)
=>
{
let
url
=
YH_Image
.
getSlicedUrl
(
rowData
.
get
(
'image'
),
225
,
225
,
2
);
return
(
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{
_
=>
this
.
jumpWithLinkUrl
(
rowData
.
get
(
'link_url'
))}
>
<
YH_Image
resizeMode
=
"stretch"
style
=
{
styles
.
jumpImage
}
url
=
{
url
}
/
>
<
/TouchableOpacity>
)
;
}
render
()
{
let
{
rowData
,
similarIndex
,
index
}
=
this
.
props
;
...
...
@@ -86,18 +99,22 @@ export default class NewArrivalCell extends Component {
similarIndex
,
}
=
this
.
props
;
return
(
<
ProductListCell
style
=
{[
styles
.
listContainer
,
customStyle
]}
key
=
{
'row'
+
index
}
rowID
=
{
index
}
data
=
{
rowData
}
similarIndex
=
{
similarIndex
}
onPressProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
/
>
);
if
(
parseInt
(
rowData
.
get
(
'rowType'
))
===
1
)
{
return
this
.
renderJumpRow
(
rowData
)
}
else
{
return
(
<
ProductListCell
style
=
{[
styles
.
listContainer
,
customStyle
]}
key
=
{
'row'
+
index
}
rowID
=
{
index
}
data
=
{
rowData
}
similarIndex
=
{
similarIndex
}
onPressProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
/
>
);
}
}
}
}
...
...
@@ -114,4 +131,10 @@ let styles = StyleSheet.create({
listContainer
:
{
width
:
width
/
2
,
},
jumpImage
:
{
width
:
(
width
-
2
)
*
0.5
,
height
:
(
width
-
80
)
*
0.5
+
32
+
40
,
overflow
:
'hidden'
,
flex
:
1
,
},
});
...
...
js/newArrival/components/newArrival/NewArrivalHeader.js
View file @
5f2a965
...
...
@@ -15,18 +15,14 @@ import ReactNative, {
import
SlicedImage
from
'../../../common/components/SlicedImage'
;
import
Immutable
,
{
Map
,
List
}
from
'immutable'
;
import
{
getSlicedUrl
}
from
'../../../classify/utils/Utils'
;
import
RecommendCell
from
'./RecommendCell'
;
import
BannerCell
from
'./BannerCell'
;
import
FeatureCell
from
'./FeatureCell'
;
import
JointCell
from
'./floor/JointCell'
;
import
FocusCell
from
'./floor/FocusCell'
;
export
default
class
NewArrivalHeader
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
renderBanner
=
this
.
renderBanner
.
bind
(
this
);
this
.
renderRecommend
=
this
.
renderRecommend
.
bind
(
this
);
this
.
renderFeature
=
this
.
renderFeature
.
bind
(
this
);
}
shouldComponentUpdate
(
nextProps
){
...
...
@@ -37,120 +33,83 @@ export default class NewArrivalHeader extends Component {
}
}
renderBanner
()
{
let
banner
=
this
.
props
.
data
.
get
(
'topList'
,
List
());
if
(
banner
&&
banner
.
size
>
0
)
{
return
(
<
View
style
=
{{
width
,
height
:
132
}}
>
<
BannerCell
style
=
{
styles
.
bannerImage
}
width
=
{
width
}
height
=
{
117
}
data
=
{
banner
}
onPress
=
{
this
.
props
.
onPressBanner
}
/
>
<
View
style
=
{
styles
.
separator
}
/
>
<
/View
>
);
}
return
null
;
}
renderRecommend
()
{
let
recommend
=
this
.
props
.
data
.
get
(
'brandList'
,
List
());
if
(
recommend
&&
recommend
.
size
>
0
)
{
return
(
<
RecommendCell
data
=
{
recommend
}
onPressShop
=
{
this
.
props
.
onPressShop
}
goToRecommendForYou
=
{
this
.
props
.
goToRecommendForYou
}
/
>
);
}
return
null
;
}
renderFeature
()
{
let
feature
=
this
.
props
.
data
.
get
(
'featuredList'
,
List
());
if
(
feature
&&
feature
.
size
>
0
)
{
return
(
<
FeatureCell
data
=
{
feature
}
onPressCarouselItem
=
{
this
.
props
.
onPressCarouselItem
}
/
>
);
}
return
null
;
}
render
()
{
let
{
data
}
=
this
.
props
;
let
banner
=
data
.
get
(
'topList'
,
List
());
let
recommend
=
data
.
get
(
'brandList'
,
List
());
let
feature
=
data
.
get
(
'featuredList'
,
List
());
let
containerHeight
=
0
;
if
(
banner
&&
banner
.
size
>
0
)
{
containerHeight
=
containerHeight
+
132
;
}
if
(
recommend
&&
recommend
.
size
>
0
)
{
containerHeight
=
containerHeight
+
180
;
}
if
(
feature
&&
feature
.
size
>
0
)
{
let
realHeight
=
0
;
if
(
feature
.
size
=
1
)
{
realHeight
=
Platform
.
OS
===
'ios'
?
featuredHight
+
50
:
featuredHight
+
65
;
}
if
(
feature
.
size
=
2
)
{
realHeight
=
Platform
.
OS
===
'ios'
?
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
58
:
(((
width
-
48
)
/
2
)
*
220
)
/
330
+
64
;
}
if
(
feature
.
size
>
2
)
{
realHeight
=
181
;
}
containerHeight
=
containerHeight
+
realHeight
;
}
if
(
!
data
)
{
return
null
;
}
let
resourceList
=
data
.
resourceList
?
data
.
resourceList
:
[];
if
(
!
resourceList
)
{
return
null
;
}
return
(
<
View
style
=
{[
styles
.
container
,
{
height
:
containerHeight
}]}
>
{
this
.
renderBanner
()}
<
View
style
=
{[
styles
.
container
]}
>
{
resourceList
&&
resourceList
.
map
((
item
,
i
)
=>
{
let
template_name
=
item
.
get
(
'template_name'
);
switch
(
template_name
)
{
case
'newFocus'
:
{
if
(
!
item
)
{
return
null
;
}
return
(
<
FocusCell
data
=
{
item
.
get
(
'data'
)}
imageWidth
=
{
item
.
get
(
'image_width'
)}
imageHeight
=
{
item
.
get
(
'image_height'
)}
resourceJumpWithUrl
=
{
this
.
props
.
resourceJumpWithUrl
}
/
>
);
}
case
'divideImage'
:
{
if
(
!
item
)
{
return
null
;
}
let
data
=
item
&&
item
.
get
(
'data'
).
toJS
();
let
divideImage
=
getSlicedUrl
(
data
[
0
].
src
,
width
,
10
,
2
);
if
(
!
divideImage
)
{
return
null
;
}
return
(
<
Image
source
=
{{
uri
:
divideImage
}}
style
=
{{
width
:
width
,
height
:
10
}}
resizeMode
=
{
'cover'
}
/
>
);
}
case
'newProductShopListFloor'
:
{
if
(
!
item
)
{
return
null
;
}
return
(
<
RecommendCell
data
=
{
item
.
get
(
'list'
)}
onPressShop
=
{
this
.
props
.
onPressShop
}
goToRecommendForYou
=
{
this
.
props
.
goToRecommendForYou
}
/
>
);
}
case
'splitJointImg'
:
{
if
(
!
item
)
{
return
null
;
}
return
(
<
JointCell
data
=
{
item
.
get
(
'data'
)}
isExtends
=
{
item
.
get
(
'is_extend'
)}
imageWidth
=
{
item
.
get
(
'image_width'
)}
imageHeight
=
{
item
.
get
(
'image_height'
)}
floorId
=
{
item
.
get
(
'template_id'
)}
floorName
=
{
item
.
get
(
'template_name'
)}
fIndex
=
{
i
+
1
}
resourceJumpWithUrl
=
{
this
.
props
.
resourceJumpWithUrl
}
/
>
);
}
default
:
return
null
;
}
})}
{
this
.
renderRecommend
()}
{
this
.
renderFeature
()}
<
/View
>
);
);
}
}
let
{
width
,
height
}
=
Dimensions
.
get
(
'window'
);
let
featuredHight
=
Math
.
ceil
(((
width
-
30
)
*
220
)
/
690
);
let
styles
=
StyleSheet
.
create
({
container
:
{
backgroundColor
:
'white'
,
},
bannerImage
:
{
width
:
width
,
height
:
117
,
backgroundColor
:
'gray'
,
},
separator
:
{
width
:
width
,
height
:
15
,
backgroundColor
:
'#f0f0f0'
,
},
});
...
...
js/newArrival/components/newArrival/ProductListRow.js
View file @
5f2a965
...
...
@@ -15,8 +15,6 @@ export default class ProductListRow extends Component {
constructor
(
props
)
{
super
(
props
);
}
shouldComponentUpdate
(
nextProps
){
...
...
@@ -47,6 +45,7 @@ export default class ProductListRow extends Component {
onPressProductListProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
jumpWithLinkUrl
=
{
this
.
props
.
jumpWithLinkUrl
}
/> : null
}
{
right
?
<
NewArrivalCell
rowData
=
{
right
}
...
...
@@ -59,6 +58,7 @@ export default class ProductListRow extends Component {
onPressProductListProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
jumpWithLinkUrl
=
{
this
.
props
.
jumpWithLinkUrl
}
/> : null
}
<
/View
>
<
/View
>
...
...
@@ -70,7 +70,7 @@ let {width, height} = Dimensions.get('window');
const
DEVICE_WIDTH_RATIO
=
width
/
320
;
let
rowHeight
=
Math
.
ceil
(
254
*
width
/
320
);
let
rowHeight
=
Math
.
ceil
(
254
*
DEVICE_WIDTH_RATIO
);
let
rowMarginTop
=
Math
.
ceil
(
10
*
DEVICE_WIDTH_RATIO
);
let
rowMarginBottom
=
Math
.
ceil
(
4
*
DEVICE_WIDTH_RATIO
);
...
...
js/newArrival/components/newArrival/RecommendCell.js
View file @
5f2a965
...
...
@@ -30,17 +30,14 @@ export default class RecommendCell extends Component {
<
BrandCell
index
=
{
rowID
}
data
=
{
rowData
}
onPressShop
=
{
this
.
props
.
onPressShop
}
/
>
)
}
render
()
{
let
{
data
}
=
this
.
props
;
if
(
!
data
)
{
return
null
;
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
header
}
>
<
Text
style
=
{
styles
.
headerText
}
>
为您推荐
<
/Text
>
<
TouchableOpacity
style
=
{
styles
.
moreButton
}
onPress
=
{()
=>
{
this
.
props
.
goToRecommendForYou
&&
this
.
props
.
goToRecommendForYou
();
}}
>
<
Image
style
=
{
styles
.
moreImage
}
source
=
{
require
(
'../../image/more.png'
)}
/
>
<
/TouchableOpacity
>
<
Text
style
=
{
styles
.
headerText
}
>
推荐品牌
<
/Text
>
<
/View
>
<
ListView
initialListSize
=
{
100
}
...
...
@@ -61,42 +58,32 @@ let {width, height} = Dimensions.get('window');
let
styles
=
StyleSheet
.
create
({
container
:
{
height
:
180
,
width
:
width
,
backgroundColor
:
'white'
,
},
header
:
{
backgroundColor
:
'white'
,
width
:
width
,
height
:
40
,
alignItems
:
'center'
,
flexDirection
:
'row'
,
width
:
100
,
height
:
22
,
marginLeft
:
15
,
marginTop
:
20
,
},
headerText
:
{
fontSize
:
14
,
color
:
'black'
,
fontSize
:
16
,
color
:
'#222222'
,
width
:
width
,
textAlign
:
'center'
,
},
moreButton
:
{
position
:
'absolute'
,
width
:
60
,
height
:
40
,
left
:
width
-
75
,
},
moreImage
:
{
width
:
22
,
height
:
4
,
marginTop
:
18
,
marginLeft
:
38
,
textAlign
:
'left'
,
fontFamily
:
'PingFang-SC-Medium'
,
fontWeight
:
'bold'
,
},
contentContainer
:
{
backgroundColor
:
'white'
,
height
:
125
,
paddingLeft
:
15
,
paddingRight
:
15
},
separator
:
{
width
:
width
,
height
:
15
,
backgroundColor
:
'#f0f0f0'
,
height
:
20
,
backgroundColor
:
'#FFFFFF'
,
},
});
...
...
js/newArrival/components/newArrival/floor/FocusCell.js
0 → 100644
View file @
5f2a965
'use strict'
;
import
React
from
'react'
;
import
ReactNative
from
'react-native'
;
import
ImageSlider
from
'./ImageSlider'
;
import
Immutable
from
'immutable'
;
const
{
StyleSheet
,
Dimensions
,
View
,
}
=
ReactNative
;
export
default
class
FocusCell
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
}
shouldComponentUpdate
(
nextProps
)
{
if
(
Immutable
.
is
(
nextProps
.
data
,
this
.
props
.
data
))
{
return
false
;
}
else
{
return
true
;
}
}
render
()
{
let
{
data
,
imageWidth
,
imageHeight
}
=
this
.
props
;
let
sliderHeight
=
Math
.
ceil
(
width
*
imageHeight
/
imageWidth
);
return
(
<
View
style
=
{{
height
:
sliderHeight
,
width
:
width
}}
>
<
ImageSlider
resource
=
{
data
}
sliderWidth
=
{
width
}
sliderHeight
=
{
sliderHeight
}
resourceJumpWithUrl
=
{
this
.
props
.
resourceJumpWithUrl
}
/
>
<
/View
>
);
}
}
let
{
width
,
height
}
=
Dimensions
.
get
(
'window'
);
const
DEVICE_WIDTH_RATIO
=
width
/
375
;
let
styles
=
StyleSheet
.
create
({
banner
:
{},
});
...
...
js/newArrival/components/newArrival/floor/ImageSlider.js
0 → 100644
View file @
5f2a965
'use strict'
;
import
React
from
'react'
;
import
ReactNative
from
'react-native'
;
import
YH_Swiper
from
'../../../../common/components/YH_Swiper'
;
import
YH_Image
from
'../../../../common/components/YH_Image'
;
import
Immutable
from
'immutable'
;
const
{
View
,
Image
,
TouchableOpacity
,
StyleSheet
,
Dimensions
,
Platform
,
}
=
ReactNative
;
export
default
class
ImageSlider
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
_handleParamsJumpWithUrl
=
this
.
_handleParamsJumpWithUrl
.
bind
(
this
);
}
shouldComponentUpdate
(
nextProps
)
{
if
(
Immutable
.
is
(
nextProps
.
resource
,
this
.
props
.
resource
)
&&
nextProps
.
sliderWidth
==
this
.
props
.
sliderWidth
&&
nextProps
.
sliderHeight
==
this
.
props
.
sliderHeight
)
{
return
false
;
}
else
{
return
true
;
}
}
_handleParamsJumpWithUrl
(
index
,
url
)
{
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let
params
=
{
I_INDEX
:
index
,
F_URL
:
url
};
this
.
props
.
resourceJumpWithUrl
&&
this
.
props
.
resourceJumpWithUrl
(
url
,
'banner'
,
params
);
}
render
()
{
let
{
resource
,
sliderWidth
,
sliderHeight
}
=
this
.
props
;
if
(
!
resource
||
resource
.
size
==
0
)
{
return
null
;
}
let
data
=
this
.
props
.
resource
.
toJS
();
if
(
data
.
length
==
1
)
{
let
imageUrl
=
YH_Image
.
getSlicedUrl
(
data
[
0
].
src
,
sliderWidth
,
sliderHeight
,
2
);
return
(
<
TouchableOpacity
activeOpacity
=
{
1
}
yh_exposureData
=
{
data
[
0
].
yh_exposureData
}
style
=
{{
width
:
sliderWidth
,
height
:
sliderHeight
}}
onPress
=
{()
=>
{
this
.
_handleParamsJumpWithUrl
(
1
,
data
[
0
].
url
)
}}
>
<
YH_Image
url
=
{
imageUrl
}
style
=
{{
width
:
sliderWidth
,
height
:
sliderHeight
}}
/>
<
/TouchableOpacity>
);
}
else
{
return
(
<
YH_Swiper
showsButtons
=
{
false
}
loop
=
{
true
}
autoplay
=
{
true
}
autoplayTimeout
=
{
3
}
width
=
{
sliderWidth
}
height
=
{
sliderHeight
}
paginationStyle
=
{{
backgroundColor
:
'rgba(68, 68, 68, 0.2)'
,
bottom
:
8
,
height
:
10
,
width
:
data
.
length
*
12
,
borderRadius
:
5
,
marginLeft
:
(
sliderWidth
-
data
.
length
*
12
)
/
2
,
paddingBottom
:
0
,
}}
>
{
data
.
map
((
item
,
i
)
=>
{
let
imageUrl
=
YH_Image
.
getSlicedUrl
(
item
.
src
,
sliderWidth
,
sliderHeight
,
2
);
return
(
<
TouchableOpacity
key
=
{
i
}
activeOpacity
=
{
1
}
yh_exposureData
=
{
item
.
yh_exposureData
}
onPress
=
{()
=>
{
this
.
_handleParamsJumpWithUrl
(
i
+
1
,
item
.
url
);
}}
>
<
YH_Image
url
=
{
imageUrl
}
style
=
{{
width
:
sliderWidth
,
height
:
sliderHeight
}}
/>
<
/TouchableOpacity>
);
})}
<
/YH_Swiper>
);
}
}
}
...
...
js/newArrival/components/newArrival/floor/JointCell.js
0 → 100644
View file @
5f2a965
'use strict'
;
import
React
from
'react'
;
import
ReactNative
,
{
Platform
}
from
'react-native'
;
import
YH_Image
from
'../../../../common/components/YH_Image'
;
import
Immutable
from
'immutable'
;
const
{
TouchableOpacity
,
Dimensions
,
View
}
=
ReactNative
;
export
default
class
JointCell
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
_handleParamsJumpWithUrl
=
this
.
_handleParamsJumpWithUrl
.
bind
(
this
);
}
shouldComponentUpdate
(
nextProps
)
{
if
(
Immutable
.
is
(
nextProps
.
data
,
this
.
props
.
data
))
{
return
false
;
}
else
{
return
true
;
}
}
_handleParamsJumpWithUrl
(
id
,
url
)
{
// 为埋点提供参数组装
// 后期请将所有的点击事件由 resourceJumpWithUrl 修改为自己独有的事件
// 由于多数组件都使用的 resourceJumpWithUrl ,埋点传参无法正常进行
let
params
=
{
ID
:
id
};
this
.
props
.
resourceJumpWithUrl
&&
this
.
props
.
resourceJumpWithUrl
(
url
,
'icon'
,
params
);
}
render
()
{
let
{
data
,
isExtends
,
imageWidth
,
imageHeight
,
floorId
,
floorName
,
fIndex
}
=
this
.
props
;
let
source
=
this
.
props
.
data
.
toJS
();
if
(
!
source
)
{
return
null
;
}
let
marginLeft
=
isExtends
===
'1'
?
0
:
15
;
let
list
=
source
.
urls
;
let
touchWidth
=
(
width
-
marginLeft
*
2
)
/
list
.
length
;
let
pageName
=
Platform
.
OS
===
'android'
?
'aFP_NewArrival'
:
'iFP_NewArrival'
;
let
ratioHeight
=
Math
.
ceil
(
width
*
imageHeight
/
imageWidth
);
return
(
<
View
>
<
YH_Image
url
=
{
YH_Image
.
getSlicedUrl
(
source
.
src
,
width
-
marginLeft
*
2
,
ratioHeight
,
2
)}
resizeMode
=
{
'stretch'
}
style
=
{{
width
:
width
-
marginLeft
*
2
,
height
:
ratioHeight
,
marginLeft
:
marginLeft
}}
/
>
<
View
style
=
{{
flexDirection
:
'row'
,
position
:
'absolute'
,
top
:
0
,
left
:
marginLeft
,
bottom
:
0
,
right
:
marginLeft
}}
>
{
list
.
map
((
item
,
i
)
=>
{
let
exposureData
=
{
F_ID
:
floorId
,
P_NAME
:
pageName
,
F_NAME
:
floorName
,
F_URL
:
item
,
F_INDEX
:
fIndex
,
I_INDEX
:
parseInt
(
i
)
+
1
+
""
,
exposureEnd
:
1
,
}
return
(
<
TouchableOpacity
key
=
{
i
}
activeOpacity
=
{
1
}
yh_exposureData
=
{
exposureData
}
style
=
{{
width
:
touchWidth
,
height
:
ratioHeight
}}
onPress
=
{()
=>
{
this
.
_handleParamsJumpWithUrl
(
i
+
1
,
item
);
}}
>
<
/TouchableOpacity
>
);
})
}
<
/View
>
<
/View
>
);
}
}
let
{
width
}
=
Dimensions
.
get
(
'window'
);
const
DEVICE_WIDTH_RATIO
=
width
/
375
;
...
...
js/newArrival/constants/actionTypes.js
View file @
5f2a965
...
...
@@ -18,13 +18,13 @@ export default keyMirror({
GET_SHOPCARTCOUNT_REQUEST
:
null
,
GET_SHOPCARTCOUNT_SUCCESS
:
null
,
GET_SHOPCARTCOUNT_FAILURE
:
null
,
PRODUCT_LIST_REQUEST
:
null
,
PRODUCT_LIST_SUCCESS
:
null
,
PRODUCT_LIST_FAILURE
:
null
,
PRODUCT_LIST_SUCCESS
:
null
,
PRODUCT_LIST_FAILURE
:
null
,
FILTER_LIST_VIEW
:
null
,
FILTER_MORE_VIEW
:
null
,
FILTER_MORE_VIEW
:
null
,
RESET_LIST_PAGE_INFO
:
null
,
SET_PRODUCT_LIST_FILTER
:
null
,
PRODUCT_FILTER_ACTION
:
null
,
...
...
@@ -34,4 +34,11 @@ export default keyMirror({
UPDATE_MORE_FILTER_SELECTED_ORDER
:
null
,
FILTER_DATA_SUCCESS
:
null
,
RESOURCE_INFO_REQUEST
:
null
,
RESOURCE_INFO_SUCCESS
:
null
,
RESOURCE_INFO_FAILURE
:
null
,
STORE_CURRENT_TAB_VALUE
:
null
,
SET_PRODUCT_PARAMS
:
null
,
});
...
...
js/newArrival/containers/NewArrivalContainer.js
View file @
5f2a965
...
...
@@ -19,7 +19,6 @@ import * as newArrivalActions from '../reducers/newArrival/newArrivalActions';
import
NewArrival
from
'../components/newArrival/NewArrival'
;
const
actions
=
[
newArrivalActions
,
];
...
...
@@ -46,32 +45,56 @@ function mapDispatchToProps(dispatch) {
class
NewArrivalContainer
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
tabFloorId
:
''
,
jointFloorId
:
''
,
focusFloorId
:
''
,
shopFloorId
:
''
,
}
this
.
_onEndReached
=
this
.
_onEndReached
.
bind
(
this
);
this
.
_onPressProductFilter
=
this
.
_onPressProductFilter
.
bind
(
this
);
this
.
_onPressProductFilterLeftItem
=
this
.
_onPressProductFilterLeftItem
.
bind
(
this
);
this
.
_onPressProductFilterRightItem
=
this
.
_onPressProductFilterRightItem
.
bind
(
this
);
this
.
_onPressMoreFilter
=
this
.
_onPressMoreFilter
.
bind
(
this
);
this
.
_onPressCloseMoreFilter
=
this
.
_onPressCloseMoreFilter
.
bind
(
this
);
this
.
_onPressShop
=
this
.
_onPressShop
.
bind
(
this
);
this
.
_onPressProductListProduct
=
this
.
_onPressProductListProduct
.
bind
(
this
);
this
.
_goToRecommendForYou
=
this
.
_goToRecommendForYou
.
bind
(
this
);
this
.
_onPressCategory
=
this
.
_onPressCategory
.
bind
(
this
);
this
.
_onPressHotSearch
=
this
.
_onPressHotSearch
.
bind
(
this
);
this
.
_onPressArticle
=
this
.
_onPressArticle
.
bind
(
this
);
this
.
_onPressBanner
=
this
.
_onPressBanner
.
bind
(
this
);
this
.
_onPressCarouselItem
=
this
.
_onPressCarouselItem
.
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
);
this
.
_onPressDislike
=
this
.
_onPressDislike
.
bind
(
this
);
this
.
_goToRecommendForYou
=
this
.
_goToRecommendForYou
.
bind
(
this
);
this
.
_goShopCar
=
this
.
_goShopCar
.
bind
(
this
);
this
.
_resourceJumpWithUrl
=
this
.
_resourceJumpWithUrl
.
bind
(
this
);
this
.
_onPressCategoryTab
=
this
.
_onPressCategoryTab
.
bind
(
this
);
this
.
_jumpWithLinkUrl
=
this
.
_jumpWithLinkUrl
.
bind
(
this
);
}
componentDidMount
()
{
this
.
props
.
actions
.
getTopInfo
();
this
.
props
.
actions
.
getProductList
();
this
.
props
.
actions
.
getShopCartCount
();
let
self
=
this
;
this
.
props
.
actions
.
getResourceInfo
(
function
(
json
)
{
json
&&
json
.
forEach
(
item
=>
{
if
(
item
.
template_name
===
'newFocus'
&&
item
.
data
)
{
self
.
setState
({
focusFloorId
:
item
.
template_id
});
}
if
(
item
.
template_name
===
'newProductShopListFloor'
&&
item
.
data
)
{
self
.
setState
({
shopFloorId
:
item
.
template_id
});
}
if
(
item
.
template_name
===
'splitJointImg'
&&
item
.
data
)
{
self
.
setState
({
jointFloorId
:
item
.
template_id
});
}
if
(
item
.
template_name
===
'guessLike'
&&
item
.
data
)
{
self
.
setState
({
tabFloorId
:
item
.
template_id
});
let
data
=
item
.
data
[
0
];
let
tabName
=
data
.
tab_name
;
let
queryList
=
data
.
query
;
data
&&
self
.
props
.
actions
.
storeCurrentTabValue
(
0
,
tabName
,
queryList
);
}
})
});
this
.
props
.
actions
.
getShopCartCount
();
// this.props.actions.setShowSimilarGuider(true);
}
...
...
@@ -84,120 +107,35 @@ class NewArrivalContainer extends Component {
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
}
_onLongPressProduct
(
rowID
)
{
if
(
rowID
)
{
this
.
props
.
actions
.
setSimilarIndex
(
rowID
);
}
}
_onPressFindSimilar
(
product
)
{
if
(
!
product
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpFindSimilar
(
product
.
toJS
());
ReactNative
.
NativeModules
.
YH_CommonHelper
.
setSimilarGuiderVisible
(
false
);
this
.
props
.
actions
.
setSimilarIndex
(
-
1
);
this
.
props
.
actions
.
setShowSimilarGuider
(
false
,
false
);
}
_onPressDislike
()
{
}
_onEndReached
()
{
InteractionManager
.
runAfterInteractions
(()
=>
{
this
.
props
.
actions
.
getProductList
();
});
}
_onPressProductFilter
(
value
)
{
if
(
value
===
'filter'
)
{
this
.
props
.
actions
.
setFilterView
(
!
this
.
props
.
newArrival
.
productList
.
isFilter
);
this
.
props
.
actions
.
setFilterMoreView
(
false
);
}
else
if
(
value
===
'default'
){
this
.
props
.
actions
.
setFilterMoreView
(
!
this
.
props
.
newArrival
.
productList
.
isMoreFilter
);
this
.
props
.
actions
.
setFilterView
(
false
);
}
else
{
this
.
props
.
actions
.
setFilterMoreView
(
false
);
this
.
props
.
actions
.
setFilterView
(
false
);
this
.
props
.
actions
.
resetListPageInfo
();
this
.
props
.
actions
.
setProductListFilter
(
value
);
this
.
props
.
actions
.
getProductList
(
true
);
}
}
_onPressProductFilterLeftItem
(
value
)
{
this
.
props
.
actions
.
setProductFilterFactors
(
value
);
_jumpWithLinkUrl
(
url
)
{
if
(
!
url
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
}
_onPressProductFilterRightItem
(
item
,
value
)
{
this
.
props
.
actions
.
setProductFilterFactors
(
item
,
value
);
this
.
props
.
actions
.
setFilterView
(
false
);
this
.
props
.
actions
.
resetListPageInfo
();
this
.
props
.
actions
.
getProductList
(
true
);
}
_onPressMoreFilter
(
value
,
name
){
let
{
productList
}
=
this
.
props
.
newArrival
;
if
(
value
==
productList
.
get
(
'order'
))
{
this
.
props
.
actions
.
setFilterMoreView
(
false
);
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_GOODS_LIST_HOT_TAB_C'
,
{
TYPE_ID
:
3
});
this
.
props
.
actions
.
updateMoreFilterSelectOrder
(
value
);
this
.
props
.
actions
.
setFilterMoreView
(
false
);
this
.
props
.
actions
.
resetListPageInfo
();
this
.
props
.
actions
.
setProductListFilter
(
value
);
this
.
props
.
actions
.
getProductList
(
true
);
if
(
name
==
'人气'
){
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_GOODS_LIST_HOT_TAB_C'
,
{
TYPE_ID
:
3
});
}
_resourceJumpWithUrl
(
url
,
type
,
params
)
{
if
(
!
url
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
}
_onPressCloseMoreFilter
(){
this
.
props
.
actions
.
setFilterMoreView
(
false
);
}
let
param
;
if
(
type
===
'banner'
&&
params
)
{
param
=
{
F_ID
:
this
.
state
.
focusFloorId
,
F_URL
:
url
};
}
_onPressCarouselItem
(
url
,
index
=
0
)
{
if
(
!
url
)
{
return
;
}
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
++
;
}
F_INDEX
=
F_INDEX
.
toString
();
let
param
=
{
F_ID
:
1003
,
F_NM
:
'精选抢先看'
,
F_INDEX
,
I_INDEX
,
F_URL
:
url
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
if
(
type
===
'icon'
&&
params
)
{
param
=
{
F_ID
:
this
.
state
.
jointFloorId
,
F_URL
:
url
};
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
}
_onPressBanner
(
url
,
index
=
0
)
{
if
(
!
url
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
let
I_INDEX
=
parseInt
(
index
)
+
1
;
I_INDEX
=
I_INDEX
.
toString
();
let
param
=
{
F_ID
:
1001
,
F_NM
:
'BANNER'
,
F_INDEX
:
1
,
I_INDEX
,
F_URL
:
url
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
_onPressCategoryTab
(
data
,
index
)
{
let
queryList
=
data
.
get
(
'query'
).
toJS
();
data
&&
this
.
props
.
actions
.
storeCurrentTabValue
(
index
,
data
.
get
(
'tab_name'
),
queryList
);
}
_onPressArticle
(
url
,
index
=
0
,
article_id
)
{
...
...
@@ -205,30 +143,22 @@ class NewArrivalContainer extends Component {
return
;
}
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
&&
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
:
'fashionArticle'
,
ARTICLE_ID
:
article_id
,
}
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: 'fashionArticle',
// ARTICLE_ID: article_id,
// }
// ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
}
_onPressCategory
(
data
,
l_index
=
0
,
index
=
0
)
{
...
...
@@ -242,7 +172,7 @@ class NewArrivalContainer extends Component {
let
relation_parameter
=
{
sort
:
data
.
get
(
'relationParameter'
)};
let
node_count
=
0
;
let
sort_ico
=
''
;
let
value
=
{
parent_id
,
category_name
,
...
...
@@ -253,32 +183,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
)
{
...
...
@@ -287,31 +208,55 @@ class NewArrivalContainer extends Component {
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
hotSearchWithKeyword
(
data
);
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
++
;
// 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);
}
_onLongPressProduct
(
rowID
)
{
if
(
rowID
)
{
this
.
props
.
actions
.
setSimilarIndex
(
rowID
);
}
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
,
}
_onPressFindSimilar
(
product
)
{
if
(
!
product
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpFindSimilar
(
product
.
toJS
());
ReactNative
.
NativeModules
.
YH_CommonHelper
.
setSimilarGuiderVisible
(
false
);
this
.
props
.
actions
.
setSimilarIndex
(
-
1
);
this
.
props
.
actions
.
setShowSimilarGuider
(
false
,
false
);
}
_onEndReached
()
{
let
{
selectedTabList
}
=
this
.
props
.
newArrival
;
let
paramsDic
=
{};
selectedTabList
&&
selectedTabList
.
map
((
item
,
index
)
=>
{
let
res
=
{
...
paramsDic
,
...
item
,
}
paramsDic
=
res
;
})
InteractionManager
.
runAfterInteractions
(()
=>
{
this
.
props
.
actions
.
getProductList
(
paramsDic
);
});
}
_onPressProductListShop
(
data
,
index
=
0
)
{
...
...
@@ -329,33 +274,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
,
...
...
@@ -371,19 +308,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_ID
:
this
.
state
.
shopFloorId
,
F_URL
:
url
,
SHOP_ID
:
shops_id
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
...
...
@@ -395,97 +322,61 @@ 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
:
this
.
state
.
tabFloorId
,
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
{
topPart
,
categoryFilterList
,
filterCategoryDetailFilterList
,
productList
,
filterFactors
,
filterNameFactors
,
showSimilarGuider
,
moreFilterSelectOrder
,
cart_goods_count
,
}
=
newArrival
;
let
isFetching
=
topPart
.
isFetching
||
(
productList
.
list
.
size
==
0
&&
productList
.
isFetching
)
||
(
productList
.
list
.
size
>
0
&&
productList
.
isFetching
&&
productList
.
currentPage
==
0
);
let
{
resourceInfo
,
productList
,
searchResourceList
,
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
}
>
<
NewArrival
isFetching
=
{
isFetching
}
isFetching
=
{
false
}
productList
=
{
productList
}
moreFilterSelectOrder
=
{
moreFilterSelectOrder
}
categoryFilterList
=
{
categoryFilterList
}
filterCategoryDetailFilterList
=
{
filterCategoryDetailFilterList
}
filterFactors
=
{
filterFactors
}
filterNameFactors
=
{
filterNameFactors
}
searchResourceList
=
{
searchResourceList
}
resourceInfo
=
{
resourceInfo
}
cart_goods_count
=
{
cart_goods_count
}
topPart
=
{
topPart
}
showSimilarGuider
=
{
showSimilarGuider
}
goShopCar
=
{
this
.
_goShopCar
}
onEndReached
=
{
this
.
_onEndReached
}
onPressProductFilter
=
{
this
.
_onPressProductFilter
}
onPressProductFilterLeftItem
=
{
this
.
_onPressProductFilterLeftItem
}
onPressProductFilterRightItem
=
{
this
.
_onPressProductFilterRightItem
}
onPressMoreFilter
=
{
this
.
_onPressMoreFilter
}
onPressCloseMoreFilter
=
{
this
.
_onPressCloseMoreFilter
}
onPressShop
=
{
this
.
_onPressShop
}
onPressProductListProduct
=
{
this
.
_onPressProductListProduct
}
goToRecommendForYou
=
{
this
.
_goToRecommendForYou
}
onPressShop
=
{
this
.
_onPressShop
}
onPressCategory
=
{
this
.
_onPressCategory
}
onPressHotSearch
=
{
this
.
_onPressHotSearch
}
onPressArticle
=
{
this
.
_onPressArticle
}
onPressBanner
=
{
this
.
_onPressBanner
}
onPressCarouselItem
=
{
this
.
_onPressCarouselItem
}
onPressProductListShop
=
{
this
.
_onPressProductListShop
}
onPressProductListProduct
=
{
this
.
_onPressProductListProduct
}
onLongPressProduct
=
{
this
.
_onLongPressProduct
}
onPressFindSimilar
=
{
this
.
_onPressFindSimilar
}
onPressDislike
=
{
this
.
_onPressDislike
}
goShopCar
=
{
this
.
_goShopCar
}
showSimilarGuider
=
{
showSimilarGuider
}
resourceJumpWithUrl
=
{
this
.
_resourceJumpWithUrl
}
onPressCategoryTab
=
{
this
.
_onPressCategoryTab
}
jumpWithLinkUrl
=
{
this
.
_jumpWithLinkUrl
}
/
>
<
/View
>
);
...
...
@@ -500,7 +391,6 @@ let styles = StyleSheet.create({
width
:
width
,
height
:
height
-
64
-
44
,
},
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
NewArrivalContainer
);
...
...
js/newArrival/containers/RecForYouContainer.js
View file @
5f2a965
...
...
@@ -44,7 +44,7 @@ function mapDispatchToProps(dispatch) {
};
}
class
NewArrival
Container
extends
Component
{
class
RecForYou
Container
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
_onPressShop
=
this
.
_onPressShop
.
bind
(
this
);
...
...
@@ -118,4 +118,4 @@ let styles = StyleSheet.create({
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
NewArrival
Container
);
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
RecForYou
Container
);
...
...
js/newArrival/reducers/newArrival/newArrivalActions.js
View file @
5f2a965
...
...
@@ -10,13 +10,10 @@ import * as _ from 'lodash';
const
{
SET_CHANNEL
,
RECOMMEND_SHOP_REQUEST
,
RECOMMEND_SHOP_SUCCESS
,
RECOMMEND_SHOP_FAILURE
,
RECOMMEND_BRAND_REQUEST
,
RECOMMEND_BRAND_SUCCESS
,
RECOMMEND_BRAND_FAILURE
,
GET_SHOPCARTCOUNT_REQUEST
,
GET_SHOPCARTCOUNT_SUCCESS
,
GET_SHOPCARTCOUNT_FAILURE
,
...
...
@@ -31,9 +28,16 @@ const {
PRODUCT_FILTER_ACTION
,
SET_SIMILAR_PRODUCT_INDEX
,
SET_SHOW_SIMILAR_GUIDER
,
UPDATE_MORE_FILTER_SELECTED_ORDER
,
UPDATE_MORE_FILTER_SELECTED_ORDER
,
FILTER_DATA_SUCCESS
,
STORE_CURRENT_TAB_VALUE
,
SET_PRODUCT_PARAMS
,
FILTER_DATA_SUCCESS
,
RESOURCE_INFO_REQUEST
,
RESOURCE_INFO_SUCCESS
,
RESOURCE_INFO_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
...
...
@@ -64,201 +68,170 @@ export function setShowSimilarGuider(requestNative, show=false) {
}
}
export
function
getTopInfo
()
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
}
=
getState
();
dispatch
(
topInfoRequest
());
return
new
NewArrivalService
(
app
.
host
).
fetchRecommendShop
(
app
.
channel
)
.
then
(
json
=>
{
let
{
shop_list
,
ads
,
}
=
json
;
let
first_part
=
[];
let
second_part
=
[];
if
(
ads
&&
ads
.
length
)
{
for
(
var
i
=
0
;
i
<
ads
.
length
;
i
++
)
{
let
{
data
,
template_name
,
}
=
ads
[
i
];
if
(
data
.
length
&&
template_name
==
'focus'
)
{
first_part
=
data
;
}
if
(
data
.
length
&&
template_name
==
'single_image'
)
{
second_part
=
data
;
}
}
}
export
function
storeCurrentTabValue
(
index
,
tabName
,
queryList
)
{
return
(
dispatch
,
getState
)
=>
{
dispatch
({
type
:
STORE_CURRENT_TAB_VALUE
,
payload
:
{
index
,
tabName
,
queryList
},
});
try
{
first_part
=
exposeBannerData
(
first_part
,
'first_part'
,
app
.
channel
);
}
catch
(
e
)
{
let
paramsDic
=
{};
queryList
&&
queryList
.
map
((
item
,
index
)
=>
{
let
res
=
{
...
paramsDic
,
...
item
,
}
paramsDic
=
res
;
})
dispatch
(
getProductList
(
paramsDic
));
};
}
}
finally
{
export
function
getResourceInfoRequest
()
{
return
{
type
:
RESOURCE_INFO_REQUEST
,
};
}
}
export
function
getResourceInfoSuccess
(
json
)
{
return
{
type
:
RESOURCE_INFO_SUCCESS
,
payload
:
json
};
}
try
{
shop_list
=
exposeBannerData
(
shop_list
,
'shop_list'
,
app
.
channel
)
}
catch
(
e
)
{
export
function
getResourceInfoFailure
(
error
)
{
return
{
type
:
RESOURCE_INFO_FAILURE
,
payload
:
error
};
}
}
finally
{
export
function
getResourceInfo
(
callback
)
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
}
=
getState
();
dispatch
(
getResourceInfoRequest
());
return
new
NewArrivalService
(
app
.
host
).
fetchResourceInfo
(
'1f2e07cb63811680154ba693c954dd62'
)
.
then
(
json
=>
{
let
newJson
=
exposeResourceInfoData
(
json
);
for
(
let
i
=
0
;
i
<
json
.
length
;
i
++
)
{
let
item
=
json
[
i
]
let
floorname
=
item
.
template_name
let
floorid
=
item
.
template_id
if
(
floorname
===
'guessLike'
)
{
dispatch
(
setProductParams
(
floorid
,
floorname
,
i
+
1
));
}
}
callback
&&
typeof
callback
===
'function'
&&
callback
(
newJson
)
dispatch
(
getResourceInfoSuccess
(
newJson
));
})
.
catch
(
error
=>
{
dispatch
(
getResourceInfoFailure
(
error
));
});
};
}
}
try
{
second_part
=
exposeBannerData
(
second_part
,
'second_part'
,
app
.
channel
)
}
catch
(
e
)
{
function
exposeResourceInfoData
(
json
)
{
}
finally
{
if
(
!
json
)
return
json
;
try
{
let
pageName
=
Platform
.
OS
===
'android'
?
'aFP_NewArrival'
:
'iFP_NewArrival'
;
for
(
let
i
=
0
;
i
<
json
.
length
;
i
++
)
{
let
item
=
json
[
i
]
let
floorname
=
item
.
template_name
let
floorid
=
item
.
template_id
if
(
floorname
===
'newFocus'
)
{
let
list
=
item
.
data
;
for
(
let
j
=
0
;
j
<
list
.
length
;
j
++
)
{
let
subitem
=
list
[
j
]
subitem
.
yh_exposureData
=
{
F_ID
:
floorid
,
F_NAME
:
floorname
,
F_INDEX
:
i
+
1
,
I_INDEX
:
parseInt
(
j
)
+
1
+
""
,
P_NAME
:
pageName
,
F_URL
:
subitem
.
url
,
exposureEnd
:
1
,
}
}
}
let
newJson
=
{
first_part
,
shop_list
,
second_part
,
}
dispatch
(
topInfoSuccess
(
newJson
));
/**
数据曝光
*/
dispatch
(
topInfoExpose
(
newJson
));
})
.
catch
(
error
=>
{
dispatch
(
topInfoFailure
(
error
));
});
}
if
(
floorname
===
'newProductShopListFloor'
)
{
let
list
=
item
.
list
;
for
(
let
j
=
0
;
j
<
list
.
length
;
j
++
)
{
let
subitem
=
list
[
j
]
subitem
.
yh_exposureData
=
{
F_ID
:
floorid
,
F_NAME
:
floorname
,
P_NAME
:
pageName
,
F_INDEX
:
i
+
1
,
I_INDEX
:
parseInt
(
j
)
+
1
+
""
,
SHOP_ID
:
subitem
.
shops_id
,
exposureEnd
:
1
,
}
}
}
}
}
catch
(
error
){
}
return
json
;
}
export
function
setProductParams
(
floorid
,
floorname
,
floorindex
)
{
return
{
type
:
SET_PRODUCT_PARAMS
,
payload
:
{
floorid
,
floorname
,
floorindex
},
}
}
export
function
topInfo
Request
()
{
export
function
productList
Request
()
{
return
{
type
:
RECOMMEND_SHOP
_REQUEST
,
type
:
PRODUCT_LIST
_REQUEST
,
};
}
export
function
topInfo
Success
(
json
)
{
export
function
productList
Success
(
json
)
{
return
{
type
:
RECOMMEND_SHOP
_SUCCESS
,
type
:
PRODUCT_LIST
_SUCCESS
,
payload
:
json
}
}
export
function
topInfo
Failure
(
error
)
{
export
function
productList
Failure
(
error
)
{
return
{
type
:
RECOMMEND_SHOP
_FAILURE
,
type
:
PRODUCT_LIST
_FAILURE
,
payload
:
error
}
}
function
topInfoExpose
(
data
)
{
return
(
dispatch
,
getState
)
=>
{
try
{
let
{
first_part
,
shop_list
,
second_part
,
}
=
data
;
let
logData
=
[];
let
F_INDEX
=
1
;
if
(
first_part
&&
first_part
.
length
)
{
let
LIST
=
[];
let
I_INDEX
=
1
;
for
(
var
i
=
0
;
i
<
first_part
.
length
;
i
++
)
{
let
IMAGE_URL
=
first_part
[
i
].
src
;
let
ACTION_URL
=
first_part
[
i
].
url
;
LIST
.
push
({
I_INDEX
,
IMAGE_URL
,
ACTION_URL
,
});
I_INDEX
++
;
}
logData
.
push
({
F_ID
:
1001
,
F_NM
:
'BANNER'
,
F_INDEX
,
LIST
,
});
F_INDEX
++
;
}
if
(
shop_list
&&
shop_list
.
length
)
{
let
LIST
=
[];
let
I_INDEX
=
1
;
for
(
var
i
=
0
;
i
<
shop_list
.
length
;
i
++
)
{
let
BRAND_ID
=
shop_list
[
i
].
brand_id
;
let
SHOP_ID
=
shop_list
[
i
].
shops_id
;
LIST
.
push
({
I_INDEX
,
BRAND_ID
,
SHOP_ID
,
});
I_INDEX
++
;
}
logData
.
push
({
F_ID
:
1002
,
F_NM
:
'为您推荐'
,
F_INDEX
,
LIST
,
});
F_INDEX
++
;
}
if
(
second_part
&&
second_part
.
length
)
{
let
LIST
=
[];
let
I_INDEX
=
1
;
for
(
var
i
=
0
;
i
<
second_part
.
length
;
i
++
)
{
let
IMAGE_URL
=
second_part
[
i
].
src
;
let
ACTION_URL
=
second_part
[
i
].
url
;
LIST
.
push
({
I_INDEX
,
IMAGE_URL
,
ACTION_URL
,
});
I_INDEX
++
;
}
logData
.
push
({
F_ID
:
1003
,
F_NM
:
'精选抢先看'
,
F_INDEX
,
LIST
,
});
F_INDEX
++
;
}
let
params
=
{
DATA
:
logData
,
};
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_SHOW_NEW_ARRIVAL'
,
params
);
}
catch
(
e
)
{
}
};
}
/*
* 底部产品列表
*/
export
function
getProductList
(
reload
=
false
)
{
export
function
getProductList
(
paramsDic
)
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
newArrival
}
=
getState
();
let
{
productList
,
filterFactors
,
topPart
}
=
newArrival
;
let
{
productList
,
filterFactors
,
searchResourceList
,
prdFloorId
,
prdFloorName
,
prdFloorIndex
}
=
newArrival
;
if
(
reload
)
{
}
else
{
if
(
productList
.
isFetching
||
productList
.
endReached
||
productList
.
error
)
{
return
;
}
}
if
(
productList
.
isFetching
||
productList
.
endReached
||
productList
.
error
)
{
return
;
}
dispatch
(
productListRequest
());
let
order
=
productList
.
order
;
let
page
=
productList
.
currentPage
+
1
;
let
pageSize
=
productList
.
pageSize
;
let
tabId
=
newArrival
.
selectedTabIndex
;
let
tabName
=
newArrival
.
selectedTabName
;
let
channel
=
app
.
channel
;
let
bSelectedFilterFactor
,
allFilterFactors
;
allFilterFactors
=
filterFactors
.
toJS
();
...
...
@@ -275,114 +248,82 @@ export function getProductList(reload=false) {
}
}
return
new
NewArrivalService
(
app
.
host
).
fetchProductList
(
channel
,
order
,
page
,
pageSize
,
allFilterFactors
)
return
new
NewArrivalService
(
app
.
host
).
fetchProductList
(
channel
,
order
,
page
,
pageSize
,
allFilterFactors
,
paramsDic
)
.
then
(
json
=>
{
let
payload
=
parseProductList
(
json
,
order
,
channel
,
pageSize
);
payload
.
endReached
=
payload
.
currentPage
==
payload
.
pageCount
;
if
(
payload
.
currentPage
>
1
)
{
let
oldList
=
productList
.
list
.
toJS
();
let
list
=
[...
oldList
,
...
payload
.
list
];
payload
.
list
=
list
;
}
dispatch
(
productListSuccess
(
payload
));
let
payload
=
exposeProductListData
(
json
,
order
,
channel
,
pageSize
,
tabId
,
tabName
,
prdFloorId
,
prdFloorName
,
prdFloorIndex
);
payload
.
endReached
=
payload
.
currentPage
==
payload
.
pageCount
;
if
(
payload
.
currentPage
>
1
)
{
let
oldList
=
productList
.
list
.
toJS
();
let
oldsearchlist
=
searchResourceList
.
toJS
()
let
list
=
[...
oldList
,
...
payload
.
product_list
];
payload
.
list
=
list
;
payload
.
search_resource_list
=
[...
oldsearchlist
,
...
reShuffleJumpList
(
payload
.
search_resource_list
,
parseInt
(
payload
.
currentPage
),
parseInt
(
pageSize
))
]
}
else
{
payload
.
list
=
payload
.
product_list
payload
.
search_resource_list
=
reShuffleJumpList
(
payload
.
search_resource_list
,
parseInt
(
payload
.
currentPage
),
parseInt
(
pageSize
))
}
dispatch
(
productListExpose
(
payload
,
productList
,
topPart
,
allFilterFactors
));
dispatch
(
productListSuccess
(
payload
));
})
.
catch
(
error
=>
{
dispatch
(
productListFailure
(
error
));
});
.
catch
(
error
=>
{
dispatch
(
productListFailure
(
error
));
});
};
}
function
productListExpose
(
payload
,
productList
,
topPart
,
allFilterFactors
)
{
return
(
dispatch
,
getState
)
=>
{
try
{
let
LIST
=
[];
let
length
=
payload
.
list
.
length
;
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
let
item
=
payload
.
list
[
i
]
let
ListItem
=
{
I_INDEX
:
productList
.
list
.
size
+
i
+
1
,
RECOMMEND_TYPE
:
item
.
recommend_type
,
};
let
KEYWORD
=
''
;
if
(
item
.
recommend_type
==
'hotSearchTerm'
&&
item
.
data
.
length
)
{
KEYWORD
=
item
.
data
.
join
(
','
);
}
let
SHOP_ID
=
0
;
if
(
item
.
recommend_type
==
'hotShop'
&&
item
.
data
.
shops_id
)
{
SHOP_ID
=
item
.
data
.
shops_id
;
}
let
ARTICLE_ID
=
0
;
if
(
item
.
recommend_type
==
'fashionArticle'
&&
item
.
data
.
id
)
{
ARTICLE_ID
=
item
.
data
.
id
;
}
let
CATE_ID
=
''
;
if
(
item
.
recommend_type
==
'seasonSort'
&&
item
.
data
.
length
)
{
let
tempAry
=
[];
let
itemLength
=
item
.
data
.
length
;
for
(
var
i
=
0
;
i
<
itemLength
;
i
++
)
{
let
{
categoryId
}
=
item
.
data
[
i
];
categoryId
=
categoryId
.
toString
();
tempAry
.
push
(
categoryId
);
}
CATE_ID
=
tempAry
.
join
(
','
);
ListItem
.
CATE_ID
=
CATE_ID
;
}
if
(
item
.
product_skn
)
{
ListItem
.
PRD_SKN
=
item
.
product_skn
;
}
if
(
item
.
brand_id
)
{
ListItem
.
BRAND_ID
=
item
.
brand_id
;
}
if
(
ARTICLE_ID
&&
ARTICLE_ID
!=
0
)
{
ListItem
.
ARTICLE_ID
=
ARTICLE_ID
;
}
if
(
SHOP_ID
&&
SHOP_ID
!=
0
)
{
ListItem
.
SHOP_ID
=
SHOP_ID
;
}
else
if
(
KEYWORD
&&
KEYWORD
!=
''
)
{
ListItem
.
KEYWORD
=
KEYWORD
;
}
LIST
.
push
(
ListItem
);
}
let
F_INDEX
=
1
;
if
(
topPart
.
topList
.
size
)
{
F_INDEX
++
;
}
if
(
topPart
.
brandList
.
size
)
{
F_INDEX
++
;
}
if
(
topPart
.
featuredList
.
size
)
{
F_INDEX
++
;
}
let
SORT_NM
=
'新品'
;
if
(
productList
.
order
==
's_t_desc'
)
{
SORT_NM
=
'新品'
;
}
if
(
productList
.
order
==
's_p_asc'
||
productList
.
order
==
's_p_desc'
)
{
SORT_NM
=
'价格'
;
}
if
(
productList
.
order
==
'p_d_asc'
||
productList
.
order
==
'p_d_desc'
)
{
SORT_NM
=
'折扣'
;
}
let
FILTER_VALUE
=
JSON
.
stringify
(
allFilterFactors
);
let
data
=
[{
F_ID
:
1004
,
F_NM
:
'最新上架'
,
F_INDEX
,
SORT_NM
,
FILTER_VALUE
,
LIST
,
}];
let
params
=
{
DATA
:
data
,
};
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_SHOW_NEW_ARRIVAL'
,
params
);
}
catch
(
e
)
{
function
reShuffleJumpList
(
jumplist
,
pageindex
,
pagesize
)
{
return
jumplist
.
map
((
item
,
index
)
=>
{
item
.
rowType
=
1
item
.
index
=
(
pageindex
-
1
)
*
pagesize
+
parseInt
(
item
.
index
)
return
item
}
)
}
}
};
function
exposeProductListData
(
json
,
order
,
channel
,
pageSize
,
tabId
,
tabName
,
prdFloorId
,
prdFloorName
,
prdFloorIndex
)
{
let
res
=
json
;
try
{
let
list
=
json
?
json
.
product_list
:
[];
if
(
!
list
)
{
return
json
;
}
let
pageName
=
Platform
.
OS
===
'android'
?
'aFP_NewArrival'
:
'iFP_NewArrival'
;
for
(
var
i
=
0
;
i
<
list
.
length
;
i
++
)
{
let
item
=
list
[
i
];
let
skn
=
item
.
product_skn
;
let
prdChannel
=
item
.
is_ufo
===
'N'
?
''
:
'UFO'
;
let
inFloorIndex
=
parseInt
(
i
)
+
1
+
json
.
page_size
*
(
json
.
page
-
1
)
+
''
;
let
recallType
=
item
.
recall_type
?
item
.
recall_type
:
''
;
let
productTag
=
item
.
product_tag
?
item
.
product_tag
:
''
;
let
tagItem
=
productTag
&&
productTag
[
0
];
let
prdType
=
tagItem
?
tagItem
.
name
:
''
;
item
.
yh_exposureData
=
{
P_NAME
:
pageName
,
TAB_ID
:
tabId
,
TAB_NAME
:
tabName
,
I_INDEX
:
inFloorIndex
,
PRD_SKN
:
skn
,
PRD_CHANNEL
:
prdChannel
,
RECALL_TYPE
:
recallType
,
PRD_TYPE
:
prdType
,
F_NAME
:
prdFloorName
,
F_INDEX
:
prdFloorIndex
,
F_ID
:
prdFloorId
,
exposureEnd
:
1
,
};
}
res
.
product_list
=
list
;
res
.
search_resource_list
=
json
.
search_resource_list
.
length
>
0
?
json
.
search_resource_list
:
[]
res
.
currentPage
=
json
&&
json
.
page
?
json
.
page
:
1
;
res
.
pageCount
=
json
&&
json
.
page_total
?
json
.
page_total
:
0
;
res
.
total
=
json
&&
json
.
total
?
json
.
total
:
0
;
}
catch
(
error
){
}
return
res
;
}
export
function
setFilterData
(
payload
)
{
...
...
@@ -393,9 +334,7 @@ export function setFilterData(payload) {
}
export
function
setFilterView
(
show
)
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
newArrival
}
=
getState
();
let
{
filterDataReady
}
=
newArrival
;
if
(
!
filterDataReady
&&
show
)
{
...
...
@@ -410,10 +349,8 @@ export function setFilterView(show) {
});
})
.
catch
(
error
=>
{
});
}
else
{
dispatch
({
type
:
FILTER_LIST_VIEW
,
payload
:
show
...
...
@@ -421,6 +358,7 @@ export function setFilterView(show) {
}
};
}
export
function
setFilterMoreView
(
show
)
{
return
{
type
:
FILTER_MORE_VIEW
,
...
...
@@ -483,26 +421,6 @@ export function setProductFilterFactors(category={key: 'gender', name: '性别',
};
}
export
function
productListRequest
()
{
return
{
type
:
PRODUCT_LIST_REQUEST
,
};
}
export
function
productListSuccess
(
json
)
{
return
{
type
:
PRODUCT_LIST_SUCCESS
,
payload
:
json
}
}
export
function
productListFailure
(
error
)
{
return
{
type
:
PRODUCT_LIST_FAILURE
,
payload
:
error
}
}
//为您推荐
export
function
recommendBrandRequest
()
{
return
{
...
...
@@ -527,21 +445,21 @@ export function recommendBrandFailure(error) {
export
function
getRecommendBrand
()
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
newArrival
}
=
getState
();
let
{
productList
,
filterFactors
}
=
newArrival
;
let
{
productList
,
filterFactors
}
=
newArrival
;
let
channel
=
app
.
channel
;
dispatch
(
recommendBrandRequest
());
return
new
NewArrivalService
(
app
.
host
).
fetchRecommendBrand
(
channel
)
.
then
(
json
=>
{
let
browseBrandList
=
json
.
browse_brand_list
;
let
hotBrandList
=
json
.
hot_brand_list
;
let
newBrandList
=
json
.
new_brand_list
;
let
browseBrandList
=
json
.
browse_brand_list
;
let
hotBrandList
=
json
.
hot_brand_list
;
let
newBrandList
=
json
.
new_brand_list
;
dispatch
(
recommendBrandSuccess
({
hotBrandList
,
browseBrandList
,
newBrandList
}));
dispatch
(
recommendBrandExpose
({
hotBrandList
,
browseBrandList
,
newBrandList
}))
dispatch
(
recommendBrandSuccess
({
hotBrandList
,
browseBrandList
,
newBrandList
}));
dispatch
(
recommendBrandExpose
({
hotBrandList
,
browseBrandList
,
newBrandList
}))
})
.
catch
(
error
=>
{
dispatch
(
recommendBrandFailure
(
error
));
dispatch
(
recommendBrandFailure
(
error
));
});
};
}
...
...
@@ -578,12 +496,12 @@ export function getShopCartCount() {
new
NewArrivalService
(
app
.
globalHost
).
getGlobalShopCartCount
(
uid
,
'NewArrival'
)
.
then
(
json
=>
{
let
count
=
json
?
json
.
cart_goods_count
:
0
;
cart_goods_count
=
cart_goods_count
+
count
;
dispatch
(
getShopCartCountSuccess
(
cart_goods_count
));
let
count
=
json
?
json
.
cart_goods_count
:
0
;
cart_goods_count
=
cart_goods_count
+
count
;
dispatch
(
getShopCartCountSuccess
(
cart_goods_count
));
})
.
catch
(
error
=>
{
dispatch
(
getShopCartCountSuccess
(
cart_goods_count
));
dispatch
(
getShopCartCountSuccess
(
cart_goods_count
));
});
})
...
...
@@ -702,248 +620,7 @@ function recommendBrandExpose(data) {
export
function
goToRecommendForYou
()
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
newArrival
}
=
getState
();
let
{
productList
,
filterFactors
,
topPart
}
=
newArrival
;
let
I_INDEX
=
"0"
;
let
F_INDEX
=
1
;
if
(
newArrival
.
topPart
.
topList
.
size
)
{
F_INDEX
=
2
;
}
F_INDEX
=
F_INDEX
.
toString
();
let
param
=
{
F_ID
:
"1002"
,
F_NM
:
'为您推荐'
,
F_INDEX
,
I_INDEX
,
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
logEvent
(
'YB_NEW_ARRIVAL_FLR_C'
,
param
);
ReactNative
.
NativeModules
.
YH_NewArrivalHelper
.
goToRecommendForYou
();
};
}
function
parseProductList
(
json
,
order
,
channel
,
pageSize
)
{
let
list
=
json
&&
json
.
product_list
?
json
.
product_list
:
[];
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
;
try
{
list
=
exposePruductListData
(
list
,
order
,
channel
,
currentPage
,
pageSize
);
}
catch
(
e
)
{
}
finally
{
}
if
(
currentPage
>
1
)
{
return
{
list
,
currentPage
,
pageCount
,
total
,
};
}
let
filter
=
json
&&
json
.
filter
?
json
.
filter
:
{};
let
filterCategoryDetailFilterList
=
{};
let
categoryFilterList
=
[];
if
(
filter
[
'gender'
])
{
categoryFilterList
.
push
({
key
:
'gender'
,
name
:
'性别'
,
isSelect
:
true
,
});
let
genderList
=
filter
[
'gender'
];
let
newGenderList
=
[];
newGenderList
.
push
({
key
:
'1,2,3'
,
name
:
'所有性别'
,
isSelect
:
true
,
});
for
(
let
gender
in
genderList
)
{
if
(
genderList
.
hasOwnProperty
(
gender
))
{
newGenderList
.
push
({
key
:
gender
,
name
:
genderList
[
gender
],
isSelect
:
false
,
});
}
}
filterCategoryDetailFilterList
.
gender
;
filterCategoryDetailFilterList
.
gender
=
newGenderList
;
}
if
(
filter
[
'group_sort'
])
{
categoryFilterList
.
push
({
key
:
'sort'
,
name
:
'品类'
,
isSelect
:
false
,
});
let
sortList
=
filter
[
'group_sort'
];
let
newSortList
=
[];
newSortList
.
push
({
key
:
''
,
name
:
'所有品类'
,
isSelect
:
true
,
});
sortList
.
map
((
item
,
i
)
=>
{
newSortList
.
push
({
key
:
item
.
relation_parameter
.
sort
?
item
.
relation_parameter
.
sort
:
''
,
name
:
item
.
category_name
,
isSelect
:
false
,
})
});
filterCategoryDetailFilterList
.
sort
;
filterCategoryDetailFilterList
.
sort
=
newSortList
;
}
if
(
filter
[
'brand'
])
{
categoryFilterList
.
push
({
key
:
'brand'
,
name
:
'品牌'
,
isSelect
:
false
,
});
let
brandList
=
filter
[
'brand'
];
brandList
=
brandList
.
sort
(
function
(
a
,
b
)
{
return
a
.
brand_alif
-
b
.
brand_alif
;
});
let
templet
=
[
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
];
let
bList
=
[];
for
(
var
j
=
0
;
j
<
templet
.
length
;
j
++
)
{
for
(
var
i
=
0
;
i
<
brandList
.
length
;
i
++
)
{
if
(
brandList
[
i
].
brand_alif
==
templet
[
j
])
{
bList
.
push
(
brandList
[
i
]);
}
}
}
let
newBrandList
=
[];
newBrandList
.
push
({
key
:
''
,
name
:
'所有品牌'
,
isSelect
:
true
,
});
bList
.
map
((
item
,
i
)
=>
{
newBrandList
.
push
({
key
:
item
.
id
,
name
:
item
.
brand_name
,
isSelect
:
false
,
})
});
filterCategoryDetailFilterList
.
brand
;
filterCategoryDetailFilterList
.
brand
=
newBrandList
;
}
if
(
filter
[
'color'
])
{
categoryFilterList
.
push
({
key
:
'color'
,
name
:
'颜色'
,
isSelect
:
false
,
});
let
colorList
=
filter
[
'color'
];
let
newColorList
=
[];
newColorList
.
push
({
key
:
''
,
name
:
'所有颜色'
,
isSelect
:
true
,
});
colorList
.
map
((
item
,
i
)
=>
{
newColorList
.
push
({
key
:
item
.
color_id
,
name
:
item
.
color_name
,
isSelect
:
false
,
});
});
filterCategoryDetailFilterList
.
color
;
filterCategoryDetailFilterList
.
color
=
newColorList
;
}
if
(
filter
[
'size'
])
{
categoryFilterList
.
push
({
key
:
'sizeKey'
,
name
:
'尺码'
,
isSelect
:
false
,
});
let
sizeList
=
filter
[
'size'
];
let
newSizeList
=
[];
newSizeList
.
push
({
key
:
''
,
name
:
'所有尺码'
,
isSelect
:
true
,
});
sizeList
.
map
((
item
,
i
)
=>
{
newSizeList
.
push
({
key
:
item
.
size_id
,
name
:
item
.
size_name
,
isSelect
:
false
,
});
});
filterCategoryDetailFilterList
.
sizeKey
;
filterCategoryDetailFilterList
.
sizeKey
=
newSizeList
;
}
if
(
filter
[
'priceRange'
])
{
categoryFilterList
.
push
({
key
:
'price'
,
name
:
'价格'
,
isSelect
:
false
,
});
let
priceObject
=
filter
[
'priceRange'
];
priceObject
=
sortListByField
(
priceObject
,
'name'
);
// 折扣,价格区间,需要排序
let
newPriceList
=
[];
newPriceList
.
push
({
key
:
''
,
name
:
'所有价格'
,
isSelect
:
true
,
});
_
.
forEach
(
priceObject
,
(
v
,
k
)
=>
{
newPriceList
.
push
({
key
:
v
.
_key
,
name
:
v
.
_value
,
isSelect
:
false
,
});
});
filterCategoryDetailFilterList
.
price
;
filterCategoryDetailFilterList
.
price
=
newPriceList
;
}
if
(
filter
[
'discount'
])
{
categoryFilterList
.
push
({
key
:
'p_d'
,
name
:
'折扣'
,
isSelect
:
false
,
});
let
p_dObject
=
filter
[
'discount'
];
p_dObject
=
sortListByField
(
p_dObject
,
'name'
);
// 折扣,价格区间,需要排序
let
newP_dList
=
[];
newP_dList
.
push
({
key
:
''
,
name
:
'所有折扣'
,
isSelect
:
true
,
});
_
.
forEach
(
p_dObject
,
(
v
,
k
)
=>
{
newP_dList
.
push
({
key
:
v
.
_key
,
name
:
v
.
name
,
isSelect
:
false
,
});
});
filterCategoryDetailFilterList
.
p_d
;
filterCategoryDetailFilterList
.
p_d
=
newP_dList
;
}
return
{
list
,
categoryFilterList
,
filterCategoryDetailFilterList
,
currentPage
,
pageCount
,
total
,
};
}
...
...
@@ -1004,135 +681,9 @@ function exposeBannerData(data,type,channel) {
item
.
yh_exposureData
=
params
;
}
}
return
data
;
}
function
exposePruductListData
(
list
,
order
,
channel
,
currentPage
,
pageSize
)
{
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_NewArrival'
;
if
(
Platform
.
OS
===
'android'
)
{
pageName
=
'aFP_NewArrival'
;
}
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'
;
}
for
(
var
i
=
0
;
i
<
list
.
length
;
i
++
)
{
let
item
=
list
[
i
];
let
inFloorIndex
=
parseInt
(
i
)
+
1
+
parseInt
(
currentPage
-
1
)
*
parseInt
(
pageSize
)
+
''
;
let
recommend_type
=
item
.
recommend_type
;
if
(
recommend_type
==
'hotSearchTerm'
)
{
let
yh_exposureData
=
[];
for
(
var
j
=
0
;
j
<
item
.
data
.
length
;
j
++
)
{
let
f_item
=
item
.
data
[
j
];
let
keyword
=
f_item
;
let
categoryId
=
f_item
.
categoryId
;
let
params
=
{
P_NAME
:
pageName
,
P_PARAM
:
channelStr
,
TAB_ID
:
tab_num
,
TAB_NAME
:
tab_name
,
I_INDEX
:
inFloorIndex
,
L_INDEX
:
parseInt
(
j
)
+
1
+
''
,
C_ID
:
channel
,
KEYWORD
:
keyword
,
exposureEnd
:
1
,
};
yh_exposureData
.
push
(
params
);
}
item
.
yh_exposureDataList
=
yh_exposureData
;
}
else
if
(
recommend_type
==
'seasonSort'
)
{
for
(
var
j
=
0
;
j
<
item
.
data
.
length
;
j
++
)
{
let
f_item
=
item
.
data
[
j
];
let
url
=
f_item
.
url
;
let
categoryId
=
f_item
.
categoryId
;
let
params
=
{
P_NAME
:
pageName
,
P_PARAM
:
channelStr
,
TAB_ID
:
tab_num
,
TAB_NAME
:
tab_name
,
I_INDEX
:
inFloorIndex
,
L_INDEX
:
parseInt
(
j
)
+
1
+
''
,
C_ID
:
channel
,
ACTION_URL
:
url
,
L1_CATE_ID
:
categoryId
,
exposureEnd
:
1
,
};
f_item
.
yh_exposureData
=
params
;
}
}
else
if
(
recommend_type
==
'hotShop'
)
{
let
brandID
=
item
.
data
.
brand_id
;
let
params
=
{
P_NAME
:
pageName
,
P_PARAM
:
channelStr
,
TAB_ID
:
tab_num
,
TAB_NAME
:
tab_name
,
I_INDEX
:
inFloorIndex
,
BRAND_ID
:
brandID
,
C_ID
:
channel
,
exposureEnd
:
1
,
};
item
.
data
.
yh_exposureData
=
params
;
}
else
if
(
recommend_type
==
'fashionArticle'
)
{
let
article_id
=
item
.
data
.
id
;
let
params
=
{
P_NAME
:
pageName
,
P_PARAM
:
channelStr
,
TAB_ID
:
tab_num
,
TAB_NAME
:
tab_name
,
I_INDEX
:
inFloorIndex
,
ARTICLE_ID
:
article_id
,
C_ID
:
channel
,
exposureEnd
:
1
,
};
item
.
data
.
yh_exposureData
=
params
;
}
else
{
let
skn
=
item
.
product_skn
;
let
params
=
{
P_NAME
:
pageName
,
I_INDEX
:
inFloorIndex
,
PRD_SKN
:
skn
,
TAB_NAME
:
tab_name
,
TAB_ID
:
tab_num
,
P_PARAM
:
channelStr
,
C_ID
:
channel
,
exposureEnd
:
1
,
};
item
.
yh_exposureData
=
params
;
}
}
return
list
;
}
/**
...
...
js/newArrival/reducers/newArrival/newArrivalInitialState.js
View file @
5f2a965
...
...
@@ -3,18 +3,16 @@
import
{
Record
,
List
,
Map
}
from
'immutable'
;
let
InitialState
=
Record
({
topPart
:
new
(
Record
({
resourceInfo
:
new
(
Record
({
isFetching
:
false
,
error
:
null
,
topList
:
List
(),
brandList
:
List
(),
featuredList
:
List
(),
resourceList
:
List
(),
})),
categoryFilterList
:
List
(),
filterCategoryDetailFilterList
:
List
(),
filterCategoryDetailFilterList
:
List
(),
filterDataReady
:
false
,
//只加载一次
productList
:
new
(
Record
({
isFetching
:
false
,
isFilter
:
false
,
...
...
@@ -29,7 +27,10 @@ let InitialState = Record({
total
:
0
,
endReached
:
false
,
sourceType
:
0
,
// 0 - 默认,1 - 购,全球2 - 奥莱
selectedCategoryIndex
:
0
,
})),
searchResourceList
:
List
(),
filterFactors
:
new
(
Record
({
gender
:
''
,
//性别
color
:
''
,
//颜色
...
...
@@ -48,15 +49,26 @@ 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
:
''
,
selectedTabList
:
List
(),
prdFloorId
:
''
,
prdFloorName
:
''
,
prdFloorIndex
:
''
,
});
export
default
InitialState
;
...
...
js/newArrival/reducers/newArrival/newArrivalReducer.js
View file @
5f2a965
...
...
@@ -6,10 +6,6 @@ import Immutable, {Map} from 'immutable';
const
{
SET_CHANNEL
,
RECOMMEND_SHOP_REQUEST
,
RECOMMEND_SHOP_SUCCESS
,
RECOMMEND_SHOP_FAILURE
,
RECOMMEND_BRAND_REQUEST
,
RECOMMEND_BRAND_SUCCESS
,
RECOMMEND_BRAND_FAILURE
,
...
...
@@ -32,6 +28,13 @@ const {
UPDATE_MORE_FILTER_SELECTED_ORDER
,
FILTER_DATA_SUCCESS
,
STORE_CURRENT_TAB_VALUE
,
SET_PRODUCT_PARAMS
,
RESOURCE_INFO_REQUEST
,
RESOURCE_INFO_SUCCESS
,
RESOURCE_INFO_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
const
initialState
=
new
InitialState
;
...
...
@@ -39,132 +42,147 @@ const initialState = new InitialState;
export
default
function
newArrivalReducer
(
state
=
initialState
,
action
)
{
switch
(
action
.
type
)
{
case
RECOMMEND_SHOP_REQUEST
:
{
return
state
.
setIn
([
'topPart'
,
'isFetching'
],
true
).
setIn
([
'topPart'
,
'error'
],
null
);
}
case
RECOMMEND_SHOP_SUCCESS
:
{
let
{
first_part
,
shop_list
,
second_part
,
}
=
action
.
payload
;
return
state
.
setIn
([
'topPart'
,
'topList'
],
Immutable
.
fromJS
(
first_part
))
.
setIn
([
'topPart'
,
'isFetching'
],
false
)
.
setIn
([
'topPart'
,
'brandList'
],
Immutable
.
fromJS
(
shop_list
))
.
setIn
([
'topPart'
,
'featuredList'
],
Immutable
.
fromJS
(
second_part
));
}
case
RECOMMEND_SHOP_FAILURE
:
{
return
state
.
setIn
([
'topPart'
,
'isFetching'
],
false
)
.
setIn
([
'topPart'
,
'error'
],
action
.
payload
);
}
case
PRODUCT_LIST_REQUEST
:
{
return
state
.
setIn
([
'productList'
,
'isFetching'
],
true
)
.
setIn
([
'productList'
,
'error'
],
null
);
}
case
FILTER_LIST_VIEW
:
{
return
state
.
setIn
([
'productList'
,
'isFilter'
],
action
.
payload
);
}
case
FILTER_MORE_VIEW
:
{
return
state
.
setIn
([
'productList'
,
'isMoreFilter'
],
action
.
payload
);
}
case
RESET_LIST_PAGE_INFO
:
{
return
state
.
setIn
([
'productList'
,
'currentPage'
],
0
)
.
setIn
([
'productList'
,
'pageCount'
],
0
)
.
setIn
([
'productList'
,
'total'
],
0
)
.
setIn
([
'productList'
,
'endReached'
],
false
);
}
case
SET_PRODUCT_LIST_FILTER
:
{
return
state
.
setIn
([
'productList'
,
'order'
],
action
.
payload
);
}
case
PRODUCT_FILTER_ACTION
:
{
let
{
categoryFilterList
,
filterCategoryDetailFilterList
,
filterFactors
,
filterNameFactors
,
}
=
action
.
payload
;
return
state
.
set
(
'categoryFilterList'
,
Immutable
.
fromJS
(
categoryFilterList
))
.
set
(
'filterCategoryDetailFilterList'
,
Immutable
.
fromJS
(
filterCategoryDetailFilterList
))
.
set
(
'filterNameFactors'
,
Immutable
.
fromJS
(
filterNameFactors
))
.
set
(
'filterFactors'
,
Immutable
.
fromJS
(
filterFactors
));
}
case
PRODUCT_LIST_SUCCESS
:
{
let
{
list
,
categoryFilterList
,
filterCategoryDetailFilterList
,
currentPage
,
pageCount
,
total
,
endReached
,
}
=
action
.
payload
;
let
newState
=
state
.
setIn
([
'productList'
,
'isFetching'
],
false
)
.
setIn
([
'productList'
,
'error'
],
null
)
.
setIn
([
'productList'
,
'list'
],
Immutable
.
fromJS
(
list
))
.
setIn
([
'productList'
,
'currentPage'
],
currentPage
)
.
setIn
([
'productList'
,
'pageCount'
],
pageCount
)
.
setIn
([
'productList'
,
'total'
],
total
)
.
setIn
([
'productList'
,
'endReached'
],
endReached
);
if
(
currentPage
==
1
&&
state
.
categoryFilterList
.
size
==
0
&&
state
.
filterCategoryDetailFilterList
.
size
==
0
)
{
newState
=
newState
.
set
(
'categoryFilterList'
,
Immutable
.
fromJS
(
categoryFilterList
))
.
set
(
'filterCategoryDetailFilterList'
,
Immutable
.
fromJS
(
filterCategoryDetailFilterList
));
}
return
newState
;
}
case
FILTER_DATA_SUCCESS
:
{
let
{
categoryFilterList
,
filterCategoryDetailFilterList
,
}
=
action
.
payload
;
let
newState
=
state
.
set
(
'categoryFilterList'
,
Immutable
.
fromJS
(
categoryFilterList
))
.
set
(
'filterCategoryDetailFilterList'
,
Immutable
.
fromJS
(
filterCategoryDetailFilterList
))
.
set
(
'filterDataReady'
,
true
);
return
newState
;
}
case
SET_SIMILAR_PRODUCT_INDEX
:
{
let
newState
=
state
.
setIn
([
'productList'
,
'similarIndex'
],
action
.
payload
);
return
newState
;
}
case
PRODUCT_LIST_FAILURE
:
{
return
state
.
setIn
([
'productList'
,
'isFetching'
],
false
)
.
setIn
([
'productList'
,
'error'
],
action
.
payload
);
}
case
RECOMMEND_BRAND_REQUEST
:
{
return
state
.
setIn
([
'recommendForYou'
,
'isFetching'
],
true
);
}
case
RECOMMEND_BRAND_SUCCESS
:
{
return
state
.
setIn
([
'recommendForYou'
,
'isFetching'
],
false
)
.
setIn
([
'recommendForYou'
,
'hotBrandList'
],
Immutable
.
fromJS
(
action
.
payload
.
hotBrandList
))
.
setIn
([
'recommendForYou'
,
'browseBrandList'
],
Immutable
.
fromJS
(
action
.
payload
.
browseBrandList
))
.
setIn
([
'recommendForYou'
,
'newBrandList'
],
Immutable
.
fromJS
(
action
.
payload
.
newBrandList
));
}
case
RECOMMEND_BRAND_FAILURE
:
{
return
state
.
setIn
([
'recommendForYou'
,
'isFetching'
],
false
)
.
setIn
([
'productList'
,
'error'
],
action
.
payload
);
}
case
SET_SHOW_SIMILAR_GUIDER
:
{
return
state
.
set
(
'showSimilarGuider'
,
action
.
payload
);
}
case
GET_SHOPCARTCOUNT_REQUEST
:
{
}
case
GET_SHOPCARTCOUNT_SUCCESS
:
{
return
state
.
set
(
'cart_goods_count'
,
action
.
payload
);
}
case
GET_SHOPCARTCOUNT_FAILURE
:
{
}
case
UPDATE_MORE_FILTER_SELECTED_ORDER
:
{
return
state
.
set
(
'moreFilterSelectOrder'
,
action
.
payload
);
}
}
case
PRODUCT_LIST_REQUEST
:
{
return
state
.
setIn
([
'productList'
,
'isFetching'
],
true
)
.
setIn
([
'productList'
,
'error'
],
null
);
}
case
FILTER_LIST_VIEW
:
{
return
state
.
setIn
([
'productList'
,
'isFilter'
],
action
.
payload
);
}
case
FILTER_MORE_VIEW
:
{
return
state
.
setIn
([
'productList'
,
'isMoreFilter'
],
action
.
payload
);
}
case
RESET_LIST_PAGE_INFO
:
{
return
state
.
setIn
([
'productList'
,
'currentPage'
],
0
)
.
setIn
([
'productList'
,
'pageCount'
],
0
)
.
setIn
([
'productList'
,
'total'
],
0
)
.
setIn
([
'productList'
,
'endReached'
],
false
);
}
case
SET_PRODUCT_LIST_FILTER
:
{
return
state
.
setIn
([
'productList'
,
'order'
],
action
.
payload
);
}
case
PRODUCT_FILTER_ACTION
:
{
let
{
categoryFilterList
,
filterCategoryDetailFilterList
,
filterFactors
,
filterNameFactors
,
}
=
action
.
payload
;
return
state
.
set
(
'categoryFilterList'
,
Immutable
.
fromJS
(
categoryFilterList
))
.
set
(
'filterCategoryDetailFilterList'
,
Immutable
.
fromJS
(
filterCategoryDetailFilterList
))
.
set
(
'filterNameFactors'
,
Immutable
.
fromJS
(
filterNameFactors
))
.
set
(
'filterFactors'
,
Immutable
.
fromJS
(
filterFactors
));
}
case
PRODUCT_LIST_SUCCESS
:
{
let
{
list
,
categoryFilterList
,
filterCategoryDetailFilterList
,
currentPage
,
pageCount
,
total
,
endReached
,
search_resource_list
,
}
=
action
.
payload
;
let
newState
=
state
.
setIn
([
'productList'
,
'isFetching'
],
false
)
.
setIn
([
'productList'
,
'error'
],
null
)
.
setIn
([
'productList'
,
'list'
],
Immutable
.
fromJS
(
list
))
.
setIn
([
'productList'
,
'currentPage'
],
currentPage
)
.
setIn
([
'productList'
,
'pageCount'
],
pageCount
)
.
setIn
([
'productList'
,
'total'
],
total
)
.
setIn
([
'productList'
,
'endReached'
],
endReached
)
.
set
(
'searchResourceList'
,
Immutable
.
fromJS
(
search_resource_list
));
return
newState
;
}
case
FILTER_DATA_SUCCESS
:
{
let
{
categoryFilterList
,
filterCategoryDetailFilterList
,
}
=
action
.
payload
;
let
newState
=
state
.
set
(
'categoryFilterList'
,
Immutable
.
fromJS
(
categoryFilterList
))
.
set
(
'filterCategoryDetailFilterList'
,
Immutable
.
fromJS
(
filterCategoryDetailFilterList
))
.
set
(
'filterDataReady'
,
true
);
return
newState
;
}
case
SET_SIMILAR_PRODUCT_INDEX
:
{
let
newState
=
state
.
setIn
([
'productList'
,
'similarIndex'
],
action
.
payload
);
return
newState
;
}
case
PRODUCT_LIST_FAILURE
:
{
return
state
.
setIn
([
'productList'
,
'isFetching'
],
false
)
.
setIn
([
'productList'
,
'error'
],
action
.
payload
);
}
case
RECOMMEND_BRAND_REQUEST
:
{
return
state
.
setIn
([
'recommendForYou'
,
'isFetching'
],
true
);
}
case
RECOMMEND_BRAND_SUCCESS
:
{
return
state
.
setIn
([
'recommendForYou'
,
'isFetching'
],
false
)
.
setIn
([
'recommendForYou'
,
'hotBrandList'
],
Immutable
.
fromJS
(
action
.
payload
.
hotBrandList
))
.
setIn
([
'recommendForYou'
,
'browseBrandList'
],
Immutable
.
fromJS
(
action
.
payload
.
browseBrandList
))
.
setIn
([
'recommendForYou'
,
'newBrandList'
],
Immutable
.
fromJS
(
action
.
payload
.
newBrandList
));
}
case
RECOMMEND_BRAND_FAILURE
:
{
return
state
.
setIn
([
'recommendForYou'
,
'isFetching'
],
false
)
.
setIn
([
'productList'
,
'error'
],
action
.
payload
);
}
case
SET_SHOW_SIMILAR_GUIDER
:
{
return
state
.
set
(
'showSimilarGuider'
,
action
.
payload
);
}
case
GET_SHOPCARTCOUNT_REQUEST
:
{
}
case
GET_SHOPCARTCOUNT_SUCCESS
:
{
return
state
.
set
(
'cart_goods_count'
,
action
.
payload
);
}
case
GET_SHOPCARTCOUNT_FAILURE
:
{
}
case
UPDATE_MORE_FILTER_SELECTED_ORDER
:
{
return
state
.
set
(
'moreFilterSelectOrder'
,
action
.
payload
);
}
case
RESOURCE_INFO_REQUEST
:
{
return
state
.
setIn
([
'resourceInfo'
,
'isFetching'
],
true
)
.
setIn
([
'resourceInfo'
,
'error'
],
action
.
payload
);
}
case
RESOURCE_INFO_SUCCESS
:
{
return
state
.
setIn
([
'resourceInfo'
,
'isFetching'
],
false
)
.
setIn
([
'resourceInfo'
,
'resourceList'
],
Immutable
.
fromJS
(
action
.
payload
))
.
setIn
([
'resourceInfo'
,
'error'
],
null
);
}
case
RESOURCE_INFO_FAILURE
:
{
return
state
.
setIn
([
'resourceInfo'
,
'isFetching'
],
false
)
.
setIn
([
'resourceInfo'
,
'error'
],
null
);
}
case
STORE_CURRENT_TAB_VALUE
:
{
let
{
index
,
tabName
,
queryList
}
=
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
)
.
set
(
'selectedTabIndex'
,
index
)
.
set
(
'selectedTabName'
,
tabName
)
.
set
(
'selectedTabList'
,
queryList
);
}
case
SET_PRODUCT_PARAMS
:
{
let
{
floorid
,
floorname
,
floorindex
}
=
action
.
payload
;
return
state
.
set
(
'prdFloorId'
,
floorid
)
.
set
(
'prdFloorName'
,
floorname
)
.
set
(
'prdFloorIndex'
,
floorindex
);
}
}
return
state
;
}
...
...
js/newArrival/services/NewArrivalService.js
View file @
5f2a965
'use strict'
;
import
Request
from
'../../common/services/NativeRequest'
;
import
{
Platform
}
from
"react-native"
;
export
default
class
HomeService
{
...
...
@@ -12,41 +13,23 @@ export default class HomeService {
this
.
api
=
new
Request
(
baseURL
);
}
async
fetchRecommendShop
(
yh_channel
)
{
let
contentCode
=
'1f2e07cb63811680154ba693c954dd62'
;
switch
(
yh_channel
)
{
case
'1'
:
contentCode
=
'1f2e07cb63811680154ba693c954dd62'
;
break
;
case
'2'
:
contentCode
=
'375f201d1ec56f7515509249c9c66959'
;
break
;
case
'3'
:
contentCode
=
'74c62151673e7dde9fb154c90dcff3f0'
;
break
;
case
'4'
:
contentCode
=
'b9b4bd0de670f982e1f8e7dc23980e81'
;
break
;
default
:
contentCode
=
'1f2e07cb63811680154ba693c954dd62'
;
}
return
await
this
.
api
.
get
({
url
:
''
,
body
:
{
method
:
'app.newproduct.recshop'
,
yh_channel
,
limit
:
10
,
page
:
1
,
contentCode
,
}
})
.
then
((
json
)
=>
{
return
json
;
})
.
catch
((
error
)
=>
{
throw
(
error
);
});
}
//获取资源位
async
fetchResourceInfo
(
content_code
)
{
let
fromPage
=
Platform
.
OS
===
'android'
?
'aFP_Home'
:
'iFP_Home'
;
return
await
this
.
api
.
get
({
url
:
'/operations/api/v5/resource/get'
,
body
:
{
content_code
,
fromPage
}
})
.
then
((
json
)
=>
{
return
json
;
})
.
catch
((
error
)
=>
{
throw
(
error
);
});
}
async
fetchRecommendBrand
(
yh_channel
)
{
return
await
this
.
api
.
get
({
...
...
@@ -115,7 +98,7 @@ export default class HomeService {
});
}
async
fetchProductList
(
yh_channel
,
order
,
page
=
1
,
limit
=
20
,
filterFactors
=
{})
{
async
fetchProductList
(
yh_channel
,
order
,
page
=
1
,
limit
=
20
,
filterFactors
=
{}
,
paramsDic
)
{
let
body
=
{
method
:
'app.newproduct.rec.productList'
,
yh_channel
,
...
...
@@ -123,6 +106,7 @@ export default class HomeService {
page
,
limit
,
...
filterFactors
,
...
paramsDic
,
};
if
(
order
==
's_n_desc'
)
{
delete
body
[
'order'
];
...
...
Please
register
or
login
to post a comment