master
parent
5493d07a16
commit
95eded49bf
@ -0,0 +1,12 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class ErrorModule { } |
@ -0,0 +1,8 @@ |
||||
import { Routes } from '@angular/router'; |
||||
|
||||
|
||||
|
||||
export const ERROR_ROUTES: Routes = [ |
||||
|
||||
|
||||
]; |
@ -0,0 +1,5 @@ |
||||
<nz-result nzStatus="warning" nzTitle="当前登录信息已过期,请重新登录!"> |
||||
<div nz-result-extra> |
||||
<button nz-button nzType="primary" (click)="loginOut()">重新登录</button> |
||||
</div> |
||||
</nz-result> |
@ -0,0 +1,44 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {NzResultModule} from "ng-zorro-antd/result"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {Router} from "@angular/router"; |
||||
import {LoginService} from "../../../services/login/login.service"; |
||||
import {DATA, INIT_FLAG, LOGIN_DATA, USER_TOKEN} from "../../../data/login/localStorage.namespace"; |
||||
|
||||
|
||||
@Component({ |
||||
selector: 'app-error401', |
||||
standalone: true, |
||||
imports: [ |
||||
NzResultModule, |
||||
NzButtonComponent |
||||
], |
||||
templateUrl: './error401.component.html', |
||||
styleUrl: './error401.component.less' |
||||
}) |
||||
export class Error401Component { |
||||
constructor( |
||||
private storage: BrowserStorageService, |
||||
private message: NzMessageService, |
||||
private router: Router, // 路由
|
||||
private login: LoginService |
||||
) {} |
||||
|
||||
|
||||
// 退出登录
|
||||
public loginOut(): void { |
||||
this.login.loginOut( (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.storage.remove(LOGIN_DATA); |
||||
this.storage.remove(DATA); |
||||
this.storage.remove(USER_TOKEN); |
||||
this.storage.remove(INIT_FLAG); |
||||
this.router.navigateByUrl('/login').then(); |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1 @@ |
||||
<p>error403 works!</p> |
@ -0,0 +1,23 @@ |
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { Error403Component } from './error403.component'; |
||||
|
||||
describe('Error403Component', () => { |
||||
let component: Error403Component; |
||||
let fixture: ComponentFixture<Error403Component>; |
||||
|
||||
beforeEach(async () => { |
||||
await TestBed.configureTestingModule({ |
||||
imports: [Error403Component] |
||||
}) |
||||
.compileComponents(); |
||||
|
||||
fixture = TestBed.createComponent(Error403Component); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-error403', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './error403.component.html', |
||||
styleUrl: './error403.component.less' |
||||
}) |
||||
export class Error403Component { |
||||
|
||||
} |
@ -0,0 +1 @@ |
||||
<p>error404 works!</p> |
@ -0,0 +1,23 @@ |
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { Error404Component } from './error404.component'; |
||||
|
||||
describe('Error404Component', () => { |
||||
let component: Error404Component; |
||||
let fixture: ComponentFixture<Error404Component>; |
||||
|
||||
beforeEach(async () => { |
||||
await TestBed.configureTestingModule({ |
||||
imports: [Error404Component] |
||||
}) |
||||
.compileComponents(); |
||||
|
||||
fixture = TestBed.createComponent(Error404Component); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-error404', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './error404.component.html', |
||||
styleUrl: './error404.component.less' |
||||
}) |
||||
export class Error404Component { |
||||
|
||||
} |
@ -0,0 +1 @@ |
||||
<p>error500 works!</p> |
@ -0,0 +1,23 @@ |
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { Error500Component } from './error500.component'; |
||||
|
||||
describe('Error500Component', () => { |
||||
let component: Error500Component; |
||||
let fixture: ComponentFixture<Error500Component>; |
||||
|
||||
beforeEach(async () => { |
||||
await TestBed.configureTestingModule({ |
||||
imports: [Error500Component] |
||||
}) |
||||
.compileComponents(); |
||||
|
||||
fixture = TestBed.createComponent(Error500Component); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-error500', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './error500.component.html', |
||||
styleUrl: './error500.component.less' |
||||
}) |
||||
export class Error500Component { |
||||
|
||||
} |
Loading…
Reference in new issue