67 lines
2.6 KiB
TypeScript
67 lines
2.6 KiB
TypeScript
import { NgModule } from '@angular/core';
|
|
import { RouterModule, Routes } from '@angular/router';
|
|
import { SimpleGuard } from '@delon/auth';
|
|
import { environment } from '@env/environment';
|
|
// layout
|
|
import { LayoutBasicComponent } from '../layout/basic/basic.component';
|
|
import { LayoutPassportComponent } from '../layout/passport/passport.component';
|
|
// dashboard pages
|
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
|
// single pages
|
|
import { CallbackComponent } from './passport/callback.component';
|
|
import { UserLockComponent } from './passport/lock/lock.component';
|
|
// passport pages
|
|
import { UserLoginComponent } from './passport/login/login.component';
|
|
import { UserRegisterResultComponent } from './passport/register-result/register-result.component';
|
|
import { UserRegisterComponent } from './passport/register/register.component';
|
|
|
|
const routes: Routes = [
|
|
{
|
|
path: '',
|
|
component: LayoutBasicComponent,
|
|
// 路由守卫 在路由之前判断是否有认证或者权限进入此路由
|
|
// canActivate: [SimpleGuard],
|
|
children: [
|
|
// todo 根据路由自动生成面包屑
|
|
{ path: '', redirectTo: 'dashboard', pathMatch: 'full'},
|
|
{ path: 'dashboard', component: DashboardComponent, data: { title: '仪表盘' } },
|
|
{ path: 'exception', loadChildren: () => import('./exception/exception.module').then(m => m.ExceptionModule) },
|
|
{ path: 'monitors', loadChildren: () => import('./monitor/monitor.module').then((m) => m.MonitorModule) },]
|
|
},
|
|
// 空白布局
|
|
// {
|
|
// path: 'blank',
|
|
// component: LayoutBlankComponent,
|
|
// children: [
|
|
// ]
|
|
// },
|
|
// passport
|
|
{
|
|
path: 'passport',
|
|
component: LayoutPassportComponent,
|
|
children: [
|
|
{ path: 'login', component: UserLoginComponent, data: { title: '登录' } },
|
|
{ path: 'register', component: UserRegisterComponent, data: { title: '注册' } },
|
|
{ path: 'register-result', component: UserRegisterResultComponent, data: { title: '注册结果' } },
|
|
{ path: 'lock', component: UserLockComponent, data: { title: '锁屏' } },
|
|
]
|
|
},
|
|
// 单页不包裹Layout
|
|
{ path: 'passport/callback/:type', component: CallbackComponent },
|
|
{ path: '**', redirectTo: 'exception/404' },
|
|
];
|
|
|
|
@NgModule({
|
|
imports: [
|
|
RouterModule.forRoot(
|
|
routes, {
|
|
useHash: environment.useHash,
|
|
// NOTICE: If you use `reuse-tab` component and turn on keepingScroll you can set to `disabled`
|
|
// Pls refer to https://ng-alain.com/components/reuse-tab
|
|
scrollPositionRestoration: 'top',
|
|
}
|
|
)],
|
|
exports: [RouterModule],
|
|
})
|
|
export class RouteRoutingModule { }
|