Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
QC-L
7 years ago
Commit
9a4e3c01bce198ad135e6696f80d2f3519c03c7d
1 parent
6017239a
更新首页和爆款推荐筛选栏悬浮效果
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
31 deletions
js/alliance/components/Home.js
js/alliance/components/recommend/Recommend.js
js/alliance/containers/RecommendContainer.js
js/alliance/components/Home.js
View file @
9a4e3c0
...
...
@@ -25,6 +25,7 @@ export default class Home extends Component {
super
(
props
);
this
.
_renderRow
=
this
.
_renderRow
.
bind
(
this
);
this
.
_renderSectionHeader
=
this
.
_renderSectionHeader
.
bind
(
this
);
this
.
_floorCellRender
=
this
.
_floorCellRender
.
bind
(
this
);
this
.
dataSource
=
new
ListView
.
DataSource
({
...
...
@@ -33,6 +34,27 @@ export default class Home extends Component {
});
}
_renderSectionHeader
(
sectionData
,
sectionID
)
{
switch
(
sectionID
)
{
case
'categoryList'
:
{
let
{
productList
}
=
this
.
props
.
data
;
let
selectedCategoryIndex
=
productList
.
selectedCategoryIndex
;
let
categoryList
=
productList
.
msort_list
.
unshift
(
hotRecommend
);
return
(
<
CategorySelector
data
=
{
categoryList
}
selectedCategoryIndex
=
{
selectedCategoryIndex
}
onPressCategory
=
{(
rowData
,
rowID
)
=>
{
this
.
props
.
onPressCategory
&&
this
.
props
.
onPressCategory
(
rowData
,
rowID
);
}}
/>
);
}
default
:
return
null
;
}
}
_renderRow
(
rowData
,
sectionID
,
rowID
)
{
let
paddingLeft
=
rowID
%
2
===
1
?
rowMarginHorizontal
/
2
:
rowMarginHorizontal
;
let
customStyle
=
rowID
===
0
||
rowID
===
1
?
{
paddingLeft
}
:
{
paddingLeft
};
...
...
@@ -65,21 +87,6 @@ export default class Home extends Component {
);
}
case
'categoryList'
:
{
let
{
productList
}
=
this
.
props
.
data
;
let
selectedCategoryIndex
=
productList
.
selectedCategoryIndex
;
let
categoryList
=
productList
.
msort_list
.
unshift
(
hotRecommend
);
return
(
<
CategorySelector
data
=
{
categoryList
}
selectedCategoryIndex
=
{
selectedCategoryIndex
}
onPressCategory
=
{(
rowData
,
rowID
)
=>
{
this
.
props
.
onPressCategory
&&
this
.
props
.
onPressCategory
(
rowData
,
rowID
);
}}
/>
);
}
default
:
return
null
;
}
...
...
@@ -168,6 +175,7 @@ export default class Home extends Component {
ref
=
{(
c
)
=>
{
this
.
listView
=
c
;
}}
renderSectionHeader
=
{
this
.
_renderSectionHeader
}
yh_viewVisible
=
{
true
}
contentContainerStyle
=
{
styles
.
contentContainer
}
enableEmptySections
=
{
true
}
...
...
js/alliance/components/recommend/Recommend.js
View file @
9a4e3c0
...
...
@@ -21,6 +21,7 @@ export default class Recommend extends Component {
super
(
props
);
this
.
renderRow
=
this
.
renderRow
.
bind
(
this
);
this
.
_renderSectionHeader
=
this
.
_renderSectionHeader
.
bind
(
this
);
this
.
dataSource
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
!
Immutable
.
is
(
r1
,
r2
),
...
...
@@ -30,6 +31,28 @@ export default class Recommend extends Component {
this
.
listView
=
null
;
}
_renderSectionHeader
(
sectionData
,
sectionID
)
{
switch
(
sectionID
)
{
case
'categoryList'
:
{
let
{
productList
}
=
this
.
props
.
data
;
let
selectedCategoryIndex
=
productList
.
selectedCategoryIndex
;
let
categoryList
=
productList
.
msort_list
.
unshift
(
hotRecommend
);
return
(
<
CategorySelector
data
=
{
categoryList
}
selectedCategoryIndex
=
{
selectedCategoryIndex
}
onPressCategory
=
{(
rowData
,
rowID
)
=>
{
// this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this
.
props
.
onPressCategory
&&
this
.
props
.
onPressCategory
(
rowData
,
rowID
);
}}
/
>
);
}
default
:
return
null
;
}
}
renderRow
(
rowData
,
sectionID
,
rowID
)
{
let
sliderHeight
=
118
*
DEVICE_WIDTH_RATIO
;
let
imageUrl
=
YH_Image
.
getSlicedUrl
(
this
.
props
.
src
,
width
,
sliderHeight
,
2
);
...
...
@@ -50,21 +73,7 @@ export default class Recommend extends Component {
<
/TouchableOpacity
>
);
}
case
'categoryList'
:
{
let
{
productList
}
=
this
.
props
.
data
;
let
selectedCategoryIndex
=
productList
.
selectedCategoryIndex
;
let
categoryList
=
productList
.
msort_list
.
unshift
(
hotRecommend
);
return
(
<
CategorySelector
data
=
{
categoryList
}
selectedCategoryIndex
=
{
selectedCategoryIndex
}
onPressCategory
=
{(
rowData
,
rowID
)
=>
{
// this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this
.
props
.
onPressCategory
&&
this
.
props
.
onPressCategory
(
rowData
,
rowID
);
}}
/
>
);
}
case
'productList'
:
{
return
(
<
ProductCell
...
...
@@ -97,6 +106,7 @@ export default class Recommend extends Component {
ref
=
{(
c
)
=>
{
this
.
listView
=
c
;
}}
renderSectionHeader
=
{
this
.
_renderSectionHeader
}
enableEmptySections
=
{
true
}
yh_viewVisible
=
{
true
}
dataSource
=
{
this
.
dataSource
.
cloneWithRowsAndSections
(
dataSource
)}
...
...
js/alliance/containers/RecommendContainer.js
View file @
9a4e3c0
...
...
@@ -68,7 +68,7 @@ class RecommendContainer extends Component {
productPool
,
skns
,
}
=
this
.
props
.
app
;
this
.
props
.
actions
.
setAppSelectedCategory
(
productPool
,
skns
,
data
.
get
(
'sort_id'
),
index
);
this
.
props
.
actions
.
setAppSelectedCategory
(
productPool
,
skns
,
data
.
get
(
'sort_id'
),
data
.
get
(
'sort_name'
),
index
);
}
onPressProduct
(
product
)
{
...
...
Please
register
or
login
to post a comment