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
e2316c0e
Commit
e2316c0e
authored
Apr 07, 2022
by
前端-彭佳文
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-0418-xxx' into 'v2-220418'
按钮权限全部打开 See merge request linkseeks-design/pro-platform!147
parents
0811aeab
382b35d2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
38 deletions
+40
-38
AuthUrl.ts
src/components/AuthButton/AuthUrl.ts
+22
-21
index.tsx
src/components/AuthButton/index.tsx
+18
-17
No files found.
src/components/AuthButton/AuthUrl.ts
View file @
e2316c0e
...
@@ -2,25 +2,26 @@
...
@@ -2,25 +2,26 @@
import
{
getAuth
}
from
"@/utils/auth"
;
import
{
getAuth
}
from
"@/utils/auth"
;
export
const
AuthUrl
=
(
btnCode
:
string
)
=>
{
export
const
AuthUrl
=
(
btnCode
:
string
)
=>
{
const
{
auth
}
=
getAuth
()
const
{
auth
}
=
getAuth
()
const
{
pathname
}
=
new
URL
(
window
.
location
.
href
);
// const { pathname } = new URL(window.location.href);
const
RoutesAuth
=
auth
.
filter
((
item
:
any
)
=>
item
?.
u
===
pathname
)
// const RoutesAuth = auth.filter((item: any) => item?.u === pathname)
// 默认 让所以按钮权限 打开
// console.log(AuthCode, 'AuthCode')
return
true
;
if
(
btnCode
===
'DevTest'
)
return
true
// 先把全部按钮打开
// 本地开发时传的特殊标识,直接开放权限
// if (btnCode === 'DevTest') return true
if
(
RoutesAuth
.
length
>
0
)
{
// // 本地开发时传的特殊标识,直接开放权限
const
{
b
}
=
RoutesAuth
[
0
];
// if (RoutesAuth.length > 0) {
// 本地开发时传的特殊标识,直接开放权限
// const { b } = RoutesAuth[0];
for
(
let
i
=
0
;
i
<
b
.
length
;
i
++
)
{
// // 本地开发时传的特殊标识,直接开放权限
if
(
btnCode
)
{
// for (let i = 0; i < b.length; i++) {
// 是否有页面标识
// if (btnCode) {
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
// // 是否有页面标识
if
(
b
[
i
]
===
btnCode
)
{
// // 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
return
true
// if (b[i] === btnCode) {
}
// return true
}
// }
continue
// }
}
// continue
return
false
// }
}
// return false
// }
}
}
src/components/AuthButton/index.tsx
View file @
e2316c0e
...
@@ -25,23 +25,24 @@ const AuthButton = (props: AuthButtonProps) => {
...
@@ -25,23 +25,24 @@ const AuthButton = (props: AuthButtonProps) => {
const
RoutesAuth
=
auth
.
filter
((
item
:
any
)
=>
item
?.
u
===
pathname
)
const
RoutesAuth
=
auth
.
filter
((
item
:
any
)
=>
item
?.
u
===
pathname
)
const
_authorityBtn
=
()
=>
{
const
_authorityBtn
=
()
=>
{
// 本地开发时传的特殊标识,直接开放权限
// 本地开发时传的特殊标识,直接开放权限
if
(
btnCode
===
'DevTest'
)
return
true
return
true
;
if
(
RoutesAuth
.
length
>
0
)
{
// 全部按钮打开
// if (btnCode === 'DevTest') return true
const
{
b
}
=
RoutesAuth
[
0
];
// if (RoutesAuth.length > 0) {
console
.
log
(
RoutesAuth
.
length
,
RoutesAuth
)
// const { b } = RoutesAuth[0];
for
(
let
i
=
0
;
i
<
b
.
length
;
i
++
)
{
// console.log(RoutesAuth.length, RoutesAuth)
if
(
btnCode
)
{
// for (let i = 0; i < b.length; i++) {
// 是否有页面标识
// if (btnCode) {
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
// // 是否有页面标识
if
(
b
[
i
]
===
btnCode
)
{
// // 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
return
true
// if (b[i] === btnCode) {
}
// return true
}
// }
continue
// }
}
// continue
return
false
// }
}
// return false
// }
}
}
return
_authorityBtn
()
?
children
:
null
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