mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 登录模块由query变更为动态路由params
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import type { RouteLocationNormalized, NavigationGuardNext } from 'vue-router';
|
||||
import { router, routeName } from '@/router';
|
||||
import { getToken, getLoginRedirectUrl } from '@/utils';
|
||||
import { routeName } from '@/router';
|
||||
import { getToken } from '@/utils';
|
||||
|
||||
type RouterAction = [boolean, () => void];
|
||||
|
||||
@ -33,8 +33,8 @@ export function handlePagePermission(
|
||||
[
|
||||
!isLogin && needLogin,
|
||||
() => {
|
||||
const redirectUrl = getLoginRedirectUrl(router);
|
||||
next({ name: routeName('login'), query: { redirectUrl } });
|
||||
const redirect = to.fullPath;
|
||||
next({ name: routeName('login'), query: { redirect } });
|
||||
}
|
||||
],
|
||||
// 登录状态进入需要登录权限的页面,直接通行
|
||||
|
@ -2,6 +2,7 @@ import type { RouteRecordRaw } from 'vue-router';
|
||||
import { BlankLayout } from '@/layouts';
|
||||
import type { LoginModuleType } from '@/interface';
|
||||
import { Login, NoPermission, NotFound, ServiceError } from '@/views';
|
||||
import { getLoginModuleRegExp } from '@/utils';
|
||||
import { routeName, routePath, routeTitle } from '../constant';
|
||||
import { ROUTE_HOME_NAME } from './route-home';
|
||||
|
||||
@ -29,10 +30,10 @@ const constantRoutes: RouteRecordRaw[] = [
|
||||
// 登录
|
||||
{
|
||||
name: routeName('login'),
|
||||
path: routePath('login'),
|
||||
path: `${routePath('login')}/:module(${getLoginModuleRegExp()})?`,
|
||||
component: Login,
|
||||
props: route => {
|
||||
const moduleType: LoginModuleType = (route.query?.module as LoginModuleType) || 'pwd-login';
|
||||
const moduleType = (route.params.module as LoginModuleType) || 'pwd-login';
|
||||
return {
|
||||
module: moduleType
|
||||
};
|
||||
|
Reference in New Issue
Block a user