Commit 382b35d2 authored by xiexiuxing's avatar xiexiuxing

按钮权限全部打开

parent 0811aeab
......@@ -2,25 +2,26 @@
import { getAuth } from "@/utils/auth";
export const AuthUrl = (btnCode: string) => {
const { auth } = getAuth()
const { pathname } = new URL(window.location.href);
const RoutesAuth = auth.filter((item: any) => item?.u === pathname)
// console.log(AuthCode, 'AuthCode')
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
}
// const { pathname } = new URL(window.location.href);
// const RoutesAuth = auth.filter((item: any) => item?.u === pathname)
// 默认 让所以按钮权限 打开
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
// }
}
......@@ -25,23 +25,24 @@ const AuthButton = (props: AuthButtonProps) => {
const RoutesAuth = auth.filter((item: any) => item?.u === pathname)
const _authorityBtn = () => {
// 本地开发时传的特殊标识,直接开放权限
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 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
// }
}
return _authorityBtn() ? children : null
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment