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
Plain Diff
Browse Files
Authored by
张丽霞
7 years ago
Commit
4bbcf50fc554b61a58a863400c84d47d8352e2b6
2 parents
10ea2e88
bf155434
Merge branch 'patch' into '6.5.5'
revert code See merge request
!2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
33 deletions
js/userLogout/constants/actionTypes.js
js/userLogout/containers/UserLogoutContainer.js
js/userLogout/reducers/userLogout/userLogoutActions.js
js/userLogout/reducers/userLogout/userLogoutInitialState.js
js/userLogout/reducers/userLogout/userLogoutReducer.js
js/userLogout/constants/actionTypes.js
View file @
4bbcf50
...
...
@@ -12,7 +12,9 @@ export default keyMirror({
SET_HOST
:
null
,
SET_SERVICE_HOST
:
null
,
UPDATE_LOGOUT_MODAL_STATE
:
null
,
UPDATE_LOGOUT_STATUS
:
null
,
FETCH_LOGOUT_STATUS_REQUEST
:
null
,
FETCH_LOGOUT_STATUS_SUCCESS
:
null
,
FETCH_LOGOUT_STATUS_FAILURE
:
null
,
//注销原因
...
...
js/userLogout/containers/UserLogoutContainer.js
View file @
4bbcf50
...
...
@@ -9,7 +9,7 @@
import
React
,
{
Component
}
from
'react'
;
import
{
StyleSheet
,
Dimensions
Dimensions
,
}
from
'react-native'
import
{
bindActionCreators
}
from
'redux'
;
...
...
@@ -19,6 +19,8 @@ import * as userLogoutActions from '../reducers/userLogout/userLogoutActions';
import
UserLogout
from
'../components/userLogout/UserLogout'
;
import
UserLogoutFaild
from
'../components/userLogout/UserLogoutFaild'
;
import
UserLogoutStatus
from
'../components/userLogout/UserLogoutStatus'
;
import
LoadingIndicator
from
'../../common/components/LoadingIndicator'
;
const
actions
=
[
userLogoutActions
,
...
...
@@ -82,29 +84,49 @@ class UserLogoutContainer extends Component {
}
render
()
{
let
{
showConfirmLogoutModal
,
logoutStatus
}
=
this
.
props
.
userLogout
;
let
{
showConfirmLogoutModal
,
logoutStatus
,
isFetching
,
tipMessage
}
=
this
.
props
.
userLogout
;
if
(
logoutStatus
==
0
)
{
return
(
<
UserLogout
showConfirmLogoutModal
=
{
showConfirmLogoutModal
}
onPressLogoutClause
=
{
this
.
_onPressLogoutClause
}
confirmLogoutAction
=
{
this
.
_confirmLogoutAction
}
updateLogoutModalState
=
{
this
.
_updateLogoutModalState
}
/
>
);
if
(
isFetching
)
{
return
(
<
LoadingIndicator
isVisible
=
{
isFetching
}
/
>
);
}
else
{
return
(
<
UserLogout
showConfirmLogoutModal
=
{
showConfirmLogoutModal
}
onPressLogoutClause
=
{
this
.
_onPressLogoutClause
}
confirmLogoutAction
=
{
this
.
_confirmLogoutAction
}
updateLogoutModalState
=
{
this
.
_updateLogoutModalState
}
/
>
)
}
}
else
if
(
logoutStatus
==
1
){
return
(
<
UserLogoutStatus
/
>
);
if
(
isFetching
)
{
return
(
<
LoadingIndicator
isVisible
=
{
isFetching
}
/
>
);
}
else
{
return
(
<
UserLogoutStatus
/>
)
}
}
else
if
(
logoutStatus
==
3
){
return
(
<
UserLogoutFaild
isFaildReasonPage
=
{
false
}
gotoLogoutFaildReason
=
{
this
.
_gotoLogoutFaildReason
}
gotoLogoutReason
=
{
this
.
_gotoLogoutReason
}
/
>
);
if
(
isFetching
)
{
return
(
<
LoadingIndicator
isVisible
=
{
isFetching
}
/
>
);
}
else
{
return
(
<
UserLogoutFaild
isFaildReasonPage
=
{
false
}
gotoLogoutFaildReason
=
{
this
.
_gotoLogoutFaildReason
}
gotoLogoutReason
=
{
this
.
_gotoLogoutReason
}
/
>
)
}
}
}
}
...
...
js/userLogout/reducers/userLogout/userLogoutActions.js
View file @
4bbcf50
...
...
@@ -15,7 +15,9 @@ import UserLogoutService from '../../services/UserLogoutService';
const
{
UPDATE_LOGOUT_MODAL_STATE
,
UPDATE_LOGOUT_STATUS
,
FETCH_LOGOUT_STATUS_REQUEST
,
FETCH_LOGOUT_STATUS_SUCCESS
,
FETCH_LOGOUT_STATUS_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
export
function
onPressLogoutClause
()
{
...
...
@@ -32,10 +34,23 @@ export function updateLogoutModalState(flag) {
}
}
export
function
updateLogoutStatus
(
status
)
{
export
function
fetchLogoutStatusRequest
(
)
{
return
{
type
:
UPDATE_LOGOUT_STATUS
,
payload
:
status
type
:
FETCH_LOGOUT_STATUS_REQUEST
}
}
export
function
fetchLogoutStatusSuccess
(
obj
)
{
return
{
type
:
FETCH_LOGOUT_STATUS_SUCCESS
,
payload
:
obj
}
}
export
function
fetchLogoutStatusFailure
(
message
)
{
return
{
type
:
FETCH_LOGOUT_STATUS_FAILURE
,
payload
:
message
}
}
...
...
@@ -50,14 +65,14 @@ export function confirmLogoutAction() {
export
function
checkUserLogedIn
()
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
}
=
getState
();
dispatch
(
fetchLogoutStatusRequest
());
let
fetchLogoutState
=
(
uid
)
=>
{
return
new
UserLogoutService
(
app
.
host
).
fetchLogoutState
(
uid
)
.
then
(
json
=>
{
dispatch
(
updateLogoutStatus
(
json
.
status
));
dispatch
(
fetchLogoutStatusSuccess
({
state
:
json
.
status
,
descList
:
json
.
desc
}
));
})
.
catch
(
error
=>
{
console
.
log
(
error
);
dispatch
(
fetchLogoutStatusFailure
(
error
.
message
?
error
.
message
:
'网络错误'
)
);
});
}
...
...
js/userLogout/reducers/userLogout/userLogoutInitialState.js
View file @
4bbcf50
...
...
@@ -9,9 +9,11 @@
import
{
Record
,
List
,
Map
}
from
'immutable'
;
let
InitialState
=
Record
({
isFetching
:
fals
e
,
isFetching
:
tru
e
,
showConfirmLogoutModal
:
false
,
logoutStatus
:
0
,
tipMessage
:
''
,
cancleFialdDesc
:
List
(),
});
export
default
InitialState
;
...
...
js/userLogout/reducers/userLogout/userLogoutReducer.js
View file @
4bbcf50
...
...
@@ -11,7 +11,9 @@ import Immutable, {Map} from 'immutable';
const
{
UPDATE_LOGOUT_MODAL_STATE
,
UPDATE_LOGOUT_STATUS
FETCH_LOGOUT_STATUS_REQUEST
,
FETCH_LOGOUT_STATUS_SUCCESS
,
FETCH_LOGOUT_STATUS_FAILURE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
const
initialState
=
new
InitialState
;
...
...
@@ -21,8 +23,17 @@ export default function userLogoutReducer(state=initialState, action) {
case
UPDATE_LOGOUT_MODAL_STATE
:
{
return
state
.
set
(
'showConfirmLogoutModal'
,
action
.
payload
);
}
case
UPDATE_LOGOUT_STATUS
:
{
return
state
.
set
(
'logoutStatus'
,
action
.
payload
);
case
fetchLogoutStatusRequest
:
{
return
state
.
set
(
'isFetching'
,
true
);
}
case
FETCH_LOGOUT_STATUS_SUCCESS
:
{
return
state
.
set
(
'logoutStatus'
,
action
.
payload
.
state
)
.
set
(
'cancleFialdDesc'
,
Immutable
.
fromJS
(
action
.
payload
.
descList
))
.
set
(
'isFetching'
,
false
);
}
case
fetchLogoutStatusFailure
:
{
return
state
.
set
(
'isFetching'
,
false
)
.
set
(
'tipMessage'
,
action
.
payload
);
}
}
...
...
Please
register
or
login
to post a comment