style: eslint of member-ordering

This commit is contained in:
禾几海
2021-03-12 16:48:27 +08:00
parent 2037c95ffd
commit 7ea7f83227
20 changed files with 122 additions and 107 deletions

View File

@@ -27,9 +27,9 @@
"prefer-arrow/prefer-arrow-functions": [ "prefer-arrow/prefer-arrow-functions": [
"off" "off"
], ],
"@typescript-eslint/member-ordering": [ // "@typescript-eslint/member-ordering": [
"off" // "on"
], // ],
"@typescript-eslint/ban-types": [ "@typescript-eslint/ban-types": [
"off" "off"
], ],

View File

@@ -9,9 +9,9 @@ import {ComponentStateService} from './services/component-state.service';
styleUrls: ['./app.component.less'] styleUrls: ['./app.component.less']
}) })
export class AppComponent { export class AppComponent {
@ViewChild('headerComponent') header: HeaderComponent;
loginModal: boolean = false; loginModal: boolean = false;
regModal: boolean = false; regModal: boolean = false;
@ViewChild('headerComponent') header: HeaderComponent;
constructor(public componentStateService: ComponentStateService) { constructor(public componentStateService: ComponentStateService) {
} }

View File

@@ -8,13 +8,14 @@ import {User} from '../../class/User';
styleUrls: ['./admin-header.component.less'] styleUrls: ['./admin-header.component.less']
}) })
export class AdminHeaderComponent implements OnInit { export class AdminHeaderComponent implements OnInit {
@Output() infoClicked = new EventEmitter<void>();
user: User;
noAvatarUrl = 'https://cdn.celess.cn/';
constructor(private userService: GlobalUserService) { constructor(private userService: GlobalUserService) {
} }
user: User;
@Output() infoClicked = new EventEmitter<void>();
noAvatarUrl = 'https://cdn.celess.cn/';
logout = () => this.userService.logout(); logout = () => this.userService.logout();
infoClickedEvent = () => this.infoClicked.emit(); infoClickedEvent = () => this.infoClicked.emit();

View File

@@ -8,12 +8,12 @@ import {ComponentStateService} from '../../services/component-state.service';
}) })
export class FooterComponent implements OnInit { export class FooterComponent implements OnInit {
constructor(public componentStateService: ComponentStateService) {
}
readonly gName: string = '何梦幻'; readonly gName: string = '何梦幻';
readonly bName: string = '郑海'; readonly bName: string = '郑海';
constructor(public componentStateService: ComponentStateService) {
}
ngOnInit() { ngOnInit() {
} }

View File

@@ -1,7 +1,6 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {windowWidthChange} from '../../utils/util'; import {windowWidthChange} from '../../utils/util';
import {ApiService} from '../../api/api.service';
import {User} from '../../class/User'; import {User} from '../../class/User';
import {ComponentStateService} from '../../services/component-state.service'; import {ComponentStateService} from '../../services/component-state.service';
import {GlobalUserService} from '../../services/global-user.service'; import {GlobalUserService} from '../../services/global-user.service';
@@ -12,6 +11,25 @@ import {GlobalUserService} from '../../services/global-user.service';
styleUrls: ['./header.component.less'] styleUrls: ['./header.component.less']
}) })
export class HeaderComponent implements OnInit { export class HeaderComponent implements OnInit {
@Output() loginEvent = new EventEmitter();
@Output() registrationEvent = new EventEmitter();
@Input() userInfo: User;
size: 'large' | 'default';
currentPath: string;
noAvatarUrl = 'https://cdn.celess.cn/';
public pageList: {
path: string;
name: string;
icon: string;
iconType: 'outline' | 'fill' | 'twotone';
show: boolean;
}[];
public showList = true;
// css 样式中设置移动端最大宽度为910px 见src/app/global-variables.less
private readonly mobileMaxWidth = 940;
constructor(private router: Router, constructor(private router: Router,
public componentStateService: ComponentStateService, public componentStateService: ComponentStateService,
@@ -46,26 +64,6 @@ export class HeaderComponent implements OnInit {
}); });
} }
@Output() loginEvent = new EventEmitter();
@Output() registrationEvent = new EventEmitter();
size: 'large' | 'default';
currentPath: string;
noAvatarUrl = 'https://cdn.celess.cn/';
public pageList: {
path: string;
name: string;
icon: string;
iconType: 'outline' | 'fill' | 'twotone';
show: boolean;
}[];
public showList = true;
// css 样式中设置移动端最大宽度为910px 见src/app/global-variables.less
private readonly mobileMaxWidth = 940;
@Input() userInfo: User;
ngOnInit() { ngOnInit() {
} }
@@ -75,17 +73,6 @@ export class HeaderComponent implements OnInit {
this.changeLoginButtonV(); this.changeLoginButtonV();
} }
private changeLoginButtonV() {
this.pageList.forEach(e => {
if (e.name === '登录' || e.name === '注册') {
if (this.userInfo) {
e.show = false;
} else {
e.show = (this.showList && window.innerWidth < this.mobileMaxWidth);
}
}
});
}
dealLink(path: string) { dealLink(path: string) {
this.showList = window.innerWidth > this.mobileMaxWidth; this.showList = window.innerWidth > this.mobileMaxWidth;
@@ -139,5 +126,18 @@ export class HeaderComponent implements OnInit {
toAdminPage() { toAdminPage() {
this.router.navigateByUrl('/admin'); this.router.navigateByUrl('/admin');
} }
private changeLoginButtonV() {
this.pageList.forEach(e => {
if (e.name === '登录' || e.name === '注册') {
if (this.userInfo) {
e.show = false;
} else {
e.show = (this.showList && window.innerWidth < this.mobileMaxWidth);
}
}
});
}
} }

View File

@@ -1,17 +1,12 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {filter} from 'rxjs/operators'; import {filter} from 'rxjs/operators';
import {NavigationEnd, Router, RouterEvent} from '@angular/router'; import {NavigationEnd, Router, RouterEvent} from '@angular/router';
import {Observable, of, Subscriber} from 'rxjs'; import {Observable, Subscriber} from 'rxjs';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ComponentStateService { export class ComponentStateService {
constructor(private router: Router) {
this.watchRouterChange();
}
visible = { visible = {
header: true, header: true,
footer: true, footer: true,
@@ -19,6 +14,12 @@ export class ComponentStateService {
}; };
currentPath: string; currentPath: string;
constructor(private router: Router) {
this.watchRouterChange();
}
getCurrentRouterPath = () => this.currentPath; getCurrentRouterPath = () => this.currentPath;
watchRouterChange() { watchRouterChange() {
@@ -33,7 +34,9 @@ export class ComponentStateService {
const prefix = path.substr(0, indexOf === 0 ? path.length : indexOf); const prefix = path.substr(0, indexOf === 0 ? path.length : indexOf);
this.dealWithPathChange(prefix); this.dealWithPathChange(prefix);
this.currentPath = prefix; this.currentPath = prefix;
if (subscriber) {subscriber.next(prefix);} if (subscriber) {
subscriber.next(prefix);
}
}); });
return ob; return ob;
} }

View File

@@ -11,6 +11,9 @@ import {LocalStorageService} from './local-storage.service';
providedIn: 'root' providedIn: 'root'
}) })
export class ErrorService { export class ErrorService {
private static HTTP_ERROR_COUNT: number = 0;
private readonly MAINTAIN_PAGE_PREFIX = '/maintain';
private readonly ADMIN_PAGE_PREFIX = '/admin';
constructor(/*private httpService: HttpService,*/ constructor(/*private httpService: HttpService,*/
private router: Router, private router: Router,
@@ -20,10 +23,6 @@ export class ErrorService {
private localStorageService: LocalStorageService) { private localStorageService: LocalStorageService) {
} }
private static HTTP_ERROR_COUNT: number = 0;
private readonly MAINTAIN_PAGE_PREFIX = '/maintain';
private readonly ADMIN_PAGE_PREFIX = '/admin';
public httpError(err: any, request: RequestObj) { public httpError(err: any, request: RequestObj) {
if (!environment.production) { if (!environment.production) {
console.log('error=>', err, request); console.log('error=>', err, request);
@@ -33,9 +32,12 @@ export class ErrorService {
} }
public httpException(response: Response<any>, request: RequestObj) { public httpException(response: Response<any>, request: RequestObj) {
if (!environment.production) if (!environment.production) {
{console.log('exception=>', response, request);} console.log('exception=>', response, request);
if (response.code === -1 && response.msg === '重复请求') {return;} }
if (response.code === -1 && response.msg === '重复请求') {
return;
}
if (this.componentStateService.currentPath === this.ADMIN_PAGE_PREFIX) { if (this.componentStateService.currentPath === this.ADMIN_PAGE_PREFIX) {
this.notification.create('error', `请求失败<${response.code}>`, `${response.msg}`); this.notification.create('error', `请求失败<${response.code}>`, `${response.msg}`);
} }

View File

@@ -10,10 +10,6 @@ import {LocalStorageService} from './local-storage.service';
}) })
export class GlobalUserService { export class GlobalUserService {
constructor(private apiService: ApiService,
private localStorageService: LocalStorageService) {
}
private lastRequestTime: number; private lastRequestTime: number;
private userInfo: User = null; private userInfo: User = null;
@@ -21,6 +17,9 @@ export class GlobalUserService {
private userObserverArray: Observer<Response<User>>[] = []; private userObserverArray: Observer<Response<User>>[] = [];
private multicastArray: Observer<Response<User>>[] = []; private multicastArray: Observer<Response<User>>[] = [];
constructor(private apiService: ApiService,
private localStorageService: LocalStorageService) {
}
watchUserInfo(observer: Observer<Response<User>>) { watchUserInfo(observer: Observer<Response<User>>) {
if (this.userObserverArray.indexOf(observer) < 0) {this.userObserverArray.push(observer);} if (this.userObserverArray.indexOf(observer) < 0) {this.userObserverArray.push(observer);}

View File

@@ -1,16 +1,15 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {User} from '../class/User';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class LocalStorageService { export class LocalStorageService {
readonly place = 30 * 1000;
constructor() { constructor() {
} }
// 30s // 30s
readonly place = 30 * 1000;
getToken(): string { getToken(): string {
return localStorage.getItem('token'); return localStorage.getItem('token');

View File

@@ -1,11 +1,12 @@
export class SvgIconUtil { export class SvgIconUtil {
constructor() {
}
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
static readonly nameIcon = '<svg t="1581933298087" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3223" width="200" height="200"><path d="M983.04 163.84H40.96c-24.576 0-40.96 16.384-40.96 40.96v614.4c0 20.48 16.384 40.96 40.96 40.96h942.08c20.48 0 40.96-20.48 40.96-40.96V204.8c0-24.576-20.48-40.96-40.96-40.96zM253.952 749.568c0-102.4 61.44-192.512 147.456-233.472-28.672-24.576-45.056-61.44-45.056-102.4 0-77.824 65.536-143.36 143.36-143.36s143.36 65.536 143.36 143.36c0 40.96-12.288 73.728-36.864 98.304 94.208 36.864 163.84 131.072 163.84 237.568H253.952z" p-id="3224" fill="#1296db"></path></svg>'; static readonly nameIcon = '<svg t="1581933298087" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3223" width="200" height="200"><path d="M983.04 163.84H40.96c-24.576 0-40.96 16.384-40.96 40.96v614.4c0 20.48 16.384 40.96 40.96 40.96h942.08c20.48 0 40.96-20.48 40.96-40.96V204.8c0-24.576-20.48-40.96-40.96-40.96zM253.952 749.568c0-102.4 61.44-192.512 147.456-233.472-28.672-24.576-45.056-61.44-45.056-102.4 0-77.824 65.536-143.36 143.36-143.36s143.36 65.536 143.36 143.36c0 40.96-12.288 73.728-36.864 98.304 94.208 36.864 163.84 131.072 163.84 237.568H253.952z" p-id="3224" fill="#1296db"></path></svg>';
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
static readonly locationIcon = '<svg t="1581933583276" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3981" width="200" height="200"><path d="M511.932268 0c-213.943865 0-387.880498 170.933833-387.880499 381.06211 0 164.815346 238.869364 485.098975 341.66447 620.247558a58.249807 58.249807 0 0 0 46.216029 22.690332c18.129688 0 35.491743-8.443964 46.328916-22.690332 102.704796-135.126006 341.709624-455.432213 341.709624-620.247558C899.970808 170.933833 725.89871 0 511.932268 0z m0 519.574733c-91.393496 0-165.786176-72.902569-165.786176-162.670489 0-89.722765 74.39268-162.738221 165.786176-162.73822 91.438651 0 165.718443 73.015456 165.718443 162.73822 0 89.76792-74.279793 162.670488-165.718443 162.670489z" fill="#1296db" p-id="3982"></path></svg>'; static readonly locationIcon = '<svg t="1581933583276" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3981" width="200" height="200"><path d="M511.932268 0c-213.943865 0-387.880498 170.933833-387.880499 381.06211 0 164.815346 238.869364 485.098975 341.66447 620.247558a58.249807 58.249807 0 0 0 46.216029 22.690332c18.129688 0 35.491743-8.443964 46.328916-22.690332 102.704796-135.126006 341.709624-455.432213 341.709624-620.247558C899.970808 170.933833 725.89871 0 511.932268 0z m0 519.574733c-91.393496 0-165.786176-72.902569-165.786176-162.670489 0-89.722765 74.39268-162.738221 165.786176-162.73822 91.438651 0 165.718443 73.015456 165.718443 162.73822 0 89.76792-74.279793 162.670488-165.718443 162.670489z" fill="#1296db" p-id="3982"></path></svg>';
constructor() {
}
} }

View File

@@ -14,9 +14,9 @@ import {Router} from '@angular/router';
}) })
export class AdminArticleComponent implements OnInit { export class AdminArticleComponent implements OnInit {
@ViewChild('commonTableComponent') private commonTableComponent: CommonTableComponent<Article>;
request: RequestObj; request: RequestObj;
headData: Data<Article>[]; headData: Data<Article>[];
@ViewChild('commonTableComponent') private commonTableComponent: CommonTableComponent<Article>;
constructor(private apiService: ApiService, private nzMessage: NzMessageService, private title: Title, constructor(private apiService: ApiService, private nzMessage: NzMessageService, private title: Title,
private router: Router) { private router: Router) {

View File

@@ -15,6 +15,8 @@ import {CommonTableComponent} from '../components/common-table/common-table.comp
}) })
export class AdminCommentComponent implements OnInit { export class AdminCommentComponent implements OnInit {
@ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent;
@ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent<Comment>;
request: RequestObj; request: RequestObj;
editInfo = { editInfo = {
id: null, id: null,
@@ -25,8 +27,6 @@ export class AdminCommentComponent implements OnInit {
visible: false, visible: false,
comment: null comment: null
}; };
@ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent;
@ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent<Comment>;
constructor(private apiService: ApiService, private messageService: NzMessageService, private userService: GlobalUserService, constructor(private apiService: ApiService, private messageService: NzMessageService, private userService: GlobalUserService,
private title: Title) { private title: Title) {

View File

@@ -15,11 +15,11 @@ import {Data} from '../components/common-table/data';
}) })
export class AdminLinkComponent implements OnInit { export class AdminLinkComponent implements OnInit {
@ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent<Link>;
modalVisible: boolean = false; modalVisible: boolean = false;
modalTitle: string = ''; modalTitle: string = '';
formGroup: FormGroup; formGroup: FormGroup;
request: RequestObj; request: RequestObj;
@ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent<Link>;
headData: Data<Link>[]; headData: Data<Link>[];
constructor(private apiService: ApiService, private messageService: NzMessageService, private title: Title) { constructor(private apiService: ApiService, private messageService: NzMessageService, private title: Title) {

View File

@@ -15,6 +15,10 @@ import {EditableTagComponent} from '../components/editable-tag/editable-tag.comp
}) })
export class AdminTagComponent implements OnInit { export class AdminTagComponent implements OnInit {
@ViewChild('categoryCTComponent', {static: true}) categoryCTComponent: CommonTableComponent<Category>;
@ViewChild('tagCTComponent', {static: true}) tagCTComponent: CommonTableComponent<Tag>;
@ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent;
categoryCTData: { headData: Data<Category>[]; commonTable: CommonTableComponent<Category>; request: RequestObj } = { categoryCTData: { headData: Data<Category>[]; commonTable: CommonTableComponent<Category>; request: RequestObj } = {
headData: null, headData: null,
commonTable: null, commonTable: null,
@@ -25,9 +29,6 @@ export class AdminTagComponent implements OnInit {
commonTable: null, commonTable: null,
request: null request: null
}; };
@ViewChild('categoryCTComponent', {static: true}) categoryCTComponent: CommonTableComponent<Category>;
@ViewChild('tagCTComponent', {static: true}) tagCTComponent: CommonTableComponent<Tag>;
@ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent;
getData: any; getData: any;
private updateData: any; private updateData: any;

View File

@@ -11,7 +11,7 @@ import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';
}) })
export class CommonTableComponent<T> implements OnInit, OnChanges { export class CommonTableComponent<T> implements OnInit, OnChanges {
@Input() request: RequestObj; @Output() pageInfo = new EventEmitter<{ page: number; pageSize: number }>();
@Input() cardTitle: string | null; @Input() cardTitle: string | null;
@Input() template: { @Input() template: {
[fieldValue: string]: { [fieldValue: string]: {
@@ -19,14 +19,14 @@ export class CommonTableComponent<T> implements OnInit, OnChanges {
param?: { [key: string]: string }; param?: { [key: string]: string };
}; };
}; };
@Output() pageInfo = new EventEmitter<{ page: number; pageSize: number }>(); @Input() request: RequestObj;
@Input() private headData: Data<T>[];
loading: boolean = true; loading: boolean = true;
dataList: PageList<T> = new PageList<T>(); dataList: PageList<T> = new PageList<T>();
settingModalVisible: boolean = false; settingModalVisible: boolean = false;
filedData: Data<T>[]; filedData: Data<T>[];
changed: boolean = false; changed: boolean = false;
visibleFieldLength: number = 0; visibleFieldLength: number = 0;
@Input() private headData: Data<T>[];
constructor(private httpService: HttpService) { constructor(private httpService: HttpService) {
@@ -41,16 +41,22 @@ export class CommonTableComponent<T> implements OnInit, OnChanges {
} }
this.calculateVisibleFieldLength(); this.calculateVisibleFieldLength();
if (!this.template) {this.template = {};} if (!this.template) {
this.template = {};
}
this.headData.forEach(dat => { this.headData.forEach(dat => {
if (!dat.action) {return;} if (!dat.action) {
return;
}
dat.action.forEach(act => { dat.action.forEach(act => {
if (!act.hover) { if (!act.hover) {
act.hover = () => null; act.hover = () => null;
} }
}); });
}); });
if (!this.request || !this.request.path) {return;} if (!this.request || !this.request.path) {
return;
}
this.getData(); this.getData();
} }
@@ -87,7 +93,9 @@ export class CommonTableComponent<T> implements OnInit, OnChanges {
getValue(index: number, fieldValue: string): string { getValue(index: number, fieldValue: string): string {
let value = this.dataList.list[index]; let value = this.dataList.list[index];
try { try {
for (const key of fieldValue.split('.')) {value = value[key];} for (const key of fieldValue.split('.')) {
value = value[key];
}
} catch (e) { } catch (e) {
// ignore // ignore
} }

View File

@@ -30,8 +30,6 @@ import {NzModalRef, NzModalService} from 'ng-zorro-antd/modal';
export class EditableTagComponent implements OnInit, OnChanges { export class EditableTagComponent implements OnInit, OnChanges {
private static instanceArray: EditableTagComponent[] = []; private static instanceArray: EditableTagComponent[] = [];
inputVisible = false;
inputValue = '';
@ViewChild('inputElement', {static: false}) inputElement?: ElementRef; @ViewChild('inputElement', {static: false}) inputElement?: ElementRef;
@Output() valueChange = new EventEmitter<{ value: string; originalValue: string; changed: boolean }>(); @Output() valueChange = new EventEmitter<{ value: string; originalValue: string; changed: boolean }>();
@Input() color: string; @Input() color: string;
@@ -46,6 +44,8 @@ export class EditableTagComponent implements OnInit, OnChanges {
@Output() inEditStatus = new EventEmitter<void>(); @Output() inEditStatus = new EventEmitter<void>();
@Output() modalOK = new EventEmitter<{ value: string; originalValue: string; changed: boolean }>(); @Output() modalOK = new EventEmitter<{ value: string; originalValue: string; changed: boolean }>();
@Output() modalCancel = new EventEmitter<{ value: string; originalValue: string; changed: boolean }>(); @Output() modalCancel = new EventEmitter<{ value: string; originalValue: string; changed: boolean }>();
inputVisible = false;
inputValue = '';
confirmModal?: NzModalRef; confirmModal?: NzModalRef;
private tmpKey: any; private tmpKey: any;
private doubleClickInfo = { private doubleClickInfo = {

View File

@@ -18,6 +18,7 @@ declare let $;
}) })
export class ArticleComponent implements OnInit { export class ArticleComponent implements OnInit {
@ViewChild('divElement') divElement: ElementRef;
articleId: number; articleId: number;
article: Article; article: Article;
copyRightUrl: string; copyRightUrl: string;
@@ -30,7 +31,6 @@ export class ArticleComponent implements OnInit {
avatarImgUrl: string; avatarImgUrl: string;
pid: number; pid: number;
content: string; content: string;
@ViewChild('divElement') divElement: ElementRef;
constructor(private activatedRoute: ActivatedRoute, constructor(private activatedRoute: ActivatedRoute,
private apiService: ApiService, private apiService: ApiService,

View File

@@ -13,6 +13,14 @@ import {GlobalUserService} from '../../../../services/global-user.service';
}) })
export class LoginComponent implements OnInit { export class LoginComponent implements OnInit {
@Output() loginStatus = new EventEmitter<boolean>();
@Input() showSendEmail: boolean = true;
submitting: boolean = false;
loginReq: LoginReq = new LoginReq(null, true, null);
private url: string;
constructor(private nzMessageService: NzMessageService, constructor(private nzMessageService: NzMessageService,
private userService: GlobalUserService, private userService: GlobalUserService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
@@ -22,14 +30,6 @@ export class LoginComponent implements OnInit {
this.title.setTitle('小海博客 | 登录 '); this.title.setTitle('小海博客 | 登录 ');
} }
submitting: boolean = false;
loginReq: LoginReq = new LoginReq(null, true, null);
@Output() loginStatus = new EventEmitter<boolean>();
@Input() showSendEmail: boolean = true;
private url: string;
ngOnInit() { ngOnInit() {
this.url = this.activatedRoute.snapshot.queryParamMap.get('url'); this.url = this.activatedRoute.snapshot.queryParamMap.get('url');
this.loginReq.email = localStorage.getItem('e'); this.loginReq.email = localStorage.getItem('e');

View File

@@ -15,6 +15,17 @@ import {Title} from '@angular/platform-browser';
}) })
export class RegistrationComponent implements OnInit { export class RegistrationComponent implements OnInit {
@Output() regStatus = new EventEmitter<boolean>();
@Output() regAccount = new EventEmitter<LoginReq>();
imgCodeUrl: string;
imgCode: string;
email: string;
pwd: string;
submitting: boolean;
constructor(private apiService: ApiService, constructor(private apiService: ApiService,
private nzMessageService: NzMessageService, private nzMessageService: NzMessageService,
private router: Router, private router: Router,
@@ -22,17 +33,6 @@ export class RegistrationComponent implements OnInit {
this.title.setTitle('小海博客 | 注册'); this.title.setTitle('小海博客 | 注册');
} }
imgCodeUrl: string;
imgCode: string;
email: string;
pwd: string;
submitting: boolean;
@Output() regStatus = new EventEmitter<boolean>();
@Output() regAccount = new EventEmitter<LoginReq>();
ngOnInit() { ngOnInit() {
this.imgCodeUrl = environment.host + '/imgCode'; this.imgCodeUrl = environment.host + '/imgCode';
this.submitting = false; this.submitting = false;

View File

@@ -10,14 +10,15 @@ import { NzMessageService } from 'ng-zorro-antd/message';
}) })
export class LoginRegistrationComponent implements OnInit { export class LoginRegistrationComponent implements OnInit {
picUrl: string = '';
email: string;
submitting: boolean = false;
constructor(private apiService: ApiService, constructor(private apiService: ApiService,
public loginRegistrationService: LoginRegistrationService, public loginRegistrationService: LoginRegistrationService,
private nzMessageService: NzMessageService) { private nzMessageService: NzMessageService) {
} }
picUrl: string = '';
email: string;
submitting: boolean = false;
ngOnInit() { ngOnInit() {
this.apiService.bingPic().subscribe(data => { this.apiService.bingPic().subscribe(data => {