mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
fix: 完善路由文件命名提示 & 保证403和404路由一直有权限 (#186)
* fix: 完善提示 * refactor: 切换路由都判断下403和404保证他们有权限
This commit is contained in:
parent
a670c5e10e
commit
29f925b644
@ -7,11 +7,15 @@ if (!accessApi) {
|
||||
throw new Error('[plugin-layout]: plugin-layout depends on plugin-access,please install plugin-access first!');
|
||||
}
|
||||
|
||||
const accessIds = accessApi.getAccess();
|
||||
accessApi.setAccess(accessIds.concat(['/403', '/404']));
|
||||
|
||||
export const access = (memo) => {
|
||||
const runtimeConfig = getConfig();
|
||||
const accessIds = accessApi.getAccess();
|
||||
if (!accessIds.includes('/403')) {
|
||||
accessApi.setAccess(accessIds.concat('/403'));
|
||||
}
|
||||
if (!accessIds.includes('/404')) {
|
||||
accessApi.setAccess(accessIds.concat('/404'));
|
||||
}
|
||||
return {
|
||||
unAccessHandler({ router, to, from, next }) {
|
||||
if (runtimeConfig.unAccessHandler && typeof runtimeConfig.unAccessHandler === 'function') {
|
||||
|
@ -55,12 +55,12 @@ const getRoutePath = function (parentRoutePath, fileName, isFile = true) {
|
||||
}
|
||||
// /@id.vue -> /:id
|
||||
if (fileName.startsWith('@')) {
|
||||
logger.warn(`[WARNING]: ${fileName} is deprecated, please use [slug]`);
|
||||
logger.warn(`[WARNING]: filename or directory ${fileName} is deprecated, please use [${fileName.replace(/@/, '')}]`);
|
||||
fileName = fileName.replace(/@/, ':');
|
||||
}
|
||||
// /*.vue -> :pathMatch(.*)
|
||||
if (fileName.includes('*')) {
|
||||
logger.warn(`[WARNING]: ${fileName} is deprecated, please use [...slug]`);
|
||||
logger.warn(`[WARNING]: filename or directory ${fileName} is deprecated, please use ${fileName.replace('*', '[...]')}`);
|
||||
fileName = fileName.replace('*', ':pathMatch(.*)');
|
||||
}
|
||||
// /[slug].vue -> /:slug
|
||||
|
Loading…
x
Reference in New Issue
Block a user