Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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
shenshaokai
jinfa-admin
Commits
2129f1a9
Commit
2129f1a9
authored
Jun 11, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改socket
parent
2e048a87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
app.tsx
src/app.tsx
+13
-1
RightContent.tsx
src/layouts/RightContent.tsx
+1
-1
No files found.
src/app.tsx
View file @
2129f1a9
...
...
@@ -23,6 +23,11 @@ let extraRoutes: never[] = [];
const
userLoginLists
=
[
'/login'
,
]
// 登录后的路由白名单
const
loginWhiteList
=
[
'/home'
,
]
const
whiteLists
=
[
'/'
,
...
userLoginLists
,
...
...
@@ -99,9 +104,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
return
}
const
authInfo
=
getAuth
()
// 是否登录
if
(
getAuth
()
)
{
if
(
authInfo
)
{
const
{
query
,
pathname
}
=
location
console
.
log
(
pathname
);
const
routeAuthUrls
=
getRouters
()
if
(
userLoginLists
.
includes
(
pathname
))
{
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
...
...
@@ -109,6 +116,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
return
;
}
// 登录之后 能力中心的首页应该变为可以访问, 无论是否在权限中
if
(
loginWhiteList
.
includes
(
location
.
pathname
))
{
return
}
// 固定配置, 出现此参数说明需携带参数校验权限路由
if
(
query
.
page_type
&&
routeAuthUrls
.
find
(
authPath
=>
{
const
parseUrl
=
queryString
.
parseUrl
(
authPath
)
...
...
src/layouts/RightContent.tsx
View file @
2129f1a9
...
...
@@ -70,7 +70,7 @@ const RightContent: React.FC<{}> = (props) => {
const
webSocketInit
=
useCallback
(()
=>
{
console
.
log
(
ws
.
current
)
if
(
SOCKET_URL
&&
/ws
\:\/\/
/
.
test
(
SOCKET_URL
)
&&
(
!
ws
.
current
||
ws
.
current
.
readyState
===
3
)
&&
userInfo
)
{
const
url
=
`
${
SOCKET_URL
}
/report/websocket?memberId=
${
userInfo
.
memberId
}
&roleId=
${
userInfo
.
memberId
}
&token=
${
userInfo
.
token
}
&source=
${
99
}
`
const
url
=
`
${
SOCKET_URL
}
/report/websocket?memberId=
${
userInfo
.
memberId
}
&roleId=
${
userInfo
.
member
Role
Id
}
&token=
${
userInfo
.
token
}
&source=
${
99
}
`
ws
.
current
=
new
WebSocket
(
url
);
ws
.
current
.
onopen
=
(
e
)
=>
{
console
.
log
(
e
)
...
...
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