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
黄庭坚
jinfa-platform
Commits
a01277af
Commit
a01277af
authored
Nov 02, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:去掉无用权限判断
parent
0d5fced6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
app.tsx
src/app.tsx
+15
-12
No files found.
src/app.tsx
View file @
a01277af
...
...
@@ -170,28 +170,31 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
if
(
getAuth
())
{
const
routeAuthUrls
=
getRouters
()
const
{
query
,
pathname
}
=
location
const
{
pathname
}
=
location
if
(
userLoginLists
.
includes
(
pathname
))
{
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
history
.
replace
(
'/memberCenter/home'
)
return
;
}
// 固定配置, 出现此参数说明需携带参数校验权限路由
if
(
query
.
page_type
&&
routeAuthUrls
.
find
(
authPath
=>
{
const
parseUrl
=
queryString
.
parseUrl
(
authPath
)
const
{
query
:
selfQuery
,
url
}
=
parseUrl
// 当页面出现参数page_type时, 需进入深度校验, 即对应的参数和路径匹配
return
url
===
pathname
&&
selfQuery
.
page_type
===
query
.
page_type
}))
{
// 深度匹配成功, 可正常访问
return
;
}
// 去掉page_type参数校验, 无需根据query参数判断权限
// // 固定配置, 出现此参数说明需携带参数校验权限路由
// if (query.page_type && routeAuthUrls.find(authPath => {
// const parseUrl = queryString.parseUrl(authPath)
// const { query: selfQuery, url } = parseUrl
// // 当页面出现参数page_type时, 需进入深度校验, 即对应的参数和路径匹配
// return url === pathname && selfQuery.page_type === query.page_type
// })) {
// // 深度匹配成功, 可正常访问
// return;
// }
// 是否在路由权限列表里
if
(
routeAuthUrls
.
includes
(
pathname
))
{
return
;
}
// 无权限访问时
console
.
log
(
pathname
)
history
.
replace
(
'/memberCenter/noAuth'
)
}
else
{
if
(
whiteLists
.
includes
(
location
.
pathname
))
{
...
...
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