修改路径
This commit is contained in:
7
src/app/view/email-verify/email-verify.component.html
Normal file
7
src/app/view/email-verify/email-verify.component.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<div id="main">
|
||||
<nz-alert [nzType]="type" [nzMessage]="message"
|
||||
[nzDescription]="desc" nzShowIcon>
|
||||
</nz-alert>
|
||||
</div>
|
||||
</div>
|
||||
6
src/app/view/email-verify/email-verify.component.less
Normal file
6
src/app/view/email-verify/email-verify.component.less
Normal file
@@ -0,0 +1,6 @@
|
||||
#main{
|
||||
width: 60%;
|
||||
height: 50px;
|
||||
margin: 0 auto;
|
||||
padding: 15% 0;
|
||||
}
|
||||
25
src/app/view/email-verify/email-verify.component.spec.ts
Normal file
25
src/app/view/email-verify/email-verify.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EmailVerifyComponent } from './email-verify.component';
|
||||
|
||||
describe('EmailVerifyComponent', () => {
|
||||
let component: EmailVerifyComponent;
|
||||
let fixture: ComponentFixture<EmailVerifyComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EmailVerifyComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EmailVerifyComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
49
src/app/view/email-verify/email-verify.component.ts
Normal file
49
src/app/view/email-verify/email-verify.component.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ApiService} from '../../api/api.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
selector: 'view-email-verify',
|
||||
templateUrl: './email-verify.component.html',
|
||||
styleUrls: ['./email-verify.component.less']
|
||||
})
|
||||
export class EmailVerifyComponent implements OnInit {
|
||||
|
||||
constructor(private titleService: Title,
|
||||
private router: Router,
|
||||
public routerinfo: ActivatedRoute,
|
||||
private apiService: ApiService) {
|
||||
titleService.setTitle('小海博客 | 邮箱验证');
|
||||
}
|
||||
|
||||
type: string = 'info';
|
||||
message: string = '正在验证,请稍等';
|
||||
desc: string = '';
|
||||
|
||||
|
||||
private email: string;
|
||||
private verifyId: string;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.email = this.routerinfo.snapshot.queryParams.email;
|
||||
this.verifyId = this.routerinfo.snapshot.queryParams.verifyId;
|
||||
if (this.email == null || this.verifyId == null) {
|
||||
this.type = 'warning';
|
||||
this.message = '数据不全';
|
||||
this.desc = '链接可能被修改了,请重新点击邮箱中的链接,或者重新发送邮件';
|
||||
return;
|
||||
}
|
||||
this.apiService.emailVerify(this.verifyId, this.email).subscribe({
|
||||
next: data => {
|
||||
this.type = 'success';
|
||||
this.message = '验证成功';
|
||||
},
|
||||
error: e => {
|
||||
this.type = 'error';
|
||||
this.message = e.msg;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
24
src/app/view/email-verify/email-verify.module.ts
Normal file
24
src/app/view/email-verify/email-verify.module.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Route, RouterModule} from '@angular/router';
|
||||
import {EmailVerifyComponent} from './email-verify.component';
|
||||
import {NzAlertModule} from 'ng-zorro-antd';
|
||||
|
||||
const routes: Route[] = [
|
||||
{path: '**', component: EmailVerifyComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
EmailVerifyComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(routes),
|
||||
NzAlertModule
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
export class EmailVerifyModule {
|
||||
}
|
||||
Reference in New Issue
Block a user