import { NgModule } from "@angular/core"; import { Routes, RouterModule } from "@angular/router"; import { DishComponent, FoodComponent, HomeComponent, IngredientFormComponent, IngredientListComponent, IngredientReleaseComponent, IngredientReviewComponent, LoginComponent, OrganizationListComponent, OrganizationFormComponent, UserManageComponent, StandardListComponent, StandardFormComponent, StandardSettingComponent, } from "./pages"; import { AppLayoutComponent } from "./components"; import { authGuard } from "./services/auth.guard"; const routes: Routes = [ { path: "login", component: LoginComponent }, { path: "", component: AppLayoutComponent, canActivate: [authGuard], children: [ { path: "", pathMatch: "full", redirectTo: "home" }, { path: "home", component: HomeComponent }, { path: "food", component: FoodComponent, title: "食材管理" }, { path: "dish", component: DishComponent, title: "菜品管理" }, { path: "standard", children: [ { path: "", pathMatch: "full", redirectTo: "list", }, { path: "list", component: StandardListComponent, }, { path: "form/:id", component: StandardFormComponent, }, { path: "setting/:id", component: StandardSettingComponent, }, ], }, { path: "ingredient", title: "食谱管理", children: [ { path: "", pathMatch: "full", redirectTo: "item", }, { path: "item", title: "食谱库", children: [ { path: "", pathMatch: "full", redirectTo: "list", }, { path: "list", component: IngredientListComponent, }, { path: "form/:id", component: IngredientFormComponent, }, ], }, { path: "review", title: "食谱审核", component: IngredientReviewComponent, }, { path: "release", title: "食谱发布计划", component: IngredientReleaseComponent, }, ], }, { path: "organization", title: "单位管理", children: [ { path: "", pathMatch: "full", redirectTo: "list", }, { path: "list", component: OrganizationListComponent, }, { path: "form/:id", component: OrganizationFormComponent, }, ], }, { path: "system", title: "系统设置", children: [ { path: "user", title: "用户管理", component: UserManageComponent, }, ], }, ], }, ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule], }) export class AppRoutingModule {}