提交 28cbe86e authored 作者: 钟是志's avatar 钟是志

34117 【岑巩县】学生综合服务系统-学生信息管理-学生信息查询,辅导员学生信息查询功能与需求不一致,看是否修改,账号13253673932

上级 68cf11ca
......@@ -2,32 +2,34 @@ import React, { useMemo } from 'react';
import { isJSON } from '@/webPublic/one_stop_public/copy';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
export function checkAuth(authority) {
let allAuth = localStorage.getItem('antd-pro-authority');
allAuth = isJSON(allAuth) ? JSON.parse(allAuth) : null;
if (!allAuth) {
return false;
}
const path = localStorage.getItem('parentRoutePath');
const checkPath = path + authority;
console.log('auth', checkPath);
let findX = allAuth.find((g) => g === checkPath);
return !!findX;
}
export default function Authorized(props) {
const {
authority, // /add
children
} = props;
const check = useMemo(() => {
let allAuth = localStorage.getItem('antd-pro-authority');
allAuth = isJSON(allAuth) ? JSON.parse(allAuth) : null;
if(!allAuth){
return false;
}
const path = localStorage.getItem('parentRoutePath');
const checkPath = path + authority;
// console.log('检查权限:', checkPath);
let findX = allAuth.find((g) => g === checkPath);
return !!findX;
}, [authority]);
if (!check) {
return null;
}
return children;
const {
authority, // /add
children,
} = props;
const check = useMemo(
() => {
return checkAuth(authority);
},
[authority],
);
if (!check) {
return null;
}
return children;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论