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

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

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