Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
linweijiong
jinfa-platform
Commits
67e04171
Commit
67e04171
authored
Aug 01, 2022
by
wzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 隐藏单点登录
parent
5ef9c8b6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
15 deletions
+32
-15
app.tsx
src/app.tsx
+26
-9
AvatarDropdown.tsx
src/layouts/components/AvatarDropdown.tsx
+1
-1
auth.ts
src/utils/auth.ts
+1
-1
keycloak-js.ts
src/utils/keycloak-js.ts
+2
-2
request.ts
src/utils/request.ts
+2
-2
No files found.
src/app.tsx
View file @
67e04171
...
...
@@ -8,7 +8,7 @@ import '@/global/styles/global.less'; // 导入全局样式
import
'antd/dist/antd.less'
import
{
isDev
}
from
'@/constants'
import
{
setup
}
from
'@formily/antd-components'
;
import
{
getRouters
,
getAuth
,
asyncRouter
,
setRouters
,
removeAuth
,
setEnableMultiTenancy
,
removeEnableMultiTenancy
}
from
'./utils/auth'
;
import
{
getRouters
,
getAuth
,
asyncRouter
,
setRouters
,
removeAuth
,
setEnableMultiTenancy
,
removeEnableMultiTenancy
,
setAuth
,
removeRouters
}
from
'./utils/auth'
;
// 全局注册虚拟组件
import
'@/components/NiceForm/public'
import
LRU
from
'@/utils/lru'
;
...
...
@@ -95,11 +95,28 @@ export function render(oldRender: Function) {
oldRender
()
return
;
}
keycloakThen
().
then
(()
=>
{
const
isAuth
=
isAuthenticated
()
//
keycloakThen().then(() => {
//
const isAuth = isAuthenticated()
const
authInfo
=
getAuth
()
if
(
!
(
authInfo
&&
isAuth
))
{
setAuthInfo
().
finally
(()
=>
{
if
(
!
(
authInfo
))
{
// if (!(authInfo && isAuth)) {
// setAuthInfo().finally(() => {
// oldRender()
// })
getMemberLoginReget
({},
{
useCache
:
true
,
ttl
:
1000
}).
then
(
res
=>
{
const
{
data
,
code
}
=
res
if
(
code
===
1000
)
{
setAuth
(
data
as
any
)
setRouters
(
data
.
auth
)
}
else
{
removeAuth
()
removeRouters
()
history
.
replace
(
'/user/login'
)
// SpaLogin()
}
oldRender
()
}).
catch
(()
=>
{
oldRender
()
})
getManagePaasSiteEnableMultiTenancy
({
siteId
:
GlobalConfig
.
global
.
siteInfo
.
id
.
toString
()
}).
then
(
res
=>
{
...
...
@@ -109,15 +126,15 @@ export function render(oldRender: Function) {
setEnableMultiTenancy
(
res
.
data
);
})
}
else
{
if
(
!
isAuth
)
{
//
if (!isAuth) {
SpaLogout
()
removeAuth
()
//
removeRouters()
removeRouters
()
removeEnableMultiTenancy
()
}
//
}
oldRender
()
}
})
//
})
// return
}
...
...
src/layouts/components/AvatarDropdown.tsx
View file @
67e04171
...
...
@@ -16,7 +16,7 @@ const AvatarDropdown = (props) => {
const
userAuth
=
getAuth
();
const
logout
=
()
=>
{
removeAuth
()
//
removeRouters()
removeRouters
()
SpaLogout
()
// history.replace('/user/login')
}
...
...
src/utils/auth.ts
View file @
67e04171
...
...
@@ -136,7 +136,7 @@ export const removeAuth = () => {
removeCookie
(
'currentMallLink'
,
{
path
:
'/'
,
domain
:
getTopDomainByHost
(
TOP_DOMAIN_NO_PORT
,
true
)
})
window
.
localStorage
.
removeItem
(
AUTH_KEY
)
removeEnableMultiTenancy
()
//
removeRouters()
removeRouters
()
const
_window
:
any
=
window
_window
?.
ysf
&&
_window
.
ysf
(
'logoff'
)
}
...
...
src/utils/keycloak-js.ts
View file @
67e04171
...
...
@@ -69,6 +69,6 @@ export function SpaLogin() {
}
export
function
SpaLogout
()
{
// console.log(getKeycloak()
)
getKeycloak
().
logout
()
history
.
replace
(
'/user/login'
)
//
getKeycloak().logout()
}
src/utils/request.ts
View file @
67e04171
...
...
@@ -135,8 +135,8 @@ class ApiRequest {
// 登录验证
if
(
res
.
code
===
1101
)
{
removeAuth
()
SpaLogout
()
//
window.location.replace(`/user/login?redirect=${btoa(encodeURIComponent(String(window.location)))}`)
//
SpaLogout()
window
.
location
.
replace
(
`/user/login?redirect=
${
btoa
(
encodeURIComponent
(
String
(
window
.
location
)))}
`
)
message
.
destroy
()
message
.
error
(
res
.
message
)
reject
(
res
)
...
...
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