Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivWeb
Commits
9b121196
Commit
9b121196
authored
Apr 15, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复退出登录子应用卸载
parent
cffd4b71
Pipeline
#48024
skipped with stages
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
27 deletions
+36
-27
actions.js
src/containers/App/store/actions.js
+12
-1
initConfig.js
src/initConfig.js
+1
-9
SecurityLayout.js
src/layouts/SecurityLayout.js
+16
-13
index.js
src/pages/user/login/index.js
+7
-4
No files found.
src/containers/App/store/actions.js
View file @
9b121196
...
...
@@ -25,7 +25,7 @@ import {
AMAP_VIEW
,
PD_VIEW
,
}
from
'./constants'
;
import
{
store
}
from
'@wisdom-utils/utils'
;
export
function
getConfig
(
data
)
{
return
{
type
:
GET_CONFIG
,
...
...
@@ -222,6 +222,17 @@ export function logout(data) {
// eslint-disable-next-line no-undef,no-restricted-globals
createStoreage
.
remove
(
`__PANDA_STORE__MICRO_
${
location
.
hostname
}
`
);
localStorage
.
removeItem
(
'JmReport-Access-Token'
);
const
products
=
(
window
.
globalConfig
.
products
||
[]).
map
(
item
=>
{
if
(
item
.
PackageName
===
'civweb4'
)
{
return
'web4_console'
}
return
`
${
item
.
PackageName
}
-main`
;
});
Object
.
keys
(
products
).
forEach
(
item
=>
{
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
:
store
});
});
return
{
type
:
LOGINOUT
,
data
:
{
...
...
src/initConfig.js
View file @
9b121196
...
...
@@ -106,8 +106,7 @@ export const initGlobalConfig = () => {
gateWayConfig
,
),
// eslint-disable-next-line no-shadow
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
isInit
:
false
,
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
()),
},
...
...
@@ -122,17 +121,10 @@ export const initGlobalConfig = () => {
true
,
);
}
// eslint-disable-next-line no-shadow
}
return
res
;
})
// eslint-disable-next-line no-shadow
.
then
(
res
=>
{
// eslint-disable-next-line no-use-before-define
// initSensorType();
// eslint-disable-next-line no-use-before-define
// initIsMock();
render
({
appContent
:
''
,
loading
:
true
});
})
.
catch
(
error
=>
{
...
...
src/layouts/SecurityLayout.js
View file @
9b121196
import
React
from
'react'
;
import
Cookies
from
'js-cookie'
;
import
{
connect
}
from
'react-redux'
;
import
{
Redirect
}
from
'@wisdom-utils/runtime'
;
import
{
Redirect
,
history
}
from
'@wisdom-utils/runtime'
;
import
{
PageLoading
}
from
'@ant-design/pro-layout'
;
import
_
from
'lodash'
;
import
{
stringify
}
from
'querystring'
;
import
{
store
,
helpers
}
from
'@wisdom-utils/utils'
;
class
SecurityLayout
extends
React
.
Component
{
state
=
{
...
...
@@ -18,8 +19,9 @@ class SecurityLayout extends React.Component {
}
componentWillReceiveProps
(
nextProps
)
{
debugger
const
products
=
(
this
.
props
.
global
.
products
||
[]).
map
(
item
=>
{
if
(
item
.
PackageName
===
'civweb4'
)
{
if
(
item
.
PackageName
===
'civweb4'
)
{
return
'web4_console'
}
return
`
${
item
.
PackageName
}
-main`
;
...
...
@@ -30,14 +32,13 @@ class SecurityLayout extends React.Component {
const
nextPathname
=
nextProps
.
location
.
pathname
;
const
nextArgv
=
nextPathname
.
split
(
'/'
);
console
.
log
(
argv
[
2
],
nextArgv
[
2
])
if
(
argv
[
2
]
!==
nextArgv
[
2
])
{
if
(
argv
[
2
]
!==
nextArgv
[
2
])
{
Object
.
keys
(
products
).
forEach
(
item
=>
{
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
:
store
});
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
:
store
});
});
}
if
(
this
.
props
.
location
.
pathname
!==
nextProps
.
location
.
pathname
)
{
store
.
set
(
'event:globalConfig'
,
{
globalConfig
:
nextProps
.
global
});
if
(
this
.
props
.
location
.
pathname
!==
nextProps
.
location
.
pathname
)
{
store
.
set
(
'event:globalConfig'
,
{
globalConfig
:
nextProps
.
global
});
}
}
...
...
@@ -46,19 +47,21 @@ class SecurityLayout extends React.Component {
const
{
isReady
}
=
this
.
state
;
const
{
children
,
global
,
loading
}
=
this
.
props
;
const
isLogin
=
Cookies
.
get
(
'token'
)
!==
null
&&
global
.
token
!==
null
;
// const queryString = stringify({
// redirect: window.location.href,
// });
if
(
!
Cookies
.
get
(
'token'
))
{
if
(
!
isLogin
&&
window
.
location
.
pathname
!==
'/civbase/user/login'
)
{
const
{
query
=
{},
search
,
pathname
}
=
history
.
location
;
const
{
redirect
}
=
query
;
const
queryString
=
stringify
({
redirect
:
pathname
+
search
,
});
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
let
client
=
global
.
client
||
Cookies
.
get
(
'city'
);
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
// event.emit(?'event:initConfig');
let
{
generateType
}
=
global
;
generateType
=
!
_
.
isNull
(
generateType
)
&&
!
_
.
isUndefined
(
generateType
)
&&
generateType
!==
'undefined'
?
`&generateType=
${
generateType
}
`
:
''
;
return
(
<
Redirect
to
=
{
`/user/login?client=
${
client
}${
generateType
}
`
}
to
=
{
`/user/login?client=
${
client
}${
generateType
}
&
${
queryString
}
`
}
/
>
);
}
...
...
src/pages/user/login/index.js
View file @
9b121196
import
React
from
'react'
;
import
React
,
{
useEffect
}
from
'react'
;
import
BaseLogin
from
'./template/baseLogin'
;
import
NewYear
from
'./template/newYear'
;
import
InfoLogin
from
'./template/infoLogin'
;
import
Yulin
from
'./template/yulin'
;
import
{
getParams
}
from
'@wisdom-utils/utils/lib/helpers/params'
;
// import { useParams } from '@wisdom-utils/runtime';
import
{
initGlobalConfig
}
from
'../../../initConfig'
;
const
LoginTemplate
=
{
'新春 - 智联.html'
:
NewYear
,
...
...
@@ -16,9 +18,10 @@ const LoginTemplate = {
};
/* eslint-disable */
export
default
(
props
)
=>
{
// React.useEffect(() => {
// initGlobalConfig();
// }, [props.location]);
const
redirect
=
getParams
(
'redirect'
);
useEffect
(()
=>
{
initGlobalConfig
();
},
[
redirect
]);
const
template
=
window
.
globalConfig
&&
window
.
globalConfig
.
loginTemplate
;
const
RenderComponent
=
LoginTemplate
[
template
]
?
LoginTemplate
[
template
]:
LoginTemplate
[
'default'
];
return
<
RenderComponent
{...
props
}
/
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment