Merge pull request #13 from xiaohai2271/update

展示最近的提交记录
This commit is contained in:
小海
2020-04-23 17:35:54 +08:00
committed by GitHub
5 changed files with 54 additions and 10 deletions

View File

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

View File

@@ -4,9 +4,31 @@
<div class="container"> <div class="container">
<div class="zh-update"> <div class="zh-update">
<div class="zh-update-log"> <div class="zh-update-log">
<div class="zh-update-log-title"> <div class="zh-update-log-title" *ngIf="lastUpdate">
<h1>更新日志</h1> <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>
<div class="zh-update-log-content"> <div class="zh-update-log-content">
@@ -30,4 +52,4 @@
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

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

View File

@@ -2,6 +2,7 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {UpdateComponent} from './update.component'; import {UpdateComponent} from './update.component';
import {Route, RouterModule} from '@angular/router'; import {Route, RouterModule} from '@angular/router';
import {NzTagModule} from "ng-zorro-antd";
const routes: Route[] = [{path: '**', component: UpdateComponent}]; const routes: Route[] = [{path: '**', component: UpdateComponent}];
@@ -9,7 +10,8 @@ const routes: Route[] = [{path: '**', component: UpdateComponent}];
declarations: [UpdateComponent], declarations: [UpdateComponent],
imports: [ imports: [
CommonModule, CommonModule,
RouterModule.forChild(routes) RouterModule.forChild(routes),
NzTagModule
] ]
}) })
export class UpdateModule { export class UpdateModule {