展示最近的提交记录

This commit is contained in:
小海
2020-04-23 17:29:47 +08:00
parent 1f4b447a74
commit 3cd3ca7afc
5 changed files with 54 additions and 10 deletions

View File

@@ -330,9 +330,16 @@ export class ApiService extends HttpService {
});
}
lastestUpdateTime() {
return super.Service<string>({
path: '/lastestUpdateTime',
lastestUpdate() {
return super.Service<{
lastUpdateTime: string;
lastUpdateInfo: string;
lastCommit: string;
committerAuthor: string;
committerDate: string;
commitUrl: string
}>({
path: '/lastestUpdate',
method: 'GET'
});
}

View File

@@ -4,9 +4,31 @@
<div class="container">
<div class="zh-update">
<div class="zh-update-log">
<div class="zh-update-log-title">
<div class="zh-update-log-title" *ngIf="lastUpdate">
<h1>更新日志</h1>
<p>最后更新于 {{lastUpdateTime}}</p>
<p>最后更新于:
<nz-tag nzColor="red">{{lastUpdate.lastUpdateTime}}</nz-tag>
</p>
<p>最后更新内容:
<nz-tag nzColor="volcano">{{lastUpdate.lastUpdateInfo}}</nz-tag>
</p>
<p>最后提交代码于:
<nz-tag nzColor="purple">{{lastUpdate.committerDate}}</nz-tag>
</p>
<p>最后提交内容:
<a [href]="lastUpdate.commitUrl" target="_blank">
<nz-tag nzColor="#f50" class="pointer">{{lastUpdate.lastCommit}}</nz-tag>
</a>
By
<a href="https://github.com/xiaohai2271" target="_blank">
<nz-tag nzColor="cyan" class="pointer">{{lastUpdate.committerAuthor}}</nz-tag>
</a>
</p>
<p>
<span>最后构建状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<img alt="build Status"
src="https://img.shields.io/github/workflow/status/xiaohai2271/blog-frontEnd/Node.js CI">
</p>
</div>
<div class="zh-update-log-content">
@@ -30,4 +52,4 @@
</div>
</div>
</div>
</div>

View File

@@ -1,3 +1,9 @@
nz-tag {
text-indent: initial;
}
.pointer{
cursor: pointer;
}
@media screen and (min-width: 768px) {
.site-inner {
margin: 0 19%;

View File

@@ -14,12 +14,19 @@ export class UpdateComponent implements OnInit {
titleService.setTitle('小海博客 | 网站更新记录');
}
lastUpdateTime: string;
lastUpdate: {
lastUpdateTime: string;
lastUpdateInfo: string;
lastCommit: string;
committerAuthor: string;
committerDate: string;
commitUrl:string
} ;
webUpdate: { id: number, info: string, time: string }[] = [];
ngOnInit() {
this.apiService.lastestUpdateTime().subscribe(data => {
this.lastUpdateTime = data.result;
this.apiService.lastestUpdate().subscribe(data => {
this.lastUpdate = data.result;
});
this.apiService.webUpdate().subscribe(data => {
this.webUpdate = data.result.reverse();

View File

@@ -2,6 +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";
const routes: Route[] = [{path: '**', component: UpdateComponent}];
@@ -9,7 +10,8 @@ const routes: Route[] = [{path: '**', component: UpdateComponent}];
declarations: [UpdateComponent],
imports: [
CommonModule,
RouterModule.forChild(routes)
RouterModule.forChild(routes),
NzTagModule
]
})
export class UpdateModule {