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
e013e05f
Commit
e013e05f
authored
Apr 22, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 兼容网关服务失败
parent
e7a52fa6
Pipeline
#48421
passed with stages
in 2 minutes 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
68 deletions
+75
-68
initConfig.js
src/initConfig.js
+75
-68
No files found.
src/initConfig.js
View file @
e013e05f
...
...
@@ -49,6 +49,77 @@ export const initGlobalConfig = () => {
// }
let
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
);
client
=
client
&&
client
!==
'undefined'
?
client
:
'city'
;
const
queryConfig
=
(
gateWayConfig
=
{})
=>
{
appService
.
queryConfig
({
client
:
client
||
'city'
,
ignoreSite
:
true
,
})
.
then
(
res
=>
{
if
(
res
)
{
const
data
=
res
;
if
(
!
data
.
client
)
{
data
.
client
=
client
;
}
// Cookies.set('city', data.client);
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
(
{},
data
,
{
token
:
''
,
access_token
:
''
,
userInfo
:
null
,
},
gateWayConfig
,
),
),
);
// Cookies.set('city', params.getParams('client'))
if
(
data
.
loginTemplate
===
'新春 - 智联.html'
)
{
updateTheme
(
'#ff9600'
);
}
// eslint-disable-next-line no-new
if
(
getToken
())
{
// eslint-disable-next-line no-new
new
Login
(
{
global
:
Object
.
assign
({},
data
,
{
token
:
getToken
(),
},
gateWayConfig
,
),
// eslint-disable-next-line no-shadow
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
isInit
:
false
,
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
()),
},
()
=>
{
(
async
()
=>
{
(
await
(
getToken
()
&&
window
.
globalConfig
&&
window
.
globalConfig
.
token
))
&&
initMicroApps
(
loader
,
store
);
})();
},
true
,
);
}
}
return
res
;
})
.
then
(
res
=>
{
render
({
appContent
:
''
,
loading
:
true
});
})
.
catch
(
error
=>
{
store
.
dispatch
(
actionCreators
.
getConfigError
(
error
));
});
}
appService
.
getWateWayConfig
({
ignoreSite
:
true
,
...
...
@@ -62,73 +133,9 @@ export const initGlobalConfig = () => {
};
})
.
then
(
gateWayConfig
=>
{
appService
.
queryConfig
({
client
:
client
||
'city'
,
ignoreSite
:
true
,
})
.
then
(
res
=>
{
if
(
res
)
{
const
data
=
res
;
if
(
!
data
.
client
)
{
data
.
client
=
client
;
}
// Cookies.set('city', data.client);
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
(
{},
data
,
{
token
:
''
,
access_token
:
''
,
userInfo
:
null
,
},
gateWayConfig
,
),
),
);
// Cookies.set('city', params.getParams('client'))
if
(
data
.
loginTemplate
===
'新春 - 智联.html'
)
{
updateTheme
(
'#ff9600'
);
}
// eslint-disable-next-line no-new
if
(
getToken
())
{
// eslint-disable-next-line no-new
new
Login
(
{
global
:
Object
.
assign
({},
data
,
{
token
:
getToken
(),
},
gateWayConfig
,
),
// eslint-disable-next-line no-shadow
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
isInit
:
false
,
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
()),
},
()
=>
{
(
async
()
=>
{
(
await
(
getToken
()
&&
window
.
globalConfig
&&
window
.
globalConfig
.
token
))
&&
initMicroApps
(
loader
,
store
);
})();
},
true
,
);
}
}
return
res
;
})
.
then
(
res
=>
{
render
({
appContent
:
''
,
loading
:
true
});
})
.
catch
(
error
=>
{
store
.
dispatch
(
actionCreators
.
getConfigError
(
error
));
});
queryConfig
(
gateWayConfig
);
})
.
catch
(
err
=>
{
queryConfig
();
});
};
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