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
83c714e2
Commit
83c714e2
authored
Mar 30, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 获取网关与获取全局配置互相覆盖引起的异常问题
parent
cd7ae4fb
Pipeline
#46965
skipped with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
initConfig.js
src/initConfig.js
+20
-15
SecurityLayout.js
src/layouts/SecurityLayout.js
+1
-4
No files found.
src/initConfig.js
View file @
83c714e2
...
...
@@ -45,23 +45,27 @@ export const initGlobalConfig = () => {
updateTheme
(
'#ff9600'
);
}
}
else
{
// eslint-disable-next-line react-hooks/rules-of-hooks
let
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
client
=
client
&&
client
!==
'undefined'
?
client
:
'city'
;
appService
.
getWateWayConfig
().
then
(
res
=>
{
const
hasGateWay
=
res
&&
res
.
data
&&
isString
(
res
.
data
)
?
JSON
.
parse
(
res
.
data
)
:
res
.
data
;
if
(
res
.
code
===
0
&&
res
.
data
===
'true'
)
{
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
!
res
||
!
res
.
data
?
false
:
isString
(
res
.
data
)
?
JSON
.
parse
(
res
.
data
)
:
typeof
res
.
data
===
'boolean'
?
res
.
data
:
false
;
// if (res.code === 0 && res.data === 'true') {
// store.dispatch(
// actionCreators.getConfig(
// Object.assign({}, window.globalConfig, {
// hasGateWay,
// apiGatewayDomain: `${window.location.origin}/PandaCore`,
// }),
// ),
// );
// }
return
{
hasGateWay
,
apiGatewayDomain
:
`
${
window
.
location
.
origin
}
/PandaCore`
,
}),
),
);
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
let
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
client
=
client
&&
client
!==
'undefined'
?
client
:
'city'
;
}).
then
((
gateWayConfig
)
=>
{
appService
.
queryConfig
({
client
:
client
||
'city'
,
...
...
@@ -69,8 +73,6 @@ export const initGlobalConfig = () => {
})
.
then
(
res
=>
{
if
(
res
)
{
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({})));
const
data
=
res
;
if
(
!
data
.
client
)
{
data
.
client
=
client
;
...
...
@@ -82,7 +84,7 @@ export const initGlobalConfig = () => {
token
:
''
,
access_token
:
''
,
userInfo
:
null
}
),
},
gateWayConfig
),
),
);
...
...
@@ -132,5 +134,7 @@ export const initGlobalConfig = () => {
console
.
log
(
error
);
store
.
dispatch
(
actionCreators
.
getConfigError
(
error
));
});
});
}
};
\ No newline at end of file
src/layouts/SecurityLayout.js
View file @
83c714e2
...
...
@@ -27,10 +27,7 @@ class SecurityLayout extends React.Component {
// const queryString = stringify({
// redirect: window.location.href,
// });
if
(
_
.
isNull
(
global
.
token
)
||
(
global
.
hasGateWay
&&
_
.
isNull
(
global
.
access_token
))
)
{
if
(
!
Cookies
.
get
(
'token'
))
{
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
let
client
=
global
.
client
||
Cookies
.
get
(
'city'
);
client
=
...
...
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