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
feecce34
Commit
feecce34
authored
Nov 28, 2022
by
杨思琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复client
parent
df7457e1
Pipeline
#64571
passed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
20 deletions
+31
-20
login.js
src/pages/user/login/login.js
+28
-19
render.js
src/render.js
+3
-1
No files found.
src/pages/user/login/login.js
View file @
feecce34
...
...
@@ -98,25 +98,30 @@ class Login {
site
:
this
.
getLocalSiteBytoken
(
token
),
'request.preventCache'
:
Date
.
now
(),
ignoreSite
:
true
,
}).
then
(
response
=>
{
if
(
response
&&
response
.
code
===
0
)
{
self
.
globalConfig
.
userInfo
=
window
?.
globalConfig
?.
transformUserInfo
?.(
response
.
data
)
??
{};
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
getUserInfoAndConfig
();
}
else
{
self
.
logout
&&
self
.
logout
();
if
(
params
.
getParams
(
'token'
))
{
// token免登录失败,回到登录页,防止reload造成死循环
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
`
;
return
false
;
}
if
(
self
.
globalConfig
.
style
===
'ios'
&&
self
.
globalConfig
.
loginTemplate
===
'IOSCloud.html'
)
{
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
`
;
return
false
;
})
.
then
(
response
=>
{
if
(
response
&&
response
.
code
===
0
)
{
self
.
globalConfig
.
userInfo
=
window
?.
globalConfig
?.
transformUserInfo
?.(
response
.
data
)
??
{};
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
getUserInfoAndConfig
();
}
else
{
self
.
logout
&&
self
.
logout
();
if
(
params
.
getParams
(
'token'
))
{
// token免登录失败,回到登录页,防止reload造成死循环
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
`
;
return
false
;
}
if
(
self
.
globalConfig
.
style
===
'ios'
&&
self
.
globalConfig
.
loginTemplate
===
'IOSCloud.html'
)
{
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
`
;
return
false
;
}
window
.
location
.
reload
();
}
window
.
location
.
reload
();
}
});
})
.
catch
(
error
=>
{
this
.
handleLoginError
();
Logger
.
log
(
'获取用户配置失败'
);
});
}
writeLogs
()
{
...
...
@@ -182,7 +187,6 @@ class Login {
getWebConfig
(
token
,
getIndustry
)
{
const
self
=
this
;
// eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
Promise
.
all
([
noticeService
.
getMqttSiteCode
({
'request.preventCache'
:
Date
.
now
()
}),
...
...
@@ -701,11 +705,16 @@ class Login {
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
}
catch
(
error
)
{
console
.
log
(
error
);
message
.
error
(
'登录失败'
);
if
(
self
.
goLogin
())
{
return
false
;
}
// self.handleLoginError(failCallback);
}
})
.
catch
(
error
=>
{
this
.
handleLoginError
();
Logger
.
log
(
'获取用户配置失败'
);
});
}
else
{
self
.
handleLoginError
();
...
...
src/render.js
View file @
feecce34
...
...
@@ -60,7 +60,9 @@ export const AppInitState = () => {
};
const
client
=
getClient
();
if
(
sessionStorage
.
getItem
(
'client'
)
&&
sessionStorage
.
getItem
(
'client'
)
!==
client
)
{
sessionStorage
.
setItem
(
'client'
,
client
);
}
let
config
=
window
.
globalConfig
||
{};
// eslint-disable-next-line no-undef, no-restricted-globals
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
);
...
...
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