From 573193bb8ba686b06b5132cd233f953cc06d310d Mon Sep 17 00:00:00 2001 From: 落日与鲸 <10806022+gong-jinbao@user.noreply.gitee.com> Date: 星期五, 28 二月 2025 18:41:19 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/H5/threeSide --- 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