Commit e2316c0e authored by 前端-彭佳文's avatar 前端-彭佳文

Merge branch 'v2-0418-xxx' into 'v2-220418'

按钮权限全部打开 See merge request linkseeks-design/pro-platform!147
parents 0811aeab 382b35d2
...@@ -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
// }
} }
...@@ -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
} }
......
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