-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
npm install create package-lock.json
- Loading branch information
Showing
17 changed files
with
173 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
import {Component, OnInit} from '@angular/core'; | ||
import {AfterContentInit, Component, OnInit} from '@angular/core'; | ||
import {LoadingService} from "./core/loading.service"; | ||
import {Observable, of} from "rxjs"; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'] | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'] | ||
}) | ||
export class AppComponent implements OnInit { | ||
export class AppComponent implements OnInit, AfterContentInit { | ||
|
||
loadingShow: boolean; | ||
loadingShow$: Observable<boolean> = of(false); | ||
|
||
constructor(private loading: LoadingService) { | ||
this.loadingShow = false; | ||
} | ||
constructor(private loading: LoadingService) { | ||
this.loadingShow$ = of(false); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.loading.progress$.subscribe(res => this.loadingShow = res); | ||
} | ||
ngOnInit(): void { | ||
//this.loadingShow$ = this.loading.progress$; | ||
} | ||
|
||
ngAfterContentInit(): void { | ||
this.loadingShow$ = this.loading.progress$; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export interface Menu { | ||
id?: number; | ||
code?: string; | ||
pcode?: string; | ||
tenantCode?: string; | ||
type?: MenuType; | ||
authority?: string; | ||
name?: string; | ||
path?: string; | ||
sort?: number; | ||
extend?: any; | ||
creator?: UserAuditor; | ||
updater?: UserAuditor; | ||
createdTime?: Date; | ||
updatedTime?: Date; | ||
getPermissions?: Permission[]; | ||
getIcons?: string; | ||
children?: Menu[] | ||
} | ||
|
||
export interface UserAuditor { | ||
code: string; | ||
username: string; | ||
name?: string; | ||
} | ||
|
||
export enum MenuType { | ||
FOLDER = "FOLDER", | ||
MENU = "MENU", | ||
} | ||
|
||
export enum HttpMethod { | ||
GET = "GET", | ||
POST = "POST", | ||
PUT = "PUT", | ||
DELETE = "DELETE", | ||
ALL = "ALL", | ||
} | ||
|
||
export interface Permission { | ||
method: HttpMethod; | ||
name: string; | ||
path: string; | ||
authority: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {TestBed} from '@angular/core/testing'; | ||
|
||
import {MenusService} from './menus.service'; | ||
|
||
describe('MenusService', () => { | ||
let service: MenusService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(MenusService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {Injectable} from '@angular/core'; | ||
import {HttpClient, HttpParams} from "@angular/common/http"; | ||
import {delay, from, map, mergeMap, Observable, retry, switchMap, toArray} from "rxjs"; | ||
import {Menu} from "./interfaces/menu"; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class MenusService { | ||
|
||
constructor(private http: HttpClient) { | ||
} | ||
|
||
getMenus(request: Menu): Observable<Menu[]> { | ||
let params = new HttpParams({fromObject: request as any}); | ||
return this.http.get<Menu[]>('/menus/me', {params: params}) | ||
.pipe(switchMap(items => { | ||
return from(items).pipe(delay(20), | ||
mergeMap(item => { | ||
return this.getChildren({pcode: item.code}).pipe(map(children => { | ||
item.children = children; | ||
return item; | ||
})); | ||
})); | ||
}), toArray(), retry(3)); | ||
} | ||
|
||
getChildren(request: Menu): Observable<Menu[]> { | ||
let params = new HttpParams({fromObject: request as any}); | ||
return this.http.get<Menu[]>('/menus/me', {params: params}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {Component, OnInit} from '@angular/core'; | ||
import {MenusService} from "../../core/menus.service"; | ||
import {Menu} from "../../core/interfaces/menu"; | ||
import {Observable, of} from "rxjs"; | ||
|
||
@Component({ | ||
selector: 'app-welcome', | ||
templateUrl: './index.component.html', | ||
styleUrls: ['./index.component.scss'] | ||
}) | ||
export class IndexComponent implements OnInit { | ||
|
||
menus$: Observable<Menu[]> = of([]); | ||
|
||
constructor(private menusService: MenusService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.initMenu(); | ||
} | ||
|
||
initMenu() { | ||
let menuRequest: Menu = { | ||
pcode: "0", | ||
tenantCode: "0" | ||
}; | ||
this.menus$ = this.menusService.getMenus(menuRequest); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
ui/web/src/app/pages/page-not-found/page-not-found.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<nz-result nzStatus="403" nzSubTitle="Sorry, you are not authorized to access this page." nzTitle="403"> | ||
<div nz-result-extra> | ||
<button nz-button nzType="primary">Back Home</button> | ||
<a href="/index" nz-button nzType="primary">Back Home</a> | ||
</div> | ||
</nz-result> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters