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
aozhe.zhu
7 years ago
Commit
63505209b291a65af8242eb14561f4628fe3ee8e
1 parent
86f2382a
达人UI 收藏 修改 review by 孙凯
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
77 additions
and
9 deletions
js/alliance/Alliance.js
js/alliance/components/RankBody.js
js/alliance/components/TalentRank.js
js/alliance/constants/actionTypes.js
js/alliance/containers/HomeContainer.js
js/alliance/containers/ShareDetailContainer.js
js/alliance/reducers/shareDetail/shareDetailActions.js
js/alliance/reducers/shareDetail/shareDetailInitialState.js
js/alliance/reducers/shareDetail/shareDetailReducer.js
js/alliance/services/ShareDetailService.js
js/alliance/Alliance.js
View file @
6350520
...
...
@@ -109,7 +109,9 @@ export default function native(platform) {
}
else
if
(
type
===
'shareDetail'
)
{
return
(
<
Provider
store
=
{
store
}
>
<
ShareDetailContainer
product_skn
=
{
this
.
props
.
product_skn
}
/
>
<
ShareDetailContainer
product_skn
=
{
this
.
props
.
product_skn
}
product_id
=
{
this
.
props
.
product_id
}
/
>
<
/Provider
>
);
}
else
if
(
type
===
'recommendProduct'
)
{
...
...
js/alliance/components/RankBody.js
View file @
6350520
...
...
@@ -41,9 +41,9 @@ class RankItem extends PureComponent {
<
View
style
=
{
styles
.
row
}
>
<
Text
style
=
{
styles
.
rank
}
>
{
rankNum
}
<
/Text
>
{
this
.
_renderImage
(
image
)}
<
Text
style
=
{
styles
.
name
}
>
{
nickname
}
<
/Text
>
<
Text
style
=
{
styles
.
name
}
numberOfLines
=
{
1
}
>
{
nickname
}
<
/Text
>
<
View
style
=
{
styles
.
rightContainer
}
>
<
Text
style
=
{
styles
.
amount
}
>
{
amountStr
}
<
/Text
>
<
Text
style
=
{
styles
.
amount
}
numberOfLines
=
{
1
}
>
{
amountStr
}
<
/Text
>
<
Text
style
=
{
styles
.
amountName
}
>
{
`
$
{
monthRank
?
'本月'
:
'总'
}
预估收入`
}
<
/Text
>
<
/View
>
<
/View
>
...
...
js/alliance/components/TalentRank.js
View file @
6350520
...
...
@@ -45,12 +45,12 @@ class TalentRank extends Component {
<
View
style
=
{[
styles
.
container
,
styles
.
leftContainer
]}
>
<
Text
style
=
{
styles
.
amountName
}
>
{
`
$
{
monthRank
?
'本月'
:
'总'
}
预估收入`
}
<
/Text
>
<
View
style
=
{
styles
.
amountContainer
}
>
<
Text
style
=
{
styles
.
amount
Unit
}
>
¥
<
/Text><Text style={styles.amount
}>{amountStr}</
Text
>
<
Text
style
=
{
styles
.
amount
}
>
{
amountStr
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{[
styles
.
container
,
styles
.
middleContainer
]}
>
{
this
.
_renderImage
(
image
)}
<
Text
style
=
{
styles
.
name
}
>
{
nickname
}
<
/Text
>
<
Text
style
=
{
styles
.
name
}
numberOfLines
=
{
1
}
>
{
nickname
}
<
/Text
>
<
/View
>
<
View
style
=
{[
styles
.
container
,
styles
.
rightContainer
]}
>
<
Text
style
=
{[
styles
.
amountName
,
styles
.
textRight
]}
>
排名
<
/Text
>
...
...
js/alliance/constants/actionTypes.js
View file @
6350520
...
...
@@ -133,4 +133,7 @@ export default keyMirror({
ADD_FAVORITE_REQUEST
:
null
,
ADD_FAVORITE_SUCCESS
:
null
,
ADD_FAVORITE_FAILURE
:
null
,
FAVORITE_INFO_REQUEST
:
null
,
FAVORITE_INFO_FAILURE
:
null
,
});
\ No newline at end of file
...
...
js/alliance/containers/HomeContainer.js
View file @
6350520
...
...
@@ -107,6 +107,7 @@ class HomeContainer extends Component {
_onPressProduct
(
product
)
{
let
productSkn
=
product
&&
product
.
get
(
'product_skn'
,
0
);
let
product_id
=
product
&&
product
.
get
(
'product_id'
,
0
);
if
(
!
productSkn
)
{
return
;
}
...
...
@@ -116,7 +117,7 @@ class HomeContainer extends Component {
pageName
=
'aFP_Alliance'
;
}
let
url
=
`
http
:
//m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"type":"shareDetail", "product_skn":"${productSkn}", "from_page_name":"${pageName}"}}`;
let
url
=
`
http
:
//m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"type":"shareDetail", "product_skn":"${productSkn}", "
product_id": "${product_id}" ,"
from_page_name":"${pageName}"}}`;
ReactNative
.
NativeModules
.
YH_CommonHelper
.
jumpWithUrl
(
url
);
}
...
...
js/alliance/containers/ShareDetailContainer.js
View file @
6350520
...
...
@@ -68,10 +68,11 @@ class ShareDetailContainer extends Component {
componentDidMount
()
{
this
.
props
.
actions
.
fetchShareDetail
({
product_skn
:
this
.
props
.
product_skn
});
this
.
props
.
actions
.
fetchFavoriteInfo
({
id
:
this
.
props
.
product_id
,
type
:
'product'
})
}
_addFavorite
=
()
=>
{
this
.
props
.
actions
.
addFavorite
({
id
:
this
.
props
.
product_
skn
,
type
:
'product'
});
this
.
props
.
actions
.
addFavorite
({
id
:
this
.
props
.
product_
id
,
type
:
'product'
});
}
showShareView
=
(
show
)
=>
{
...
...
js/alliance/reducers/shareDetail/shareDetailActions.js
View file @
6350520
...
...
@@ -10,6 +10,8 @@ const {
ADD_FAVORITE_REQUEST
,
ADD_FAVORITE_SUCCESS
,
ADD_FAVORITE_FAILURE
,
FAVORITE_INFO_REQUEST
,
FAVORITE_INFO_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
...
...
@@ -87,4 +89,38 @@ export function addFavorite(params) {
}
dispatch
(
addFavoriteSuccess
(
isCollect
===
'Y'
?
'N'
:
'Y'
));
}
}
export
function
favoriteInfoRequest
()
{
return
{
type
:
FAVORITE_INFO_REQUEST
,
}
}
export
function
favoriteInfoFailure
(
e
)
{
return
{
type
:
FAVORITE_INFO_FAILURE
,
payload
:
e
,
}
}
export
function
fetchFavoriteInfo
(
params
)
{
return
async
(
dispatch
,
getState
)
=>
{
let
{
app
:
{
host
}
}
=
getState
();
let
uid
,
data
;
let
service
=
new
Service
(
host
);
dispatch
(
favoriteInfoRequest
());
try
{
uid
=
await
ReactNative
.
NativeModules
.
YH_CommonHelper
.
uid
();
params
=
{
method
:
'app.favorite.isFavoriteNew'
,
uid
,
...
params
};
data
=
await
service
.
fetchInfo
(
params
);
}
catch
(
e
)
{
dispatch
(
favoriteInfoFailure
(
e
));
}
dispatch
(
addFavoriteSuccess
(
data
?
'Y'
:
'N'
));
}
}
\ No newline at end of file
...
...
js/alliance/reducers/shareDetail/shareDetailInitialState.js
View file @
6350520
...
...
@@ -4,6 +4,7 @@ import {List, Map, Record} from 'immutable';
let
InitialState
=
Record
({
isFetching
:
false
,
error
:
''
,
productInfo
:
new
(
Record
({
goodsList
:
List
()
})),
...
...
js/alliance/reducers/shareDetail/shareDetailReducer.js
View file @
6350520
...
...
@@ -10,6 +10,8 @@ const {
ADD_FAVORITE_REQUEST
,
ADD_FAVORITE_SUCCESS
,
ADD_FAVORITE_FAILURE
,
FAVORITE_INFO_REQUEST
,
FAVORITE_INFO_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
const
initialState
=
new
InitialState
;
...
...
@@ -24,14 +26,22 @@ export default function appReducer(state = initialState, action) {
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'productInfo'
,
Immutable
.
fromJS
(
action
.
payload
));
case
SHARE_DETAIL_FAILURE
:
return
state
.
set
(
'isFetching'
,
false
);
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'error'
,
action
.
payload
);
case
ADD_FAVORITE_REQUEST
:
return
state
.
set
(
'isFetching'
,
true
);
case
ADD_FAVORITE_SUCCESS
:
return
state
.
set
(
'isFetching'
,
false
)
.
setIn
([
'productInfo'
,
'isCollect'
],
action
.
payload
);
case
ADD_FAVORITE_FAILURE
:
return
state
.
set
(
'isFetching'
,
false
);
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'error'
,
action
.
payload
);
case
ADD_FAVORITE_FAILURE
:
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'error'
,
action
.
payload
);
case
ADD_FAVORITE_FAILURE
:
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'error'
,
action
.
payload
);
}
return
state
;
...
...
js/alliance/services/ShareDetailService.js
View file @
6350520
...
...
@@ -53,4 +53,18 @@ export default class Service {
throw
(
error
);
});
}
async
fetchInfo
(
params
)
{
return
await
this
.
api
.
get
({
url
:
''
,
body
:
{
...
params
}
})
.
then
((
json
)
=>
{
return
json
;
})
.
catch
((
error
)
=>
{
throw
(
error
);
});
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment