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
shenshaokai
jinfa-platform
Commits
bf0f5614
Commit
bf0f5614
authored
Apr 14, 2022
by
Gavin Peng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 暂时关闭按钮权限控制
parent
7e7110ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
35 deletions
+35
-35
AuthUrl.ts
src/components/AuthButton/AuthUrl.ts
+18
-18
index.tsx
src/components/AuthButton/index.tsx
+17
-17
No files found.
src/components/AuthButton/AuthUrl.ts
View file @
bf0f5614
...
...
@@ -5,23 +5,23 @@ export const AuthUrl = (btnCode: string) => {
const
{
pathname
}
=
new
URL
(
window
.
location
.
href
);
const
RoutesAuth
=
auth
.
filter
((
item
:
any
)
=>
item
?.
u
===
pathname
)
// 默认 让所以按钮权限 打开
//
return true;
return
true
;
// 先把全部按钮打开
if
(
btnCode
===
'DevTest'
)
return
true
// 本地开发时传的特殊标识,直接开放权限
if
(
RoutesAuth
.
length
>
0
)
{
const
{
b
}
=
RoutesAuth
[
0
];
// 本地开发时传的特殊标识,直接开放权限
for
(
let
i
=
0
;
i
<
b
.
length
;
i
++
)
{
if
(
btnCode
)
{
// 是否有页面标识
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
if
(
b
[
i
]
===
btnCode
)
{
return
true
}
}
continue
}
return
false
}
//
if (btnCode === 'DevTest') return true
//
//
本地开发时传的特殊标识,直接开放权限
//
if (RoutesAuth.length > 0) {
//
const { b } = RoutesAuth[0];
//
// 本地开发时传的特殊标识,直接开放权限
//
for (let i = 0; i < b.length; i++) {
//
if (btnCode) {
//
// 是否有页面标识
//
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
//
if (b[i] === btnCode) {
//
return true
//
}
//
}
//
continue
//
}
//
return false
//
}
}
src/components/AuthButton/index.tsx
View file @
bf0f5614
...
...
@@ -25,24 +25,24 @@ const AuthButton = (props: AuthButtonProps) => {
const
RoutesAuth
=
auth
.
filter
((
item
:
any
)
=>
item
?.
u
===
pathname
)
const
_authorityBtn
=
()
=>
{
// 本地开发时传的特殊标识,直接开放权限
// return true;
return
true
// 全部按钮打开
if
(
btnCode
===
'DevTest'
)
return
true
if
(
RoutesAuth
.
length
>
0
)
{
const
{
b
}
=
RoutesAuth
[
0
];
console
.
log
(
RoutesAuth
.
length
,
RoutesAuth
)
for
(
let
i
=
0
;
i
<
b
.
length
;
i
++
)
{
if
(
btnCode
)
{
// 是否有页面标识
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
if
(
b
[
i
]
===
btnCode
)
{
return
true
}
}
continue
}
return
false
}
//
if (btnCode === 'DevTest') return true
//
if (RoutesAuth.length > 0) {
//
const { b } = RoutesAuth[0];
//
console.log(RoutesAuth.length, RoutesAuth)
//
for (let i = 0; i < b.length; i++) {
//
if (btnCode) {
//
// 是否有页面标识
//
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
//
if (b[i] === btnCode) {
//
return true
//
}
//
}
//
continue
//
}
//
return false
//
}
}
return
_authorityBtn
()
?
children
:
null
}
...
...
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