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
chenl
8 years ago
Commit
778558d2ed71cbe643c925e5eaaaffa1ecf55cdb
1 parent
3771a578
增加我的个人中心不喜欢事件。review by 张亚宁。
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
2 deletions
js/mine/components/mine/MineList.js
js/mine/constants/actionTypes.js
js/mine/containers/MineContainer.js
js/mine/reducers/mine/mineActions.js
js/mine/reducers/mine/mineReducer.js
js/mine/services/MineService.js
js/mine/components/mine/MineList.js
View file @
778558d
...
...
@@ -59,6 +59,7 @@ export default class MineList extends React.Component {
onPressProduct
=
{
this
.
props
.
onPressProductListProduct
}
onLongPressProduct
=
{
this
.
props
.
onLongPressProduct
}
onPressFindSimilar
=
{
this
.
props
.
onPressFindSimilar
}
onPressDislike
=
{
this
.
props
.
onPressDislike
}
showSimilarGuider
=
{
showSimilarGuider
}
/
>
);
...
...
js/mine/constants/actionTypes.js
View file @
778558d
...
...
@@ -66,6 +66,7 @@ export default keyMirror({
SET_SIMILAR_PRODUCT_INDEX
:
null
,
SET_SHOW_SIMILAR_GUIDER
:
null
,
DISLIKE_SUCCESS
:
null
,
LOGIN_IN_SUCCESS
:
null
,
LOGIN_OUT_SUCCESS
:
null
,
...
...
js/mine/containers/MineContainer.js
View file @
778558d
...
...
@@ -44,8 +44,8 @@ class MineContainer extends Component {
this
.
_onMineCenterRefresh
=
this
.
_onMineCenterRefresh
.
bind
(
this
);
this
.
_onLongPressProduct
=
this
.
_onLongPressProduct
.
bind
(
this
);
this
.
_onPressFindSimilar
=
this
.
_onPressFindSimilar
.
bind
(
this
);
//资源位点击楼层
this
.
_onPressDislike
=
this
.
_onPressDislike
.
bind
(
this
);
//资源位点击楼层
this
.
_onPressFloorItem
=
this
.
_onPressFloorItem
.
bind
(
this
);
this
.
subscription1
=
NativeAppEventEmitter
.
addListener
(
...
...
@@ -331,6 +331,15 @@ class MineContainer extends Component {
this
.
props
.
actions
.
setShowSimilarGuider
(
false
,
false
);
}
_onPressDislike
(
product
,
similarIndex
)
{
this
.
props
.
actions
.
setSimilarIndex
(
-
1
);
let
product_skn
=
product
&&
product
.
get
(
'product_skn'
,
0
);
if
(
!
product_skn
||
product_skn
==
0
)
{
return
;
}
this
.
props
.
actions
.
fetchDislike
(
similarIndex
,
product_skn
);
}
_onMineCenterRefresh
()
{
InteractionManager
.
runAfterInteractions
(()
=>
{
this
.
props
.
actions
.
onMineCenterRefresh
();
...
...
@@ -403,6 +412,7 @@ class MineContainer extends Component {
getProductListForMineCenter
=
{
this
.
props
.
actions
.
getProductListForMineCenter
}
onLongPressProduct
=
{
this
.
_onLongPressProduct
}
onPressFindSimilar
=
{
this
.
_onPressFindSimilar
}
onPressDislike
=
{
this
.
_onPressDislike
}
onPressFloorItem
=
{
this
.
_onPressFloorItem
}
showSimilarGuider
=
{
showSimilarGuider
}
/
>
...
...
js/mine/reducers/mine/mineActions.js
View file @
778558d
...
...
@@ -70,6 +70,7 @@ const {
SET_SIMILAR_PRODUCT_INDEX
,
SET_SHOW_SIMILAR_GUIDER
,
DISLIKE_SUCCESS
,
LOGIN_IN_SUCCESS
,
LOGIN_OUT_SUCCESS
,
...
...
@@ -323,6 +324,27 @@ export function setSimilarIndex(rowID) {
}
}
export
function
fetchDislike
(
rowID
,
product_skn
)
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
,
mine
}
=
getState
();
let
channel
=
app
.
channel
;
return
new
MineService
(
app
.
host
).
fetchDislike
(
channel
,
product_skn
)
.
then
(
json
=>
{
let
data
=
json
.
product_list
&&
json
.
product_list
.
length
?
json
.
product_list
[
0
]:{};
dispatch
(
fetchDislikeSuccess
(
rowID
,
data
));
})
.
catch
(
error
=>
{
});
}
}
function
fetchDislikeSuccess
(
rowID
,
json
,
channelStr
)
{
return
{
type
:
DISLIKE_SUCCESS
,
payload
:
{
rowID
,
json
,
channelStr
}
}
}
export
function
getMineResourceSuccess
(
json
)
{
return
{
type
:
GET_MINERESOURCE_SUCCESS
,
...
...
js/mine/reducers/mine/mineReducer.js
View file @
778558d
...
...
@@ -66,6 +66,7 @@ const {
SET_SIMILAR_PRODUCT_INDEX
,
SET_SHOW_SIMILAR_GUIDER
,
DISLIKE_SUCCESS
,
LOGIN_IN_SUCCESS
,
LOGIN_OUT_SUCCESS
,
...
...
@@ -109,6 +110,12 @@ export default function appReducer(state = initialState, action) {
return
state
.
set
(
'showSimilarGuider'
,
action
.
payload
);
}
case
DISLIKE_SUCCESS
:
{
let
{
rowID
,
json
}
=
action
.
payload
;
let
newState
=
state
.
setIn
([
'open'
,
'productListForMineCenter'
,
'product_list'
,
rowID
],
Immutable
.
fromJS
(
json
));
return
newState
;
}
case
LOGIN_IN_SUCCESS
:
{
let
uid
=
action
.
payload
;
let
newProfile
=
state
.
profile
.
set
(
"uid"
,
uid
);
...
...
js/mine/services/MineService.js
View file @
778558d
...
...
@@ -301,4 +301,24 @@ export default class MineService {
throw
(
error
);
});
}
async
fetchDislike
(
channel
,
product_skn
)
{
let
rec_pos
=
'100004'
;
return
await
this
.
api
.
get
({
url
:
''
,
body
:
{
method
:
'app.product.notLike'
,
yh_channel
:
channel
,
rec_pos
,
product_skn
,
}
})
.
then
((
json
)
=>
{
return
json
;
})
.
catch
((
error
)
=>
{
throw
(
error
);
});
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment