diff --git a/src/app/api/api.service.ts b/src/app/api/api.service.ts index 5a0d33b..61436d3 100644 --- a/src/app/api/api.service.ts +++ b/src/app/api/api.service.ts @@ -1,14 +1,11 @@ -import {forwardRef, Inject, Injectable} from '@angular/core'; -import {Article} from '../class/Article'; +import {Injectable} from '@angular/core'; +import {Article, ArticleReq} from '../class/Article'; import {HttpService} from './http/http.service'; import {PageList} from '../class/HttpReqAndResp'; -import {ArticleReq} from '../class/Article'; import {Category, Tag} from '../class/Tag'; -import {Comment} from '../class/Comment'; -import {CommentReq} from '../class/Comment'; +import {Comment, CommentReq} from '../class/Comment'; import {ApplyLinkReq, Link} from '../class/Link'; -import {User} from '../class/User'; -import {LoginReq} from '../class/User'; +import {LoginReq, User} from '../class/User'; import {Visitor} from '../class/Visitor'; import {UpdateInfo} from '../class/UpdateInfo'; diff --git a/src/app/api/http/http.service.ts b/src/app/api/http/http.service.ts index 9b2655a..bc5fdd2 100644 --- a/src/app/api/http/http.service.ts +++ b/src/app/api/http/http.service.ts @@ -11,13 +11,13 @@ import {ErrorService} from '../../services/error.service'; }) export class HttpService { + private subscriptionQueue: Subscription[] = []; + constructor(private httpClient: HttpClient, private localStorageService: LocalStorageService, private injector: Injector) { } - private subscriptionQueue: Subscription[] = []; - public getSubscriptionQueue = () => this.subscriptionQueue; Service(request: RequestObj) { @@ -69,7 +69,7 @@ export class HttpService { observer.complete(); }, error: err => { - errorService.httpError(err,request); + errorService.httpError(err, request); errorService.checkConnection(); this.subscriptionQueue.splice(this.subscriptionQueue.indexOf(subscription), 1) }, diff --git a/src/app/view/admin/admin-article/admin-article.component.html b/src/app/view/admin/admin-article/admin-article.component.html index 8846d0b..f075386 100644 --- a/src/app/view/admin/admin-article/admin-article.component.html +++ b/src/app/view/admin/admin-article/admin-article.component.html @@ -1,32 +1,32 @@ - + }" + cardTitle="文章管理"> - + {{value}} - + {{value}} - + {{value}} - + {{value}} - + diff --git a/src/app/view/admin/admin-article/admin-article.component.ts b/src/app/view/admin/admin-article/admin-article.component.ts index 54bde2d..62693c1 100644 --- a/src/app/view/admin/admin-article/admin-article.component.ts +++ b/src/app/view/admin/admin-article/admin-article.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit, ViewChild} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {ApiService} from '../../../api/api.service'; import {RequestObj} from '../../../class/HttpReqAndResp'; import {Article} from '../../../class/Article'; @@ -14,6 +14,10 @@ import {Router} from '@angular/router'; }) export class AdminArticleComponent implements OnInit { + request: RequestObj; + headData: Data
[] + @ViewChild('commonTableComponent') private commonTableComponent: CommonTableComponent
+ constructor(private apiService: ApiService, private nzMessage: NzMessageService, private title: Title, private router: Router) { this.request = { @@ -26,10 +30,6 @@ export class AdminArticleComponent implements OnInit { } } - request: RequestObj; - headData: Data
[] - @ViewChild('commonTableComponent') private commonTableComponent: CommonTableComponent
- ngOnInit(): void { this.title.setTitle('小海博客 | 文章管理') this.headData = [ diff --git a/src/app/view/admin/admin-article/admin-article.module.ts b/src/app/view/admin/admin-article/admin-article.module.ts index 0f79808..ee382fd 100644 --- a/src/app/view/admin/admin-article/admin-article.module.ts +++ b/src/app/view/admin/admin-article/admin-article.module.ts @@ -4,8 +4,8 @@ import {RouterModule} from '@angular/router'; import {AdminArticleComponent} from './admin-article.component'; import {CommonTableModule} from '../components/common-table/common-table.module'; import {FormsModule} from '@angular/forms'; -import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; -import { NzTagModule } from 'ng-zorro-antd/tag'; +import {NzCheckboxModule} from 'ng-zorro-antd/checkbox'; +import {NzTagModule} from 'ng-zorro-antd/tag'; @NgModule({ declarations: [ diff --git a/src/app/view/admin/admin-comment/admin-comment.component.html b/src/app/view/admin/admin-comment/admin-comment.component.html index 8db5646..a0d31c2 100644 --- a/src/app/view/admin/admin-comment/admin-comment.component.html +++ b/src/app/view/admin/admin-comment/admin-comment.component.html @@ -1,44 +1,44 @@ + [request]="request" + [template]="{status:{temp:status,param:{'0':' 正常 ','3':'已删除'}},content:{temp:content}}" + cardTitle="评论管理"> - - {{value}} - {{value}} + + {{value}} + {{value}} - + + [text]="value"> - + - +

{{ comment && comment.content }}

- + - - + +
- +
diff --git a/src/app/view/admin/admin-comment/admin-comment.component.ts b/src/app/view/admin/admin-comment/admin-comment.component.ts index 116795e..426b9c3 100644 --- a/src/app/view/admin/admin-comment/admin-comment.component.ts +++ b/src/app/view/admin/admin-comment/admin-comment.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit, ViewChild} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {ApiService} from '../../../api/api.service'; import {RequestObj} from '../../../class/HttpReqAndResp'; import {Comment, CommentReq} from '../../../class/Comment'; @@ -15,6 +15,19 @@ import {CommonTableComponent} from '../components/common-table/common-table.comp }) export class AdminCommentComponent implements OnInit { + request: RequestObj; + editInfo = { + id: null, + content: new CommentReq(null), + } + headData: Data[]; + modalData = { + visible: false, + comment: null + } + @ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent; + @ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent; + constructor(private apiService: ApiService, private messageService: NzMessageService, private userService: GlobalUserService, private title: Title) { this.title.setTitle('小海博客 | 评论管理') @@ -42,19 +55,6 @@ export class AdminCommentComponent implements OnInit { }) } - request: RequestObj; - editInfo = { - id: null, - content: new CommentReq(null), - } - headData: Data[]; - modalData = { - visible: false, - comment: null - } - @ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent; - @ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent; - ngOnInit(): void { this.headData = [ {title: '主键', fieldValue: 'id', show: false, primaryKey: true}, diff --git a/src/app/view/admin/admin-comment/admin-comment.module.ts b/src/app/view/admin/admin-comment/admin-comment.module.ts index 4958fb4..4ac8acf 100644 --- a/src/app/view/admin/admin-comment/admin-comment.module.ts +++ b/src/app/view/admin/admin-comment/admin-comment.module.ts @@ -3,10 +3,10 @@ import {CommonModule} from '@angular/common'; import {RouterModule} from '@angular/router'; import {AdminCommentComponent} from './admin-comment.component'; import {CommonTableModule} from '../components/common-table/common-table.module'; -import { NzAvatarModule } from 'ng-zorro-antd/avatar'; -import { NzCommentModule } from 'ng-zorro-antd/comment'; -import { NzModalModule } from 'ng-zorro-antd/modal'; -import { NzTagModule } from 'ng-zorro-antd/tag'; +import {NzAvatarModule} from 'ng-zorro-antd/avatar'; +import {NzCommentModule} from 'ng-zorro-antd/comment'; +import {NzModalModule} from 'ng-zorro-antd/modal'; +import {NzTagModule} from 'ng-zorro-antd/tag'; import {EditableTagModule} from '../components/editable-tag/editable-tag.module'; diff --git a/src/app/view/admin/admin-dashboard/admin-dashboard.component.html b/src/app/view/admin/admin-dashboard/admin-dashboard.component.html index 0eadbc5..64e3678 100644 --- a/src/app/view/admin/admin-dashboard/admin-dashboard.component.html +++ b/src/app/view/admin/admin-dashboard/admin-dashboard.component.html @@ -1,6 +1,6 @@
- + @@ -16,7 +16,7 @@ - + @@ -32,9 +32,9 @@
- + - +
{{logText}}
@@ -44,11 +44,11 @@
- + - +

此博客由 禾几海(郑海) 设计并实现的

博客自2019年3月开始开发编写 5月开始正式运行至今

博客所有代码都是开源的,你可以随意修改,运行和发布

@@ -59,7 +59,7 @@

如果觉得博客还不错,请前往Github支持我,给我点一个star吧

- +

坚强的信心,能使平凡的人做出惊人的事业。

——马尔顿

diff --git a/src/app/view/admin/admin-dashboard/admin-dashboard.component.ts b/src/app/view/admin/admin-dashboard/admin-dashboard.component.ts index 182dcec..41eaa25 100644 --- a/src/app/view/admin/admin-dashboard/admin-dashboard.component.ts +++ b/src/app/view/admin/admin-dashboard/admin-dashboard.component.ts @@ -11,12 +11,6 @@ import {Title} from '@angular/platform-browser'; styleUrls: ['./admin-dashboard.component.less'] }) export class AdminDashboardComponent implements OnInit { - constructor(private apiService: ApiService, private userService: GlobalUserService, private http: HttpClient, - private title: Title) { - this.title.setTitle('小海博客 | 后台管理'); - this.getUserInfo(); - } - logLoading: boolean = true; logText: string = null; counts: { @@ -26,11 +20,16 @@ export class AdminDashboardComponent implements OnInit { tagCount: number, commentCount: number } = {articleCount: 0, visitorCount: 0, categoryCount: 0, tagCount: 0, commentCount: 0} - dayVisitCount: number = 0; userInfo: User = new User(); private isRequested: boolean = false; + constructor(private apiService: ApiService, private userService: GlobalUserService, private http: HttpClient, + private title: Title) { + this.title.setTitle('小海博客 | 后台管理'); + this.getUserInfo(); + } + ngOnInit(): void { } diff --git a/src/app/view/admin/admin-dashboard/admin-dashboard.module.ts b/src/app/view/admin/admin-dashboard/admin-dashboard.module.ts index bb64ab8..e08c56a 100644 --- a/src/app/view/admin/admin-dashboard/admin-dashboard.module.ts +++ b/src/app/view/admin/admin-dashboard/admin-dashboard.module.ts @@ -2,13 +2,13 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {AdminDashboardComponent} from './admin-dashboard.component'; import {RouterModule} from '@angular/router'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzCardModule } from 'ng-zorro-antd/card'; -import { NzDividerModule } from 'ng-zorro-antd/divider'; -import { NzGridModule } from 'ng-zorro-antd/grid'; -import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzSpinModule } from 'ng-zorro-antd/spin'; -import { NzStatisticModule } from 'ng-zorro-antd/statistic'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzCardModule} from 'ng-zorro-antd/card'; +import {NzDividerModule} from 'ng-zorro-antd/divider'; +import {NzGridModule} from 'ng-zorro-antd/grid'; +import {NzIconModule} from 'ng-zorro-antd/icon'; +import {NzSpinModule} from 'ng-zorro-antd/spin'; +import {NzStatisticModule} from 'ng-zorro-antd/statistic'; @NgModule({ diff --git a/src/app/view/admin/admin-link/admin-link.component.html b/src/app/view/admin/admin-link/admin-link.component.html index e40fa71..5cd3056 100644 --- a/src/app/view/admin/admin-link/admin-link.component.html +++ b/src/app/view/admin/admin-link/admin-link.component.html @@ -1,34 +1,34 @@ - + - + - - {{value}} - {{value}} + + {{value}} + {{value}} - -
+ + 网站名称 - - + + 网站链接 - - + +
网站链接不可为空
网站链接格式不正确
@@ -38,8 +38,8 @@
是否公开 - - + + @@ -47,20 +47,20 @@ 网站图标 - + - + - icon + icon 网站描述 - - + + diff --git a/src/app/view/admin/admin-link/admin-link.component.ts b/src/app/view/admin/admin-link/admin-link.component.ts index 756c46c..4474e6a 100644 --- a/src/app/view/admin/admin-link/admin-link.component.ts +++ b/src/app/view/admin/admin-link/admin-link.component.ts @@ -2,7 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import {RequestObj, Response} from '../../../class/HttpReqAndResp'; import {Link} from '../../../class/Link'; import {ApiService} from '../../../api/api.service'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {FormControl, FormGroup, Validators} from '@angular/forms'; import {Observable} from 'rxjs'; import {Title} from '@angular/platform-browser'; @@ -15,6 +15,13 @@ import {Data} from '../components/common-table/data'; }) export class AdminLinkComponent implements OnInit { + modalVisible: boolean = false; + modalTitle: string = ''; + formGroup: FormGroup; + request: RequestObj; + @ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent + headData: Data[]; + constructor(private apiService: ApiService, private messageService: NzMessageService, private title: Title) { this.title.setTitle('小海博客 | 友链管理'); this.formGroup = new FormGroup({ @@ -28,14 +35,6 @@ export class AdminLinkComponent implements OnInit { }) } - - modalVisible: boolean = false; - modalTitle: string = ''; - formGroup: FormGroup; - request: RequestObj; - @ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent - headData: Data[]; - ngOnInit(): void { this.request = { path: '/admin/links', diff --git a/src/app/view/admin/admin-link/admin-link.module.ts b/src/app/view/admin/admin-link/admin-link.module.ts index 9fddef8..3556055 100644 --- a/src/app/view/admin/admin-link/admin-link.module.ts +++ b/src/app/view/admin/admin-link/admin-link.module.ts @@ -3,13 +3,13 @@ import {CommonModule} from '@angular/common'; import {RouterModule} from '@angular/router'; import {AdminLinkComponent} from './admin-link.component'; import {CommonTableModule} from '../components/common-table/common-table.module'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; -import { NzFormModule } from 'ng-zorro-antd/form'; -import { NzInputModule } from 'ng-zorro-antd/input'; -import { NzModalModule } from 'ng-zorro-antd/modal'; -import { NzSelectModule } from 'ng-zorro-antd/select'; -import { NzTagModule } from 'ng-zorro-antd/tag'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzCheckboxModule} from 'ng-zorro-antd/checkbox'; +import {NzFormModule} from 'ng-zorro-antd/form'; +import {NzInputModule} from 'ng-zorro-antd/input'; +import {NzModalModule} from 'ng-zorro-antd/modal'; +import {NzSelectModule} from 'ng-zorro-antd/select'; +import {NzTagModule} from 'ng-zorro-antd/tag'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; diff --git a/src/app/view/admin/admin-tag/admin-tag.component.html b/src/app/view/admin/admin-tag/admin-tag.component.html index d74047f..48205e1 100644 --- a/src/app/view/admin/admin-tag/admin-tag.component.html +++ b/src/app/view/admin/admin-tag/admin-tag.component.html @@ -1,14 +1,14 @@
- + - +
- @@ -19,7 +19,7 @@ [template]="{name:{temp:nameTemplate}}"> - +
- + - + + [text]="value"> diff --git a/src/app/view/admin/admin-tag/admin-tag.component.ts b/src/app/view/admin/admin-tag/admin-tag.component.ts index a4dac0b..2c3cced 100644 --- a/src/app/view/admin/admin-tag/admin-tag.component.ts +++ b/src/app/view/admin/admin-tag/admin-tag.component.ts @@ -1,8 +1,8 @@ import {Component, OnInit, ViewChild} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {Category, Tag} from '../../../class/Tag'; import {ApiService} from '../../../api/api.service'; -import {PageList, RequestObj} from '../../../class/HttpReqAndResp'; +import {RequestObj} from '../../../class/HttpReqAndResp'; import {Title} from '@angular/platform-browser'; import {Data} from '../components/common-table/data'; import {CommonTableComponent} from '../components/common-table/common-table.component'; @@ -15,9 +15,6 @@ import {EditableTagComponent} from '../components/editable-tag/editable-tag.comp }) export class AdminTagComponent implements OnInit { - constructor(private apiService: ApiService, private nzMessageService: NzMessageService, private title: Title, private router: Router) { - } - categoryCTData: { headData: Data[], commonTable: CommonTableComponent, request: RequestObj } = { headData: null, commonTable: null, @@ -31,8 +28,11 @@ export class AdminTagComponent implements OnInit { @ViewChild('categoryCTComponent', {static: true}) categoryCTComponent: CommonTableComponent @ViewChild('tagCTComponent', {static: true}) tagCTComponent: CommonTableComponent @ViewChild('editableTagComponent') editableTagComponent: EditableTagComponent - private updateData: any; getData: any; + private updateData: any; + + constructor(private apiService: ApiService, private nzMessageService: NzMessageService, private title: Title, private router: Router) { + } ngOnInit(): void { this.title.setTitle('小海博客 | 标签分类管理') diff --git a/src/app/view/admin/admin-tag/admin-tag.module.ts b/src/app/view/admin/admin-tag/admin-tag.module.ts index 211fd95..803afa1 100644 --- a/src/app/view/admin/admin-tag/admin-tag.module.ts +++ b/src/app/view/admin/admin-tag/admin-tag.module.ts @@ -5,10 +5,10 @@ import {AdminTagComponent} from './admin-tag.component'; import {FormsModule} from '@angular/forms'; import {CommonTableModule} from '../components/common-table/common-table.module'; import {EditableTagModule} from '../components/editable-tag/editable-tag.module'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzCardModule } from 'ng-zorro-antd/card'; -import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzTabsModule } from 'ng-zorro-antd/tabs'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzCardModule} from 'ng-zorro-antd/card'; +import {NzIconModule} from 'ng-zorro-antd/icon'; +import {NzTabsModule} from 'ng-zorro-antd/tabs'; @NgModule({ diff --git a/src/app/view/admin/admin-update/admin-update.component.html b/src/app/view/admin/admin-update/admin-update.component.html index 61c91ae..2eea2fc 100644 --- a/src/app/view/admin/admin-update/admin-update.component.html +++ b/src/app/view/admin/admin-update/admin-update.component.html @@ -1,8 +1,8 @@ - - + + - - + + diff --git a/src/app/view/admin/admin-update/admin-update.component.ts b/src/app/view/admin/admin-update/admin-update.component.ts index e8b5e79..91432da 100644 --- a/src/app/view/admin/admin-update/admin-update.component.ts +++ b/src/app/view/admin/admin-update/admin-update.component.ts @@ -1,9 +1,9 @@ import {Component, OnInit} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {Title} from '@angular/platform-browser'; import {Observable} from 'rxjs'; import {ApiService} from '../../../api/api.service'; -import {PageList, RequestObj, Response} from '../../../class/HttpReqAndResp'; +import {RequestObj, Response} from '../../../class/HttpReqAndResp'; import {UpdateInfo} from '../../../class/UpdateInfo'; import {Data} from '../components/common-table/data'; @@ -14,9 +14,6 @@ import {Data} from '../components/common-table/data'; export class AdminUpdateComponent implements OnInit { - constructor(private apiService: ApiService, private nzMessage: NzMessageService, private title: Title) { - } - modalData = { visible: false, content: null, @@ -26,6 +23,9 @@ export class AdminUpdateComponent implements OnInit { headData: Data[]; request: RequestObj; + constructor(private apiService: ApiService, private nzMessage: NzMessageService, private title: Title) { + } + ngOnInit(): void { this.title.setTitle('小海博客 | 更新信息管理') this.headData = [ diff --git a/src/app/view/admin/admin-update/admin-update.module.ts b/src/app/view/admin/admin-update/admin-update.module.ts index 04b01c7..862137c 100644 --- a/src/app/view/admin/admin-update/admin-update.module.ts +++ b/src/app/view/admin/admin-update/admin-update.module.ts @@ -5,9 +5,9 @@ import {AdminUpdateComponent} from './admin-update.component'; import {FormsModule} from '@angular/forms'; import {CommonTableModule} from '../components/common-table/common-table.module'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzInputModule } from 'ng-zorro-antd/input'; -import { NzModalModule } from 'ng-zorro-antd/modal'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzInputModule} from 'ng-zorro-antd/input'; +import {NzModalModule} from 'ng-zorro-antd/modal'; @NgModule({ diff --git a/src/app/view/admin/admin-user/admin-user.component.html b/src/app/view/admin/admin-user/admin-user.component.html index 463645f..3860bf8 100644 --- a/src/app/view/admin/admin-user/admin-user.component.html +++ b/src/app/view/admin/admin-user/admin-user.component.html @@ -1,56 +1,56 @@ - - {{value}} - {{value}} + + {{value}} + {{value}} - - {{value}} - {{value}} + + {{value}} + {{value}} - + [nzTitle]="modalData.title"> - + - 邮箱 + 邮箱 - + - 昵称 + 昵称 - + - 角色 + 角色 - - - + + + - 状态 + 状态 - - - + + + @@ -58,14 +58,14 @@ 密码 - - 重设密码 + + 重设密码 - + - @@ -75,20 +75,20 @@ 描述 - + - + - - + + diff --git a/src/app/view/admin/admin-user/admin-user.component.ts b/src/app/view/admin/admin-user/admin-user.component.ts index f7f1213..655acd7 100644 --- a/src/app/view/admin/admin-user/admin-user.component.ts +++ b/src/app/view/admin/admin-user/admin-user.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {Title} from '@angular/platform-browser'; import {FormControl, FormGroup} from '@angular/forms'; import {RequestObj} from '../../../class/HttpReqAndResp'; @@ -14,6 +14,17 @@ import {Data} from '../components/common-table/data'; }) export class AdminUserComponent implements OnInit { + user: User; + modalData = { + visible: false, + title: null, + isEdit: false, + resetPwd: false + } + formGroup: FormGroup; + headData: Data[]; + request: RequestObj; + constructor(private apiService: ApiService, private title: Title, private messageService: NzMessageService, private userService: GlobalUserService) { this.formGroup = new FormGroup({ @@ -32,18 +43,6 @@ export class AdminUserComponent implements OnInit { }) } - user: User; - modalData = { - visible: false, - title: null, - isEdit: false, - resetPwd: false - } - formGroup: FormGroup; - - headData: Data[]; - request: RequestObj; - ngOnInit(): void { this.title.setTitle('小海博客 | 用户管理') this.request = { diff --git a/src/app/view/admin/admin-user/admin-user.module.ts b/src/app/view/admin/admin-user/admin-user.module.ts index 4963b7a..4dd835b 100644 --- a/src/app/view/admin/admin-user/admin-user.module.ts +++ b/src/app/view/admin/admin-user/admin-user.module.ts @@ -4,15 +4,15 @@ import {RouterModule} from '@angular/router'; import {AdminUserComponent} from './admin-user.component'; import {ReactiveFormsModule} from '@angular/forms'; import {CommonTableModule} from '../components/common-table/common-table.module'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzFormModule } from 'ng-zorro-antd/form'; -import { NzGridModule } from 'ng-zorro-antd/grid'; -import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzInputModule } from 'ng-zorro-antd/input'; -import { NzModalModule } from 'ng-zorro-antd/modal'; -import { NzRadioModule } from 'ng-zorro-antd/radio'; -import { NzSelectModule } from 'ng-zorro-antd/select'; -import { NzTagModule } from 'ng-zorro-antd/tag'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzFormModule} from 'ng-zorro-antd/form'; +import {NzGridModule} from 'ng-zorro-antd/grid'; +import {NzIconModule} from 'ng-zorro-antd/icon'; +import {NzInputModule} from 'ng-zorro-antd/input'; +import {NzModalModule} from 'ng-zorro-antd/modal'; +import {NzRadioModule} from 'ng-zorro-antd/radio'; +import {NzSelectModule} from 'ng-zorro-antd/select'; +import {NzTagModule} from 'ng-zorro-antd/tag'; @NgModule({ diff --git a/src/app/view/admin/admin-visitor/admin-visitor.component.html b/src/app/view/admin/admin-visitor/admin-visitor.component.html index d0d75e3..0759908 100644 --- a/src/app/view/admin/admin-visitor/admin-visitor.component.html +++ b/src/app/view/admin/admin-visitor/admin-visitor.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/app/view/admin/admin-visitor/admin-visitor.component.ts b/src/app/view/admin/admin-visitor/admin-visitor.component.ts index 8d7382b..b99587f 100644 --- a/src/app/view/admin/admin-visitor/admin-visitor.component.ts +++ b/src/app/view/admin/admin-visitor/admin-visitor.component.ts @@ -11,12 +11,12 @@ import {Data} from '../components/common-table/data'; }) export class AdminVisitorComponent implements OnInit { - constructor(private apiService: ApiService, private title: Title) { - } - headData: Data[]; request: RequestObj + constructor(private apiService: ApiService, private title: Title) { + } + ngOnInit(): void { this.title.setTitle('小海博客 | 访客信息管理') this.request = { diff --git a/src/app/view/admin/admin.component.html b/src/app/view/admin/admin.component.html index 0986ab7..a1e0544 100644 --- a/src/app/view/admin/admin.component.html +++ b/src/app/view/admin/admin.component.html @@ -1,40 +1,40 @@ - -
diff --git a/src/app/view/email-verify/email-verify.component.less b/src/app/view/email-verify/email-verify.component.less index 61d37ee..8b36b7b 100644 --- a/src/app/view/email-verify/email-verify.component.less +++ b/src/app/view/email-verify/email-verify.component.less @@ -1,6 +1,6 @@ -#main{ +#main { width: 60%; height: 50px; margin: 0 auto; padding: 15% 0; -} \ No newline at end of file +} diff --git a/src/app/view/email-verify/email-verify.component.spec.ts b/src/app/view/email-verify/email-verify.component.spec.ts index 651d97d..132c905 100644 --- a/src/app/view/email-verify/email-verify.component.spec.ts +++ b/src/app/view/email-verify/email-verify.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { EmailVerifyComponent } from './email-verify.component'; +import {EmailVerifyComponent} from './email-verify.component'; describe('EmailVerifyComponent', () => { - let component: EmailVerifyComponent; - let fixture: ComponentFixture; + let component: EmailVerifyComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ EmailVerifyComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [EmailVerifyComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(EmailVerifyComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(EmailVerifyComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/email-verify/email-verify.component.ts b/src/app/view/email-verify/email-verify.component.ts index b24cbc6..1fe4df4 100644 --- a/src/app/view/email-verify/email-verify.component.ts +++ b/src/app/view/email-verify/email-verify.component.ts @@ -10,6 +10,12 @@ import {Title} from '@angular/platform-browser'; }) export class EmailVerifyComponent implements OnInit { + type: string = 'info'; + message: string = '正在验证,请稍等'; + desc: string = ''; + private email: string; + private verifyId: string; + constructor(private titleService: Title, private router: Router, public routerinfo: ActivatedRoute, @@ -17,14 +23,6 @@ export class EmailVerifyComponent implements OnInit { 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; diff --git a/src/app/view/email-verify/email-verify.module.ts b/src/app/view/email-verify/email-verify.module.ts index d8ebf14..fde70e8 100644 --- a/src/app/view/email-verify/email-verify.module.ts +++ b/src/app/view/email-verify/email-verify.module.ts @@ -2,7 +2,7 @@ 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/alert'; +import {NzAlertModule} from 'ng-zorro-antd/alert'; const routes: Route[] = [ {path: '**', component: EmailVerifyComponent} diff --git a/src/app/view/index/components/article-detail-card/article-detail-card.component.html b/src/app/view/index/components/article-detail-card/article-detail-card.component.html index e36f017..1deb720 100644 --- a/src/app/view/index/components/article-detail-card/article-detail-card.component.html +++ b/src/app/view/index/components/article-detail-card/article-detail-card.component.html @@ -1,19 +1,19 @@ - +

{{data.title}}

- + {{data.original ? '原创' : '转载'}} - + {{data.publishDateFormat}} - + {{data.author.displayName}} - + {{data.category}} @@ -21,13 +21,13 @@

{{data.summary}}

- 阅读更多 + 阅读更多 diff --git a/src/app/view/index/components/article-detail-card/article-detail-card.component.spec.ts b/src/app/view/index/components/article-detail-card/article-detail-card.component.spec.ts index 968c7a7..881fc69 100644 --- a/src/app/view/index/components/article-detail-card/article-detail-card.component.spec.ts +++ b/src/app/view/index/components/article-detail-card/article-detail-card.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { ArticleDetailCardComponent } from './article-detail-card.component'; +import {ArticleDetailCardComponent} from './article-detail-card.component'; describe('ArticleDetailCardComponent', () => { - let component: ArticleDetailCardComponent; - let fixture: ComponentFixture; + let component: ArticleDetailCardComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ArticleDetailCardComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ArticleDetailCardComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(ArticleDetailCardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ArticleDetailCardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/index/components/article-detail-card/article-detail-card.component.ts b/src/app/view/index/components/article-detail-card/article-detail-card.component.ts index e883619..148c3cd 100644 --- a/src/app/view/index/components/article-detail-card/article-detail-card.component.ts +++ b/src/app/view/index/components/article-detail-card/article-detail-card.component.ts @@ -1,6 +1,5 @@ import {Component, Input, OnInit} from '@angular/core'; import {Article} from '../../../../class/Article'; -import {ColorList} from '../../../../utils/color'; @Component({ selector: 'c-article-detail-card', @@ -9,13 +8,13 @@ import {ColorList} from '../../../../utils/color'; }) export class ArticleDetailCardComponent implements OnInit { - constructor() { - } - @Input() data: Article; @Input() showMediaArea: boolean; @Input() showTagArea: boolean; + constructor() { + } + ngOnInit() { if (this.data == null || this.data.id == null) { throw Error('data 不可为空'); diff --git a/src/app/view/index/components/card-detail/card-detail.component.spec.ts b/src/app/view/index/components/card-detail/card-detail.component.spec.ts index 15003f1..b05c477 100644 --- a/src/app/view/index/components/card-detail/card-detail.component.spec.ts +++ b/src/app/view/index/components/card-detail/card-detail.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { CardDetailComponent } from './card-detail.component'; +import {CardDetailComponent} from './card-detail.component'; describe('CardDetailComponent', () => { - let component: CardDetailComponent; - let fixture: ComponentFixture; + let component: CardDetailComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CardDetailComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CardDetailComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(CardDetailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(CardDetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/index/components/card-detail/card-detail.component.ts b/src/app/view/index/components/card-detail/card-detail.component.ts index 803eaa2..9a5e7d7 100644 --- a/src/app/view/index/components/card-detail/card-detail.component.ts +++ b/src/app/view/index/components/card-detail/card-detail.component.ts @@ -7,11 +7,11 @@ import {Component, Input, OnInit} from '@angular/core'; }) export class CardDetailComponent implements OnInit { + @Input() title: string; + constructor() { } - @Input() title: string; - // @ContentChildren() c:T; ngOnInit() { diff --git a/src/app/view/index/components/tag-tag/tag-tag.component.html b/src/app/view/index/components/tag-tag/tag-tag.component.html index 2e62ae1..b78b4d2 100644 --- a/src/app/view/index/components/tag-tag/tag-tag.component.html +++ b/src/app/view/index/components/tag-tag/tag-tag.component.html @@ -1,19 +1,19 @@ -
- + {{tag.name}} - {{tag.size}} diff --git a/src/app/view/index/components/tag-tag/tag-tag.component.spec.ts b/src/app/view/index/components/tag-tag/tag-tag.component.spec.ts index 038b6fe..d65cd93 100644 --- a/src/app/view/index/components/tag-tag/tag-tag.component.spec.ts +++ b/src/app/view/index/components/tag-tag/tag-tag.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { TagTagComponent } from './tag-tag.component'; +import {TagTagComponent} from './tag-tag.component'; describe('TagTagComponent', () => { - let component: TagTagComponent; - let fixture: ComponentFixture; + let component: TagTagComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ TagTagComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TagTagComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(TagTagComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(TagTagComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/index/components/tag-tag/tag-tag.component.ts b/src/app/view/index/components/tag-tag/tag-tag.component.ts index c3f38e3..ab7e870 100644 --- a/src/app/view/index/components/tag-tag/tag-tag.component.ts +++ b/src/app/view/index/components/tag-tag/tag-tag.component.ts @@ -9,17 +9,16 @@ import {Router} from '@angular/router'; }) export class TagTagComponent implements OnInit { - constructor(private router: Router) { - } - @Input() tag: { name: string, size: number }; @Input() size: 'default' | 'large' = 'default'; @Input() clickable: boolean; // default true @Input() enableCount: boolean; // default true @Output() tagClick = new EventEmitter(); - randColor: { bgColor: string, fontColor: string }; + constructor(private router: Router) { + } + ngOnInit() { const randomNumber = Math.floor(ColorList.length * Math.random()); this.randColor = ColorList[randomNumber]; diff --git a/src/app/view/index/index.component.html b/src/app/view/index/index.component.html index 36aed82..1d5853c 100644 --- a/src/app/view/index/index.component.html +++ b/src/app/view/index/index.component.html @@ -1,83 +1,83 @@ -
-
+
+
- + [nzTotal]="articles.total" + style="text-align: center">
-
+
- pic + pic
-

郑 海

+

郑 海

Location : 武汉

-

- Github : link>> +

+ Github : link>>

- +
- +
-
- +
+
-
- +
+
- +

- 文章总数: {{counts.articleCount}}篇 + 文章总数: {{counts.articleCount}}篇

- 分类总数: {{counts.categoryCount}}个 + 分类总数: {{counts.categoryCount}}个

- 标签总数: {{counts.tagCount}}个 + 标签总数: {{counts.tagCount}}个

- 访客总数: {{counts.visitorCount}}次 + 访客总数: {{counts.visitorCount}}次

- 上次更新时间: {{lastestUpdate.lastUpdateTime}} + 上次更新时间: {{lastestUpdate.lastUpdateTime}}

- 上次提交代码时间: {{lastestUpdate.committerDate}} + 上次提交代码时间: {{lastestUpdate.committerDate}}

diff --git a/src/app/view/index/index.component.spec.ts b/src/app/view/index/index.component.spec.ts index 0312242..6adf55f 100644 --- a/src/app/view/index/index.component.spec.ts +++ b/src/app/view/index/index.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { IndexComponent } from './index.component'; +import {IndexComponent} from './index.component'; describe('IndexComponent', () => { - let component: IndexComponent; - let fixture: ComponentFixture; + let component: IndexComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ IndexComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [IndexComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(IndexComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(IndexComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/index/index.component.ts b/src/app/view/index/index.component.ts index fbacddb..307e4df 100644 --- a/src/app/view/index/index.component.ts +++ b/src/app/view/index/index.component.ts @@ -1,8 +1,8 @@ import {Component, OnInit} from '@angular/core'; import {ApiService} from '../../api/api.service'; import {Article} from '../../class/Article'; -import { NzIconService } from 'ng-zorro-antd/icon'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzIconService} from 'ng-zorro-antd/icon'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {SvgIconUtil} from '../../utils/svgIconUtil'; import {PageList, RequestObj} from '../../class/HttpReqAndResp'; import {Router} from '@angular/router'; @@ -17,19 +17,9 @@ import {Title} from '@angular/platform-browser'; }) export class IndexComponent implements OnInit { - constructor(private apiService: ApiService, - private iconService: NzIconService, - private nzMessageService: NzMessageService, - private router: Router, - private title: Title) { - this.iconService.addIconLiteral('blog:location', SvgIconUtil.locationIcon); - title.setTitle('小海博客'); - } - readonly logoImgUrl: string = 'https://56462271.oss-cn-beijing.aliyuncs.com/web/logo.png'; readonly qqQrImgUrl: string = 'https://56462271.oss-cn-beijing.aliyuncs.com/web/qq.jpg'; readonly wxQrImgUrl: string = 'https://56462271.oss-cn-beijing.aliyuncs.com/web/wx.jpg'; - imgUrl: string; desc: string; articles: PageList
; @@ -51,6 +41,15 @@ export class IndexComponent implements OnInit { commitUrl: string }; + constructor(private apiService: ApiService, + private iconService: NzIconService, + private nzMessageService: NzMessageService, + private router: Router, + private title: Title) { + this.iconService.addIconLiteral('blog:location', SvgIconUtil.locationIcon); + title.setTitle('小海博客'); + } + ngOnInit() { this.imgUrl = this.logoImgUrl; this.desc = '一个爱好瞎捣鼓的技术宅 :)\n欢迎一起来探讨学习。'; diff --git a/src/app/view/index/index.module.ts b/src/app/view/index/index.module.ts index a33b468..01f01e8 100644 --- a/src/app/view/index/index.module.ts +++ b/src/app/view/index/index.module.ts @@ -3,15 +3,15 @@ import {CommonModule} from '@angular/common'; import {IndexComponent} from './index.component'; import {IndexRoutingModule} from './index-routing.module'; import {ArticleDetailCardComponent} from './components/article-detail-card/article-detail-card.component'; -import { NzBackTopModule } from 'ng-zorro-antd/back-top'; -import { NzCardModule } from 'ng-zorro-antd/card'; -import { NzDividerModule } from 'ng-zorro-antd/divider'; -import { NzGridModule } from 'ng-zorro-antd/grid'; -import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzPaginationModule } from 'ng-zorro-antd/pagination'; -import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; -import { CardDetailComponent } from './components/card-detail/card-detail.component'; -import { TagTagComponent } from './components/tag-tag/tag-tag.component'; +import {NzBackTopModule} from 'ng-zorro-antd/back-top'; +import {NzCardModule} from 'ng-zorro-antd/card'; +import {NzDividerModule} from 'ng-zorro-antd/divider'; +import {NzGridModule} from 'ng-zorro-antd/grid'; +import {NzIconModule} from 'ng-zorro-antd/icon'; +import {NzPaginationModule} from 'ng-zorro-antd/pagination'; +import {NzToolTipModule} from 'ng-zorro-antd/tooltip'; +import {CardDetailComponent} from './components/card-detail/card-detail.component'; +import {TagTagComponent} from './components/tag-tag/tag-tag.component'; @NgModule({ diff --git a/src/app/view/leave-msg/leave-msg.component.spec.ts b/src/app/view/leave-msg/leave-msg.component.spec.ts index 4e46aa4..fba3c81 100644 --- a/src/app/view/leave-msg/leave-msg.component.spec.ts +++ b/src/app/view/leave-msg/leave-msg.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { LeaveMsgComponent } from './leave-msg.component'; +import {LeaveMsgComponent} from './leave-msg.component'; describe('LeaveMsgComponent', () => { - let component: LeaveMsgComponent; - let fixture: ComponentFixture; + let component: LeaveMsgComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ LeaveMsgComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [LeaveMsgComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(LeaveMsgComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(LeaveMsgComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/leave-msg/leave-msg.component.ts b/src/app/view/leave-msg/leave-msg.component.ts index 9a04a60..ee50a63 100644 --- a/src/app/view/leave-msg/leave-msg.component.ts +++ b/src/app/view/leave-msg/leave-msg.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'view-leave-msg', - templateUrl: './leave-msg.component.html', - styleUrls: ['./leave-msg.component.less'] + selector: 'view-leave-msg', + templateUrl: './leave-msg.component.html', + styleUrls: ['./leave-msg.component.less'] }) export class LeaveMsgComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit() { - } + ngOnInit() { + } } diff --git a/src/app/view/link/link.component.html b/src/app/view/link/link.component.html index a337b4a..46c40a9 100644 --- a/src/app/view/link/link.component.html +++ b/src/app/view/link/link.component.html @@ -1,20 +1,20 @@
- 友链公告 + 友链公告

@@ -50,18 +50,18 @@

- +

申请友链

- + 网站名称 - - + +
网站名称不可为空
最大长度为255
@@ -70,8 +70,8 @@
站长邮箱 - - + +
站长邮箱不可为空
邮箱格式不正确
@@ -81,7 +81,7 @@ 首页链接 - + @@ -89,7 +89,7 @@ - +
首页链接不可为空
链接格式不正确
@@ -99,7 +99,7 @@
友链页链接 - + @@ -107,7 +107,7 @@ - +
首页链接不可为空
链接格式不正确
@@ -117,28 +117,28 @@
网站图标 - + - + - icon + icon 网站描述 - - + +
- - + diff --git a/src/app/view/link/link.component.less b/src/app/view/link/link.component.less index c56f126..e22e397 100644 --- a/src/app/view/link/link.component.less +++ b/src/app/view/link/link.component.less @@ -171,9 +171,10 @@ i { width: 96%; } - .partner-sites{ + .partner-sites { padding: 0 30px; } + .partner-sites li { float: left; width: 100%; diff --git a/src/app/view/link/link.component.spec.ts b/src/app/view/link/link.component.spec.ts index 94fbc6b..0f9fc6b 100644 --- a/src/app/view/link/link.component.spec.ts +++ b/src/app/view/link/link.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { LinkComponent } from './link.component'; +import {LinkComponent} from './link.component'; describe('LinkComponent', () => { - let component: LinkComponent; - let fixture: ComponentFixture; + let component: LinkComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ LinkComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [LinkComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(LinkComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(LinkComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/link/link.component.ts b/src/app/view/link/link.component.ts index 0d5e248..2e72145 100644 --- a/src/app/view/link/link.component.ts +++ b/src/app/view/link/link.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; -import { NzModalService } from 'ng-zorro-antd/modal'; +import {NzMessageService} from 'ng-zorro-antd/message'; +import {NzModalService} from 'ng-zorro-antd/modal'; import {Title} from '@angular/platform-browser'; import {ApiService} from '../../api/api.service'; import {ApplyLinkReq, Link} from '../../class/Link'; @@ -14,6 +14,15 @@ import {Color, RandomColor} from '../../utils/color'; }) export class LinkComponent implements OnInit { + showModal = false; + // 申请时的链接 + link: Link; + linkList: Link[]; + loading: boolean = false; + applyFormGroup: FormGroup; + colors: Color[]; + private lastUrl: string = ''; + constructor(private message: NzMessageService, private titleService: Title, private apiService: ApiService, @@ -22,18 +31,6 @@ export class LinkComponent implements OnInit { titleService.setTitle('小海博客 | 友链'); } - showModal = false; - - // 申请时的链接 - link: Link; - - linkList: Link[]; - loading: boolean = false; - applyFormGroup: FormGroup; - colors: Color[]; - private lastUrl: string = ''; - - ngOnInit() { window.scrollTo(0, 0); this.link = new Link(); diff --git a/src/app/view/link/link.module.ts b/src/app/view/link/link.module.ts index 5992b9a..350b57e 100644 --- a/src/app/view/link/link.module.ts +++ b/src/app/view/link/link.module.ts @@ -1,12 +1,12 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {LinkComponent} from './link.component'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzFormModule } from 'ng-zorro-antd/form'; -import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzInputModule } from 'ng-zorro-antd/input'; -import { NzModalModule } from 'ng-zorro-antd/modal'; -import { NzSelectModule } from 'ng-zorro-antd/select'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzFormModule} from 'ng-zorro-antd/form'; +import {NzIconModule} from 'ng-zorro-antd/icon'; +import {NzInputModule} from 'ng-zorro-antd/input'; +import {NzModalModule} from 'ng-zorro-antd/modal'; +import {NzSelectModule} from 'ng-zorro-antd/select'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; diff --git a/src/app/view/login-registration/service/login-registration.service.spec.ts b/src/app/view/login-registration/service/login-registration.service.spec.ts index 86dcec2..75cd1d5 100644 --- a/src/app/view/login-registration/service/login-registration.service.spec.ts +++ b/src/app/view/login-registration/service/login-registration.service.spec.ts @@ -1,16 +1,16 @@ -import { TestBed } from '@angular/core/testing'; +import {TestBed} from '@angular/core/testing'; -import { LoginRegistrationService } from './login-registration.service'; +import {LoginRegistrationService} from './login-registration.service'; describe('LoginRegistrationService', () => { - let service: LoginRegistrationService; + let service: LoginRegistrationService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(LoginRegistrationService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(LoginRegistrationService); + }); - it('should be created', () => { - expect(service).toBeTruthy(); - }); + it('should be created', () => { + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/view/login-registration/service/login-registration.service.ts b/src/app/view/login-registration/service/login-registration.service.ts index b618033..6469b17 100644 --- a/src/app/view/login-registration/service/login-registration.service.ts +++ b/src/app/view/login-registration/service/login-registration.service.ts @@ -5,8 +5,8 @@ import {Injectable} from '@angular/core'; }) export class LoginRegistrationService { + showModal: boolean = false; + constructor() { } - - showModal: boolean = false; } diff --git a/src/app/view/maintain/maintain.module.ts b/src/app/view/maintain/maintain.module.ts index 43c9794..67fc81e 100644 --- a/src/app/view/maintain/maintain.module.ts +++ b/src/app/view/maintain/maintain.module.ts @@ -2,8 +2,8 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MaintainComponent} from './maintain.component'; import {RouterModule} from '@angular/router'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzResultModule } from 'ng-zorro-antd/result'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzResultModule} from 'ng-zorro-antd/result'; @NgModule({ diff --git a/src/app/view/page-not-found/page-not-found.component.less b/src/app/view/page-not-found/page-not-found.component.less index 34d739e..c605006 100644 --- a/src/app/view/page-not-found/page-not-found.component.less +++ b/src/app/view/page-not-found/page-not-found.component.less @@ -1,4 +1,4 @@ -div{ +div { margin: 0; padding: 0; border: 0; @@ -44,9 +44,9 @@ a { font-style: italic } -@media only screen and (max-width:768px) { +@media only screen and (max-width: 768px) { .error404 { width: 100%; background: url(../../../assets/img/404-m.jpg) -10px; } -} \ No newline at end of file +} diff --git a/src/app/view/page-not-found/page-not-found.component.spec.ts b/src/app/view/page-not-found/page-not-found.component.spec.ts index 697a946..176ad1e 100644 --- a/src/app/view/page-not-found/page-not-found.component.spec.ts +++ b/src/app/view/page-not-found/page-not-found.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { PageNotFoundComponent } from './page-not-found.component'; +import {PageNotFoundComponent} from './page-not-found.component'; describe('PageNotFoundComponent', () => { - let component: PageNotFoundComponent; - let fixture: ComponentFixture; + let component: PageNotFoundComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PageNotFoundComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PageNotFoundComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(PageNotFoundComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PageNotFoundComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/reset-pwd/reset-pwd.component.html b/src/app/view/reset-pwd/reset-pwd.component.html index a5da41d..772584f 100644 --- a/src/app/view/reset-pwd/reset-pwd.component.html +++ b/src/app/view/reset-pwd/reset-pwd.component.html @@ -1,14 +1,14 @@
- +
- - + +
-
\ No newline at end of file +
diff --git a/src/app/view/reset-pwd/reset-pwd.component.spec.ts b/src/app/view/reset-pwd/reset-pwd.component.spec.ts index fc79c9c..39fac37 100644 --- a/src/app/view/reset-pwd/reset-pwd.component.spec.ts +++ b/src/app/view/reset-pwd/reset-pwd.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { ResetPwdComponent } from './reset-pwd.component'; +import {ResetPwdComponent} from './reset-pwd.component'; describe('ResetPwdComponent', () => { - let component: ResetPwdComponent; - let fixture: ComponentFixture; + let component: ResetPwdComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ResetPwdComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ResetPwdComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(ResetPwdComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ResetPwdComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/reset-pwd/reset-pwd.component.ts b/src/app/view/reset-pwd/reset-pwd.component.ts index 300c661..de6f828 100644 --- a/src/app/view/reset-pwd/reset-pwd.component.ts +++ b/src/app/view/reset-pwd/reset-pwd.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {ActivatedRoute, Router} from '@angular/router'; import {ApiService} from '../../api/api.service'; import {Title} from '@angular/platform-browser'; @@ -11,6 +11,12 @@ import {Title} from '@angular/platform-browser'; }) export class ResetPwdComponent implements OnInit { + pwd: string; + rePwd: string; + iserror: boolean = false; + private email: string; + private verifyId: string; + constructor(private message: NzMessageService, private router: Router, private routerinfo: ActivatedRoute, @@ -19,14 +25,6 @@ export class ResetPwdComponent implements OnInit { this.title.setTitle('小海博客 | 重置密码 '); } - pwd: string; - rePwd: string; - - private email: string; - private verifyId: string; - - iserror: boolean = false; - ngOnInit(): void { this.email = this.routerinfo.snapshot.queryParams.email; this.verifyId = this.routerinfo.snapshot.queryParams.verifyId; diff --git a/src/app/view/reset-pwd/reset-pwd.module.ts b/src/app/view/reset-pwd/reset-pwd.module.ts index 57b4667..da1253b 100644 --- a/src/app/view/reset-pwd/reset-pwd.module.ts +++ b/src/app/view/reset-pwd/reset-pwd.module.ts @@ -2,7 +2,7 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {Route, RouterModule} from '@angular/router'; import {ResetPwdComponent} from './reset-pwd.component'; -import { NzAlertModule } from 'ng-zorro-antd/alert'; +import {NzAlertModule} from 'ng-zorro-antd/alert'; import {FormsModule} from '@angular/forms'; const routes: Route[] = [ diff --git a/src/app/view/tag/tag.component.html b/src/app/view/tag/tag.component.html index 7b986f1..2a47ca3 100644 --- a/src/app/view/tag/tag.component.html +++ b/src/app/view/tag/tag.component.html @@ -1,9 +1,9 @@
    - +
@@ -14,7 +14,7 @@ {{name}} -
    +
      diff --git a/src/app/view/tag/tag.component.spec.ts b/src/app/view/tag/tag.component.spec.ts index b70f018..c6d1133 100644 --- a/src/app/view/tag/tag.component.spec.ts +++ b/src/app/view/tag/tag.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { TagComponent } from './tag.component'; +import {TagComponent} from './tag.component'; describe('TagComponent', () => { - let component: TagComponent; - let fixture: ComponentFixture; + let component: TagComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ TagComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TagComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(TagComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(TagComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/tag/tag.component.ts b/src/app/view/tag/tag.component.ts index d40422f..10c9ca0 100644 --- a/src/app/view/tag/tag.component.ts +++ b/src/app/view/tag/tag.component.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {PageList} from '../../class/HttpReqAndResp'; import {Article} from '../../class/Article'; import {ApiService} from '../../api/api.service'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {Location} from '@angular/common'; import {ActivatedRoute} from '@angular/router'; import {Title} from '@angular/platform-browser'; @@ -14,6 +14,11 @@ import {Title} from '@angular/platform-browser'; }) export class TagComponent implements OnInit { + tagList: { name: string, size: number } [] = []; + articleList: PageList
      ; + name: string; + private tag: { name: string, size: number }; + constructor(private apiService: ApiService, private nzMessageService: NzMessageService, private location: Location, @@ -21,12 +26,6 @@ export class TagComponent implements OnInit { private title: Title) { } - tagList: { name: string, size: number } [] = []; - private tag: { name: string, size: number }; - articleList: PageList
      ; - - name: string; - ngOnInit() { this.name = this.activatedRoute.snapshot.paramMap.get('tag'); this.getTags(this.name == null); diff --git a/src/app/view/update/update.component.html b/src/app/view/update/update.component.html index 7f7f983..0bebbae 100644 --- a/src/app/view/update/update.component.html +++ b/src/app/view/update/update.component.html @@ -4,7 +4,7 @@
      -
      +

      更新日志

      最后更新于: {{lastUpdate.lastUpdateTime}} @@ -17,11 +17,11 @@

      最后提交内容: - {{lastUpdate.lastCommit}} + {{lastUpdate.lastCommit}} By - {{lastUpdate.committerAuthor}} + {{lastUpdate.committerAuthor}}

      @@ -33,7 +33,7 @@

      -
      +

      # {{update.time}}

      diff --git a/src/app/view/update/update.component.less b/src/app/view/update/update.component.less index 184a26b..c443aa4 100644 --- a/src/app/view/update/update.component.less +++ b/src/app/view/update/update.component.less @@ -1,9 +1,11 @@ nz-tag { text-indent: initial; } -.pointer{ + +.pointer { cursor: pointer; } + @media screen and (min-width: 768px) { .site-inner { margin: 0 19%; @@ -121,7 +123,7 @@ nz-tag { .container { padding-left: 1.5rem; - padding-right: 1.5 r + padding-right: 1.5rem } #app { diff --git a/src/app/view/update/update.component.spec.ts b/src/app/view/update/update.component.spec.ts index 372dc78..01c1bad 100644 --- a/src/app/view/update/update.component.spec.ts +++ b/src/app/view/update/update.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { UpdateComponent } from './update.component'; +import {UpdateComponent} from './update.component'; describe('UpdateComponent', () => { - let component: UpdateComponent; - let fixture: ComponentFixture; + let component: UpdateComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ UpdateComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [UpdateComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(UpdateComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(UpdateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/update/update.component.ts b/src/app/view/update/update.component.ts index 1953fc5..9c08db9 100644 --- a/src/app/view/update/update.component.ts +++ b/src/app/view/update/update.component.ts @@ -9,21 +9,21 @@ import {Title} from '@angular/platform-browser'; }) export class UpdateComponent implements OnInit { - constructor(private titleService: Title, - private apiService: ApiService) { - titleService.setTitle('小海博客 | 网站更新记录'); - } - lastUpdate: { lastUpdateTime: string; lastUpdateInfo: string; lastCommit: string; committerAuthor: string; committerDate: string; - commitUrl:string - } ; + commitUrl: string + }; webUpdate: { id: number, info: string, time: string }[] = []; + constructor(private titleService: Title, + private apiService: ApiService) { + titleService.setTitle('小海博客 | 网站更新记录'); + } + ngOnInit() { this.apiService.lastestUpdate().subscribe(data => { this.lastUpdate = data.result; diff --git a/src/app/view/update/update.module.ts b/src/app/view/update/update.module.ts index 3f93cf3..3586a97 100644 --- a/src/app/view/update/update.module.ts +++ b/src/app/view/update/update.module.ts @@ -2,7 +2,7 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {UpdateComponent} from './update.component'; import {Route, RouterModule} from '@angular/router'; -import { NzTagModule } from 'ng-zorro-antd/tag'; +import {NzTagModule} from 'ng-zorro-antd/tag'; const routes: Route[] = [{path: '**', component: UpdateComponent}]; diff --git a/src/app/view/write/components/publish-form/publish-form.component.html b/src/app/view/write/components/publish-form/publish-form.component.html index 5c96346..d26d4c5 100644 --- a/src/app/view/write/components/publish-form/publish-form.component.html +++ b/src/app/view/write/components/publish-form/publish-form.component.html @@ -1,11 +1,11 @@ -
      + 发布为 - + - - + + @@ -13,10 +13,10 @@ 文章类型 - - - - + + + + @@ -24,10 +24,10 @@ 文章分类 - - - + + + @@ -35,13 +35,13 @@ 原文链接 - + - + - +
      - 文章标签 - + 文章标签 + - {{t}} + {{t}}
      - + [text]="editTagText" + size="small">
      未选择或添加标签 - - + + [nzMode]="(tagTmpList?.length<5||tagTmpList?.indexOf(tag.name) > -1)?'checkable':'default'" + style="margin: 4px; border: 1px dashed #6A6A6A;user-select: none"> {{ tag.name }} @@ -88,8 +88,8 @@
      - diff --git a/src/app/view/write/components/publish-form/publish-form.component.spec.ts b/src/app/view/write/components/publish-form/publish-form.component.spec.ts index 62398ef..0d37bdb 100644 --- a/src/app/view/write/components/publish-form/publish-form.component.spec.ts +++ b/src/app/view/write/components/publish-form/publish-form.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { TestComponent } from './publish-form.component'; +import {TestComponent} from './publish-form.component'; describe('TestComponent', () => { - let component: TestComponent; - let fixture: ComponentFixture; + let component: TestComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ TestComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TestComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(TestComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/write/components/publish-form/publish-form.component.ts b/src/app/view/write/components/publish-form/publish-form.component.ts index a86098a..489af0b 100644 --- a/src/app/view/write/components/publish-form/publish-form.component.ts +++ b/src/app/view/write/components/publish-form/publish-form.component.ts @@ -1,6 +1,6 @@ import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -import {Category, Tag} from '../../../../class/Tag'; +import {Category} from '../../../../class/Tag'; import {ColorList} from '../../../../utils/color' @Component({ @@ -10,11 +10,7 @@ import {ColorList} from '../../../../utils/color' }) export class PublishFormComponent implements OnInit { - constructor(private fb: FormBuilder) { - } - @ViewChild('inputElement', {static: true}) tagInputElement: ElementRef; - @Input() tagNacList: { name: string, size: number }[]; @Input() categoryList: Category[]; @Input() primaryData: { id: number, type: boolean, tags: string[], category: string, url?: string }; @@ -26,14 +22,16 @@ export class PublishFormComponent implements OnInit { isUpdate: boolean, url?: string }>(); - formGroup: FormGroup; tagTmpList: string[] = []; tagInputVisible: boolean = false; tagListTouched: boolean = false; editTagText: string = '新增'; - color: string[] = []; + + constructor(private fb: FormBuilder) { + } + randomColor = () => this.color = ColorList.map(c => c.bgColor).sort(() => Math.floor(Math.random() * 2)); ngOnInit(): void { diff --git a/src/app/view/write/write.component.html b/src/app/view/write/write.component.html index 57e9328..03edfd4 100644 --- a/src/app/view/write/write.component.html +++ b/src/app/view/write/write.component.html @@ -1,21 +1,21 @@
      - - + +
      - +

      文章发布

      - + diff --git a/src/app/view/write/write.component.spec.ts b/src/app/view/write/write.component.spec.ts index cc358f8..a82c056 100644 --- a/src/app/view/write/write.component.spec.ts +++ b/src/app/view/write/write.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { WriteComponent } from './write.component'; +import {WriteComponent} from './write.component'; describe('WriteComponent', () => { - let component: WriteComponent; - let fixture: ComponentFixture; + let component: WriteComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ WriteComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [WriteComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(WriteComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(WriteComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/view/write/write.component.ts b/src/app/view/write/write.component.ts index 35788de..59ef179 100644 --- a/src/app/view/write/write.component.ts +++ b/src/app/view/write/write.component.ts @@ -2,7 +2,7 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {ArticleReq} from '../../class/Article'; import {ActivatedRoute, Router} from '@angular/router'; import {ApiService} from '../../api/api.service'; -import { NzMessageService } from 'ng-zorro-antd/message'; +import {NzMessageService} from 'ng-zorro-antd/message'; import {User} from '../../class/User'; import {Tag} from '../../class/Tag'; import {Title} from '@angular/platform-browser'; @@ -19,6 +19,20 @@ import {Response} from '../../class/HttpReqAndResp'; }) export class WriteComponent implements OnInit, OnDestroy { + modalVisible: boolean = false; + articleId: number; + isUpdate = false; + vditor: Vditor; + public article: ArticleReq = new ArticleReq(); + userInfo: User; + categoryList: Tag[]; + tagNacList: { name: string, size: number }[]; + primaryData = null; + // 发布新文章时,文章相同会被拦回 此处判断一下 + title: string; + private lastShowTime: number; + private userInfoSub: { unsubscribe: () => void } + constructor(private router: Router, private activatedRoute: ActivatedRoute, private apiService: ApiService, @@ -29,23 +43,6 @@ export class WriteComponent implements OnInit, OnDestroy { this.titleService.setTitle('小海博客 | 创作'); } - modalVisible: boolean = false; - articleId: number; - isUpdate = false; - vditor: Vditor; - - public article: ArticleReq = new ArticleReq(); - - userInfo: User; - categoryList: Tag[]; - tagNacList: { name: string, size: number }[]; - primaryData = null; - // 发布新文章时,文章相同会被拦回 此处判断一下 - title: string; - - private lastShowTime: number; - private userInfoSub: { unsubscribe: () => void } - ngOnInit(): void { this.vditor = new Vditor('vditor', this.initOption()); // 用户权限判断 diff --git a/src/app/view/write/write.module.ts b/src/app/view/write/write.module.ts index f569c83..c2a11a6 100644 --- a/src/app/view/write/write.module.ts +++ b/src/app/view/write/write.module.ts @@ -4,16 +4,16 @@ import {WriteComponent} from './write.component'; import {Route, RouterModule} from '@angular/router'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {PublishFormComponent} from './components/publish-form/publish-form.component'; -import { NzButtonModule } from 'ng-zorro-antd/button'; -import { NzCardModule } from 'ng-zorro-antd/card'; -import { NzDividerModule } from 'ng-zorro-antd/divider'; -import { NzFormModule } from 'ng-zorro-antd/form'; -import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzInputModule } from 'ng-zorro-antd/input'; -import { NzModalModule } from 'ng-zorro-antd/modal'; -import { NzRadioModule } from 'ng-zorro-antd/radio'; -import { NzSelectModule } from 'ng-zorro-antd/select'; -import { NzTagModule } from 'ng-zorro-antd/tag'; +import {NzButtonModule} from 'ng-zorro-antd/button'; +import {NzCardModule} from 'ng-zorro-antd/card'; +import {NzDividerModule} from 'ng-zorro-antd/divider'; +import {NzFormModule} from 'ng-zorro-antd/form'; +import {NzIconModule} from 'ng-zorro-antd/icon'; +import {NzInputModule} from 'ng-zorro-antd/input'; +import {NzModalModule} from 'ng-zorro-antd/modal'; +import {NzRadioModule} from 'ng-zorro-antd/radio'; +import {NzSelectModule} from 'ng-zorro-antd/select'; +import {NzTagModule} from 'ng-zorro-antd/tag'; import {EditableTagModule} from '../admin/components/editable-tag/editable-tag.module'; const routes: Route[] = [