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
盖剑秋
8 years ago
Commit
7b01d51ce1165d18bdfe49b79439e02ea6d42cd4
1 parent
ed9f1151
Fix bug on good goods recommend. reviewed by Boss Yin.
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
13 deletions
js/goodGoodsRecommend/components/detail/ContentCell.js
js/goodGoodsRecommend/components/detail/Detail.js
js/goodGoodsRecommend/components/list/List.js
js/goodGoodsRecommend/containers/DetailContainer.js
js/goodGoodsRecommend/containers/ListContainer.js
js/goodGoodsRecommend/reducers/detail/detailActions.js
js/goodGoodsRecommend/reducers/list/listActions.js
js/goodGoodsRecommend/components/detail/ContentCell.js
View file @
7b01d51
...
...
@@ -45,8 +45,16 @@ export default class Detail extends Component {
<
/View
>
<
Text
style
=
{
styles
.
phrase
}
>
{
data
.
get
(
'phrase'
)}
<
/Text
>
<
View
style
=
{
styles
.
tagPannel
}
onLayout
=
{
this
.
onLayout
.
bind
(
this
)}
>
<
Text
style
=
{
styles
.
tag
}
>
{
data
.
get
(
'brand_info'
).
get
(
'brand_domain'
)}
<
/Text
>
<
Text
style
=
{
styles
.
tag
}
>
{
data
.
get
(
'middle_sort_name'
)}
<
/Text
>
<
Text
onPress
=
{()
=>
{
this
.
props
.
onPressTag
&&
this
.
props
.
onPressTag
(
data
.
get
(
'brand_info'
).
get
(
'brand_domain'
))}}
style
=
{
styles
.
tag
}
>
{
data
.
get
(
'brand_info'
).
get
(
'brand_domain'
)}
<
/Text
>
<
Text
onPress
=
{()
=>
{
this
.
props
.
onPressTag
&&
this
.
props
.
onPressTag
(
data
.
get
(
'middle_sort_name'
))}}
style
=
{
styles
.
tag
}
>
{
data
.
get
(
'middle_sort_name'
)}
<
/Text
>
<
/View
>
<
/View
>
);
...
...
js/goodGoodsRecommend/components/detail/Detail.js
View file @
7b01d51
...
...
@@ -63,7 +63,7 @@ export default class Detail extends Component {
}
break
;
case
'content'
:
{
return
<
ContentCell
data
=
{
rowData
}
/
>
return
<
ContentCell
data
=
{
rowData
}
onPressTag
=
{
this
.
props
.
onPressTag
}
/
>
}
break
;
case
'similarTitle'
:
{
...
...
js/goodGoodsRecommend/components/list/List.js
View file @
7b01d51
...
...
@@ -72,7 +72,11 @@ export default class List extends Component {
showsVerticalScrollIndicator
=
{
false
}
dataSource
=
{
this
.
dataSource
.
cloneWithRowsAndSections
(
dataBlob
)}
renderRow
=
{
this
.
renderRow
}
enablePullToRefresh
=
{
true
}
isOnPullToRefresh
=
{
isFetching
}
onRefreshData
=
{()
=>
{
this
.
onRefresh
&&
this
.
props
.
onRefresh
();
}}
onEndReached
=
{()
=>
{
if
(
list
&&
list
.
length
)
{
this
.
props
.
onEndReached
&&
this
.
props
.
onEndReached
();
...
...
js/goodGoodsRecommend/containers/DetailContainer.js
View file @
7b01d51
...
...
@@ -48,6 +48,7 @@ class DetailContainer extends Component {
super
(
props
);
this
.
_onPressProduct
=
this
.
_onPressProduct
.
bind
(
this
);
this
.
_onPressFavorite
=
this
.
_onPressFavorite
.
bind
(
this
);
this
.
_onPressTag
=
this
.
_onPressTag
.
bind
(
this
);
}
componentDidMount
()
{
...
...
@@ -69,6 +70,12 @@ class DetailContainer extends Component {
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
}
_onPressTag
(
tag
)
{
if
(
!
tag
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommonHelper
.
hotSearchWithKeyword
(
tag
);
}
_onPressFavorite
(
favorite
)
{
this
.
props
.
actions
.
changeFavoriteStatus
(
favorite
);
}
...
...
@@ -80,6 +87,7 @@ class DetailContainer extends Component {
resource
=
{
detail
}
onPressProduct
=
{
this
.
_onPressProduct
}
onPressFavorite
=
{
this
.
_onPressFavorite
}
onPressTag
=
{
this
.
_onPressTag
}
/
>
);
}
...
...
js/goodGoodsRecommend/containers/ListContainer.js
View file @
7b01d51
...
...
@@ -49,6 +49,7 @@ class ListContainer extends Component {
this
.
_onPressDetail
=
this
.
_onPressDetail
.
bind
(
this
);
this
.
_onPressBanner
=
this
.
_onPressBanner
.
bind
(
this
);
this
.
_onEndReached
=
this
.
_onEndReached
.
bind
(
this
);
this
.
_onRefresh
=
this
.
_onRefresh
.
bind
(
this
);
}
componentDidMount
()
{
...
...
@@ -60,6 +61,11 @@ class ListContainer extends Component {
}
_onRefresh
()
{
this
.
props
.
actions
.
fetchBanner
();
this
.
props
.
actions
.
getProductList
(
true
);
}
_onPressDetail
(
product_skn
)
{
if
(
!
product_skn
)
{
return
;
...
...
@@ -88,6 +94,7 @@ class ListContainer extends Component {
onPressDetail
=
{
this
.
_onPressDetail
}
onEndReached
=
{
this
.
_onEndReached
}
onPressBanner
=
{
this
.
_onPressBanner
}
onRefresh
=
{
this
.
_onRefresh
}
/
>
);
}
...
...
js/goodGoodsRecommend/reducers/detail/detailActions.js
View file @
7b01d51
...
...
@@ -54,13 +54,28 @@ export function changeFavoriteStatus(favorite) {
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
detail
}
=
getState
();
let
product_id
=
detail
.
get
(
'product'
).
get
(
'data'
).
get
(
'product_id'
);
if
(
product_id
&&
favorite
)
{
new
DetailService
(
app
.
host
).
cancelFavorite
(
product_id
);
let
favRequest
=
(
product_id
,
favorite
)
=>
{
if
(
product_id
&&
favorite
)
{
new
DetailService
(
app
.
host
).
cancelFavorite
(
product_id
);
}
if
(
product_id
&&
!
favorite
)
{
new
DetailService
(
app
.
host
).
addFavorite
(
product_id
);
}
dispatch
(
setFavoriteStatus
(
!
favorite
));
}
if
(
product_id
&&
!
favorite
)
{
new
DetailService
(
app
.
host
).
addFavorite
(
product_id
);
}
dispatch
(
setFavoriteStatus
(
!
favorite
));
ReactNative
.
NativeModules
.
YH_CommonHelper
.
uid
()
.
then
(
uid
=>
{
favRequest
(
product_id
,
favorite
);
})
.
catch
(
error
=>
{
ReactNative
.
NativeModules
.
YH_CommonHelper
.
login
()
.
then
(
uid
=>
{
favRequest
(
product_id
,
favorite
);
})
.
catch
(
error
=>
{
});
});
}
}
...
...
js/goodGoodsRecommend/reducers/list/listActions.js
View file @
7b01d51
...
...
@@ -14,7 +14,7 @@ const {
FETCH_BANNER_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
export
function
getProductList
()
{
export
function
getProductList
(
reload
=
false
)
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
list
}
=
getState
();
let
{
products
}
=
list
;
...
...
@@ -30,7 +30,7 @@ export function getProductList() {
let
payload
=
parseProductList
(
json
);
payload
.
endReached
=
payload
.
currentPage
==
payload
.
pageCount
;
if
(
payload
.
currentPage
>
1
)
{
if
(
payload
.
currentPage
>
1
&&
!
reload
)
{
let
oldList
=
products
.
list
.
toJS
();
let
list
=
[...
oldList
,
...
payload
.
list
];
payload
.
list
=
list
;
...
...
@@ -45,7 +45,7 @@ export function getProductList() {
let
channel
=
app
.
channel
;
let
gender
=
''
;
let
uid
=
0
;
let
page
=
products
.
currentPage
+
1
;
let
page
=
reload
?
1
:
products
.
currentPage
+
1
;
let
pageSize
=
products
.
pageSize
;
Promise
.
all
([
...
...
Please
register
or
login
to post a comment