提交 7938e0fe authored 作者: 钟是志's avatar 钟是志

33896 云贵综合学生信息管理,学生信息查询、学生管理的按钮权限串了klsdyzzAdmin01

上级 16681aee
import React, { useMemo } from 'react'; 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';
export default function Authorized(props) { export default function Authorized(props) {
...@@ -8,16 +9,14 @@ export default function Authorized(props) { ...@@ -8,16 +9,14 @@ export default function Authorized(props) {
children children
} = props; } = props;
const check = useMemo(() => { const check = useMemo(() => {
let parentIframeRouteInfo = localStorage.getItem('parentRouteInfo'); // 获取父节点路由信息
parentIframeRouteInfo = isJSON(parentIframeRouteInfo) ? JSON.parse(parentIframeRouteInfo) : null;
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(!parentIframeRouteInfo || !allAuth){ if(!allAuth){
return false; return false;
} }
const { path } = parentIframeRouteInfo; const { path } = getUrlInfo();
const checkPath = path + authority; const checkPath = path + authority;
console.log('检查权限:', checkPath); console.log('检查权限:', checkPath);
let findX = allAuth.find((g) => g === checkPath); let findX = allAuth.find((g) => g === checkPath);
......
...@@ -17,13 +17,13 @@ window.addEventListener('message', (event) => { ...@@ -17,13 +17,13 @@ window.addEventListener('message', (event) => {
dom[0].style.top = height + 'px'; dom[0].style.top = height + 'px';
} }
} }
if (event.data.indexOf('parentRouteInfo') > -1) { // if (event.data.indexOf('parentRouteInfo') > -1) {
const info = event.data.split('-')[1]; // const info = event.data.split('-')[1];
// console.log('父页面告知子页面路由信息: ', info); // // console.log('父页面告知子页面路由信息: ', info);
if (info && isJSON(info)) { // if (info && isJSON(info)) {
localStorage.setItem('parentRouteInfo', info); // localStorage.setItem('parentRouteInfo', info);
} // }
} // }
if (event.data.indexOf('setAuthorityLocalStorage') > -1) { if (event.data.indexOf('setAuthorityLocalStorage') > -1) {
const info = event.data.split('-'); const info = event.data.split('-');
// console.log('父页面告知子页面localStorage信息: antd-pro-authority'); // console.log('父页面告知子页面localStorage信息: antd-pro-authority');
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论