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
292a96ce
Commit
292a96ce
authored
Jun 21, 2023
by
杨思琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 云模式首次登录取网关配置
parent
1c79d81f
Pipeline
#74746
passed with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
login.js
src/pages/user/login/login.js
+31
-1
No files found.
src/pages/user/login/login.js
View file @
292a96ce
...
...
@@ -292,6 +292,9 @@ class Login {
const
self
=
this
;
// eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
const
gateWayParam
=
{
_site
:
this
?.
globalConfig
?.
userInfo
?.
site
??
''
,
};
Promise
.
allSettled
([
noticeService
.
getMqttSiteCode
({
'request.preventCache'
:
Date
.
now
()
}),
getWebSiteConfig
({
...
...
@@ -299,6 +302,7 @@ class Login {
token
,
'request.preventCache'
:
Date
.
now
(),
}),
appService
.
getWateWayConfig
(
gateWayParam
),
])
.
then
(
results
=>
{
const
promise
=
results
[
0
];
...
...
@@ -363,8 +367,14 @@ class Login {
?
response
.
data
:
[]
:
response
;
const
gatewayRes
=
results
[
2
]?.
value
??
{};
// 重置网关配置
// eslint-disable-next-line prettier/prettier, no-undef
const
hasGateWay
=
!
gatewayRes
||
!
gatewayRes
.
data
?
false
:
_
.
isString
(
gatewayRes
.
data
)
?
JSON
.
parse
(
gatewayRes
.
data
)
:
(
typeof
gatewayRes
.
data
===
'boolean'
?
gatewayRes
.
data
:
false
);
if
(
result
&&
result
.
length
>
0
)
{
const
config
=
result
.
shift
();
config
.
hasGateWay
=
hasGateWay
;
config
.
apiGatewayDomain
=
`
${
window
.
location
.
origin
}${
hasGateWay
?
'/PandaCore/GateWay'
:
''
}
`
;
const
homeType
=
config
.
productType
||
'civweb4'
;
// 产品类型和首页路径同时有才行
// eslint-disable-next-line prettier/prettier
...
...
@@ -382,7 +392,27 @@ class Login {
products
:
self
.
globalConfig
.
products
,
// mapsettings: config.mapsettings
});
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
if
(
hasGateWay
)
{
appService
.
authorizationToken
({
loginName
:
self
.
globalConfig
.
userInfo
?.
loginName
||
''
,
type
:
'WorkNo'
,
})
.
then
(
tokenRes
=>
{
if
(
tokenRes
.
code
===
0
)
{
self
.
globalConfig
.
access_token
=
tokenRes
.
data
?.
access_token
??
''
;
localStorage
.
setItem
(
'access_token'
,
self
.
globalConfig
.
access_token
);
}
self
.
updateConfig
(
self
.
globalConfig
);
})
.
catch
(
err
=>
{
self
.
updateConfig
(
self
.
globalConfig
);
});
}
else
{
self
.
globalConfig
.
access_token
=
null
;
localStorage
.
setItem
(
'access_token'
,
self
.
globalConfig
.
access_token
);
self
.
updateConfig
(
self
.
globalConfig
);
}
self
.
getProjectItems
().
then
(
res
=>
{
window
.
subSysCfg
=
{};
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
{
...
...
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