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
孙凯
7 years ago
Commit
fc81bf11b026ce44dc082f0a4b11cdef39bce0e3
1 parent
a04d51ab
add share shortUrl review by chenling
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
4 deletions
js/alliance/constants/actionTypes.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/constants/actionTypes.js
View file @
fc81bf1
...
...
@@ -138,4 +138,8 @@ export default keyMirror({
FAVORITE_INFO_REQUEST
:
null
,
FAVORITE_INFO_FAILURE
:
null
,
});
\ No newline at end of file
SHARE_CODE_INFO_REQUEST
:
null
,
SHARE_CODE_INFO_SUCCESS
:
null
,
SHARE_CODE_INFO_FAILURE
:
null
,
});
...
...
js/alliance/containers/ShareDetailContainer.js
View file @
fc81bf1
...
...
@@ -56,6 +56,7 @@ class ShareDetailContainer extends Component {
}
componentDidMount
()
{
this
.
props
.
actions
.
fetchShareCodeInfo
(
this
.
props
.
product_skn
);
this
.
props
.
actions
.
fetchShareDetail
({
product_skn
:
this
.
props
.
product_skn
});
this
.
props
.
actions
.
fetchFavoriteInfo
({
id
:
this
.
props
.
product_id
,
type
:
'product'
})
}
...
...
@@ -66,11 +67,14 @@ class ShareDetailContainer extends Component {
showShareView
=
(
productInfo
)
=>
{
let
{
host
}
=
this
.
props
.
app
;
let
{
shareDetail
}
=
this
.
props
;
let
shareDetailJS
=
shareDetail
?
shareDetail
.
toJS
():
null
;
let
goodsList
=
productInfo
.
goodsList
;
let
productPriceBo
=
productInfo
.
productPriceBo
;
let
goodsInfo
=
goodsList
?
goodsList
[
0
]
:
{};
let
productSkn
=
productPriceBo
.
productSkn
;
let
productUrl
=
productInfo
.
productUrl
;
let
shortUrl
=
shareDetailJS
&&
shareDetailJS
.
shareCodeInfo
?
shareDetailJS
.
shareCodeInfo
.
shortUrl
:
''
;
let
unionType
=
ReactNative
.
NativeModules
.
YH_CommonHelper
.
unionType
();
let
qrCode
;
if
(
unionType
)
{
...
...
@@ -78,6 +82,7 @@ class ShareDetailContainer extends Component {
productSkn
,
union_type
:
unionType
,
}
productUrl
=
shortUrl
;
let
paramsString
=
encodeURIComponent
(
JSON
.
stringify
(
params
));
qrCode
=
host
+
'/wechat/miniapp/img-check.jpg?param='
+
paramsString
+
'&miniQrType=7'
;
}
else
{
...
...
@@ -88,7 +93,7 @@ class ShareDetailContainer extends Component {
title
:
productInfo
.
productName
?
productInfo
.
productName
:
''
,
content
:
productInfo
.
productName
?
productInfo
.
productName
:
''
,
image
:
goodsInfo
.
colorImage
,
url
:
''
,
url
:
productUrl
,
miniProgramPath
:
'pages/goodsDetail/goodsDetail?productSkn='
+
productSkn
,
miniProgramQCodeUrl
:
qrCode
,
product_name
:
productInfo
.
productName
?
productInfo
.
productName
:
''
,
...
...
@@ -98,7 +103,6 @@ class ShareDetailContainer extends Component {
};
ReactNative
.
NativeModules
.
YH_CommonHelper
.
shareInfoWithParam
(
shareParam
);
}
_goBack
=
()
=>
{
...
...
js/alliance/reducers/shareDetail/shareDetailActions.js
View file @
fc81bf1
...
...
@@ -13,8 +13,55 @@ const {
FAVORITE_INFO_REQUEST
,
FAVORITE_INFO_FAILURE
,
SHARE_CODE_INFO_REQUEST
,
SHARE_CODE_INFO_SUCCESS
,
SHARE_CODE_INFO_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
export
function
fetchShareCodeInfoRequest
()
{
return
{
type
:
SHARE_CODE_INFO_REQUEST
}
}
export
function
fetchShareCodeInfoSuccess
(
json
)
{
return
{
type
:
SHARE_CODE_INFO_SUCCESS
,
payload
:
json
}
}
export
function
fetchShareCodeInfoFailue
(
error
)
{
return
{
type
:
SHARE_CODE_INFO_FAILURE
,
payload
:
error
}
}
export
function
fetchShareCodeInfo
(
skn
)
{
return
async
(
dispatch
,
getState
)
=>
{
let
{
app
:
{
host
}
}
=
getState
();
let
getShareCodeInfo
=
(
unionType
)
=>
{
dispatch
(
fetchShareCodeInfoRequest
());
return
new
Service
(
host
).
fetchShareCodeInfo
(
skn
,
unionType
)
.
then
(
json
=>
{
dispatch
(
fetchShareCodeInfoSuccess
(
json
));
})
.
catch
(
error
=>
{
dispatch
(
fetchShareCodeInfoFailue
(
error
));
});
};
ReactNative
.
NativeModules
.
YH_CommonHelper
.
unionType
()
.
then
(
unionType
=>
{
getShareCodeInfo
(
unionType
)
})
.
catch
(
error
=>
{
getShareCodeInfo
()
});
}
}
export
function
shareDetailRequest
()
{
return
{
type
:
SHARE_DETAIL_REQUEST
...
...
js/alliance/reducers/shareDetail/shareDetailInitialState.js
View file @
fc81bf1
...
...
@@ -7,6 +7,7 @@ let InitialState = Record({
error
:
''
,
productInfo
:
{},
isCollect
:
'N'
,
shareCodeInfo
:
null
,
});
export
default
InitialState
;
...
...
js/alliance/reducers/shareDetail/shareDetailReducer.js
View file @
fc81bf1
...
...
@@ -12,6 +12,11 @@ const {
ADD_FAVORITE_FAILURE
,
FAVORITE_INFO_REQUEST
,
FAVORITE_INFO_FAILURE
,
SHARE_CODE_INFO_REQUEST
,
SHARE_CODE_INFO_SUCCESS
,
SHARE_CODE_INFO_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
const
initialState
=
new
InitialState
;
...
...
@@ -42,6 +47,14 @@ export default function appReducer(state = initialState, action) {
case
ADD_FAVORITE_FAILURE
:
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'error'
,
action
.
payload
);
case
SHARE_CODE_INFO_REQUEST
:
return
state
.
set
(
'isFetching'
,
true
);
case
SHARE_CODE_INFO_SUCCESS
:
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'shareCodeInfo'
,
Immutable
.
fromJS
(
action
.
payload
));
case
SHARE_CODE_INFO_FAILURE
:
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'error'
,
action
.
payload
);
}
return
state
;
...
...
js/alliance/services/ShareDetailService.js
View file @
fc81bf1
...
...
@@ -8,6 +8,26 @@ export default class Service {
}
this
.
api
=
new
Request
(
baseURL
);
}
async
fetchShareCodeInfo
(
skn
,
unionType
)
{
return
await
this
.
api
.
get
({
url
:
''
,
body
:
{
method
:
'app.union.shareOrder.getShareCodeInfo'
,
skn
,
type
:
1
,
unionType
,
}
})
.
then
((
json
)
=>
{
return
json
;
})
.
catch
((
error
)
=>
{
throw
(
error
);
});
}
async
fetchShareDetail
(
params
)
{
return
await
this
.
api
.
get
({
url
:
''
,
...
...
Please
register
or
login
to post a comment