From 40f9b52ab3497cb2a7c643d9175c9d65b50f8c16 Mon Sep 17 00:00:00 2001 From: hejianhao <15708179461@qq.com> Date: 星期五, 28 二月 2025 17:01:46 +0800 Subject: [PATCH] 删除方法 --- management/src/utils/utils.js | 30 ------------------------------ 1 files changed, 0 insertions(+), 30 deletions(-) diff --git a/management/src/utils/utils.js b/management/src/utils/utils.js index 6de0872..20213a5 100644 --- a/management/src/utils/utils.js +++ b/management/src/utils/utils.js @@ -1,5 +1,4 @@ // import { getToken } from '@/utils/authority'; -import pathRegexp from 'path-to-regexp'; import { parse } from 'querystring'; import { uploadFile } from './service' /* eslint no-useless-escape:0 import/prefer-default-export:0 */ @@ -120,32 +119,3 @@ }) .catch(error => console.error('Error downloading file:', error)); } -export const getAuthorityFromRouter = (router = [], pathname) => { - const authority = router.find( - ({ routes, path = '/' }) => - (path && pathRegexp(path).exec(pathname)) || - (routes && getAuthorityFromRouter(routes, pathname)), - ); - if (authority) return authority; - return undefined; -}; -export const getRouteAuthority = (path, routeData) => { - let authorities; - routeData.forEach((route) => { - // match prefix - if (pathRegexp(`${route.path}/(.*)`).test(`${path}/`)) { - if (route.authority) { - authorities = route.authority; - } // exact match - - if (route.path === path) { - authorities = route.authority || authorities; - } // get children authority recursively - - if (route.routes) { - authorities = getRouteAuthority(path, route.routes) || authorities; - } - } - }); - return authorities; -}; -- Gitblit v1.7.1