mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
build(projects): update tsconfig、eslintrc
This commit is contained in:
@ -13,7 +13,7 @@ export function createRouterGuard(router: Router) {
|
||||
// 页面跳转权限处理
|
||||
await createPermissionGuard(to, from, next, router);
|
||||
});
|
||||
router.afterEach(to => {
|
||||
router.afterEach((to) => {
|
||||
// 设置document title
|
||||
useTitle(to.meta.title);
|
||||
// 结束 loadingBar
|
||||
|
@ -34,14 +34,14 @@ export async function createPermissionGuard(
|
||||
isLogin && to.name === routeName('login'),
|
||||
() => {
|
||||
next({ name: routeName('root') });
|
||||
}
|
||||
},
|
||||
],
|
||||
// 不需要登录权限的页面直接通行
|
||||
[
|
||||
!needLogin,
|
||||
() => {
|
||||
next();
|
||||
}
|
||||
},
|
||||
],
|
||||
// 未登录状态进入需要登录权限的页面
|
||||
[
|
||||
@ -49,22 +49,22 @@ export async function createPermissionGuard(
|
||||
() => {
|
||||
const redirect = to.fullPath;
|
||||
next({ name: routeName('login'), query: { redirect } });
|
||||
}
|
||||
},
|
||||
],
|
||||
// 登录状态进入需要登录权限的页面,有权限直接通行
|
||||
[
|
||||
isLogin && needLogin && hasPermission,
|
||||
() => {
|
||||
next();
|
||||
}
|
||||
},
|
||||
],
|
||||
[
|
||||
// 登录状态进入需要登录权限的页面,无权限,重定向到无权限页面
|
||||
isLogin && needLogin && !hasPermission,
|
||||
() => {
|
||||
next({ name: routeName('no-permission') });
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
exeStrategyActions(actions);
|
||||
|
@ -2,20 +2,20 @@ import type { RouterScrollBehavior } from 'vue-router';
|
||||
import { useTabStore } from '@/store';
|
||||
|
||||
export const scrollBehavior: RouterScrollBehavior = (to, from) => {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
const tab = useTabStore();
|
||||
|
||||
if (to.hash) {
|
||||
resolve({
|
||||
el: to.hash,
|
||||
behavior: 'smooth'
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
|
||||
const { left, top } = tab.getTabScrollPosition(to.path);
|
||||
const scrollPosition = {
|
||||
left,
|
||||
top
|
||||
top,
|
||||
};
|
||||
const { scrollLeft, scrollTop } = document.documentElement;
|
||||
|
||||
|
@ -11,7 +11,7 @@ const history = VITE_HASH_ROUTE === 'true' ? createWebHashHistory(VITE_BASE_URL)
|
||||
export const router = createRouter({
|
||||
history,
|
||||
routes: transformAuthRoutesToVueRoutes(constantRoutes),
|
||||
scrollBehavior
|
||||
scrollBehavior,
|
||||
});
|
||||
|
||||
export async function setupRouter(app: App) {
|
||||
|
@ -8,24 +8,24 @@ export const constantRoutes: AuthRoute.Route[] = [
|
||||
path: '/',
|
||||
redirect: '/dashboard/analysis',
|
||||
meta: {
|
||||
title: 'Root'
|
||||
}
|
||||
title: 'Root',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'login',
|
||||
path: '/login',
|
||||
component: 'self',
|
||||
props: route => {
|
||||
props: (route) => {
|
||||
const moduleType = (route.params.module as LoginModuleKey) || 'pwd-login';
|
||||
return {
|
||||
module: moduleType
|
||||
module: moduleType,
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
title: '登录',
|
||||
dynamicPath: `/login/:module(${getLoginModuleRegExp()})?`,
|
||||
singleLayout: 'blank'
|
||||
}
|
||||
singleLayout: 'blank',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'no-permission',
|
||||
@ -33,8 +33,8 @@ export const constantRoutes: AuthRoute.Route[] = [
|
||||
component: 'self',
|
||||
meta: {
|
||||
title: '无权限',
|
||||
singleLayout: 'blank'
|
||||
}
|
||||
singleLayout: 'blank',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'not-found',
|
||||
@ -42,8 +42,8 @@ export const constantRoutes: AuthRoute.Route[] = [
|
||||
component: 'self',
|
||||
meta: {
|
||||
title: '未找到',
|
||||
singleLayout: 'blank'
|
||||
}
|
||||
singleLayout: 'blank',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'service-error',
|
||||
@ -51,8 +51,8 @@ export const constantRoutes: AuthRoute.Route[] = [
|
||||
component: 'self',
|
||||
meta: {
|
||||
title: '服务器错误',
|
||||
singleLayout: 'blank'
|
||||
}
|
||||
singleLayout: 'blank',
|
||||
},
|
||||
},
|
||||
// 匹配无效路径的路由
|
||||
{
|
||||
@ -61,9 +61,9 @@ export const constantRoutes: AuthRoute.Route[] = [
|
||||
component: 'blank',
|
||||
meta: {
|
||||
title: '未找到',
|
||||
singleLayout: 'blank'
|
||||
}
|
||||
}
|
||||
singleLayout: 'blank',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/** 路由名称 */
|
||||
|
Reference in New Issue
Block a user