Merge branch 'dev'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {RequestObj} from '../../class/HttpReqAndResp';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {HttpClient, HttpResponse} from '@angular/common/http';
|
||||
import {environment} from '../../../environments/environment';
|
||||
import {LocalStorageService} from '../../services/local-storage.service';
|
||||
import {Response} from '../../class/HttpReqAndResp';
|
||||
@@ -34,7 +34,7 @@ export class HttpService {
|
||||
}
|
||||
request.path = this.checkUrl(request);
|
||||
|
||||
let observable: Observable<Response<T>>;
|
||||
let observable: Observable<HttpResponse<Response<T>>>;
|
||||
switch (request.method) {
|
||||
case 'GET':
|
||||
observable = this.get<Response<T>>(request);
|
||||
@@ -55,13 +55,17 @@ export class HttpService {
|
||||
const oob = new Observable<Response<T>>(o => observer = o);
|
||||
|
||||
observable.subscribe(o => {
|
||||
if (o.code) {
|
||||
const tokenFromReps = o.headers.get('Authorization');
|
||||
if (tokenFromReps) {
|
||||
this.localStorageService.setToken(tokenFromReps);
|
||||
}
|
||||
if (o.body.code) {
|
||||
observer.error(o);
|
||||
if (this.errorDispatch) {
|
||||
this.errorDispatch.errHandler(o.code, o.msg, request);
|
||||
this.errorDispatch.errHandler(o.body.code, o.body.msg, request);
|
||||
}
|
||||
} else {
|
||||
observer.next(o);
|
||||
observer.next(o.body);
|
||||
}
|
||||
observer.complete();
|
||||
});
|
||||
@@ -72,7 +76,8 @@ export class HttpService {
|
||||
return this.httpClient.get<T>(request.path,
|
||||
{
|
||||
headers: request.header,
|
||||
withCredentials: true
|
||||
withCredentials: true,
|
||||
observe: 'response'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,7 +85,8 @@ export class HttpService {
|
||||
return this.httpClient.post<T>(request.path, request.data,
|
||||
{
|
||||
headers: request.header,
|
||||
withCredentials: true
|
||||
withCredentials: true,
|
||||
observe: 'response'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -88,7 +94,8 @@ export class HttpService {
|
||||
return this.httpClient.put<T>(request.path, request.data,
|
||||
{
|
||||
headers: request.header,
|
||||
withCredentials: true
|
||||
withCredentials: true,
|
||||
observe: 'response'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -96,7 +103,8 @@ export class HttpService {
|
||||
return this.httpClient.delete<T>(request.path,
|
||||
{
|
||||
headers: request.header,
|
||||
withCredentials: true
|
||||
withCredentials: true,
|
||||
observe: 'response'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export class GlobalUserService {
|
||||
}
|
||||
this.localStorageService.removeToken();
|
||||
this.userObserverArray.forEach(ob => ob.next(new Response<User>(null)));
|
||||
this.userObserverArray.forEach(ob => ob.error(err));
|
||||
this.userObserverArray.forEach(ob => ob.error && ob.error(err));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="文章管理" nzSize="small">
|
||||
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="page"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'1100px'}"
|
||||
(nzPageIndexChange)="getArticle()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>标题</th>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="评论管理" nzSize="small">
|
||||
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
|
||||
(nzPageIndexChange)="getComment()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>文章标题</th>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div *ngIf="userInfo&&userInfo.role==='admin'">
|
||||
<div nz-row>
|
||||
<nz-card nzTitle="统计" nz-col nzSpan="12" nzSize="small">
|
||||
<nz-card nzTitle="统计" nz-col nzXs="24" nzSm="12" nzSize="small">
|
||||
<nz-row [nzGutter]="24">
|
||||
<nz-col [nzSpan]="6">
|
||||
<nz-statistic [nzValue]="(counts.articleCount | number)!" nzTitle="文章数量"></nz-statistic>
|
||||
@@ -16,7 +16,7 @@
|
||||
</nz-col>
|
||||
</nz-row>
|
||||
</nz-card>
|
||||
<nz-card nzTitle="信息" nz-col nzSpan="11" nzOffset="1" nzSize="small">
|
||||
<nz-card nzTitle="信息" nz-col nzXs="24" [nzSm]="{span:11,offset:1}" nzSize="small">
|
||||
<nz-row [nzGutter]="24">
|
||||
<nz-col [nzSpan]="8">
|
||||
<nz-statistic [nzValue]="(counts.visitorCount | number)!" nzTitle="总访问量"></nz-statistic>
|
||||
@@ -31,8 +31,8 @@
|
||||
</nz-row>
|
||||
</nz-card>
|
||||
</div>
|
||||
<div nz-row style="margin-top: 30px">
|
||||
<nz-card style="width:100%;" nzSize="small" nzTitle="日志" [nzExtra]="reload">
|
||||
<div nz-row>
|
||||
<nz-card style="width: 100%" nzSize="small" nzTitle="日志" [nzExtra]="reload">
|
||||
<ng-template #reload>
|
||||
<a (click)="getLog()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||
</ng-template>
|
||||
@@ -44,11 +44,11 @@
|
||||
</div>
|
||||
<div *ngIf="userInfo&&userInfo.role==='user'">
|
||||
<div nz-row>
|
||||
<nz-card nzTitle="信息" nz-col nzSpan="6" nzOffset="1" nzSize="small">
|
||||
<nz-card nzTitle="信息" nz-col nzXs="24" [nzMd]="{span:11}" [nzXl]="{span:6,offset:1}" nzSize="small">
|
||||
<nz-statistic [nzValue]="userInfo.recentlyLandedDate?userInfo.recentlyLandedDate:''"
|
||||
nzTitle="上次登录"></nz-statistic>
|
||||
</nz-card>
|
||||
<nz-card nzTitle="关于此博客" nzSize="small" nz-col nzSpan="6" nzOffset="2">
|
||||
<nz-card nzTitle="关于此博客" nzSize="small" nz-col nzXs="24" [nzMd]="{span:11,offset:2}" [nzXl]="{span:6,offset:2}">
|
||||
<p>此博客由 <a href="https://github.com/xiaohai2271" target="_blank">禾几海(郑海)</a> 设计并实现的</p>
|
||||
<p>博客自2019年3月开始开发编写 5月开始正式运行至今</p>
|
||||
<p>博客所有代码都是开源的,你可以随意修改,运行和发布</p>
|
||||
@@ -59,7 +59,7 @@
|
||||
</p>
|
||||
<p>如果觉得博客还不错,请前往Github支持我,给我点一个star吧</p>
|
||||
</nz-card>
|
||||
<nz-card nz-col nzSpan="6" nzOffset="2">
|
||||
<nz-card nz-col nzXs="24" [nzMd]="{span:12,offset:6}" [nzXl]="{span:6,offset:2}">
|
||||
<p style="font-style: italic">坚强的信心,能使平凡的人做出惊人的事业。</p>
|
||||
<p style="text-align: right"> ——马尔顿</p>
|
||||
</nz-card>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
nz-card {
|
||||
margin-bottom: 30px
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<nz-card nzTitle="友链管理" nzSize="small">
|
||||
<button nz-button (click)="addLink()" style="margin-bottom: 15px">新增</button>
|
||||
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'1200px'}"
|
||||
(nzPageIndexChange)="getLinks()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>友链名称</th>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<nz-table #table [nzData]="categoryList" [nzTotal]="categoryList.length"
|
||||
(nzPageIndexChange)="getCategory()"
|
||||
(nzPageIndexChange)="getCategory()" [nzScroll]="{x:'800px'}"
|
||||
nzFrontPagination="false" [nzLoading]="loading">
|
||||
<thead>
|
||||
<th>分类名</th>
|
||||
@@ -51,7 +51,7 @@
|
||||
</nz-tab>
|
||||
<nz-tab nzTitle="标签管理" (nzClick)="editInfo.editFocus=false">
|
||||
<nz-table #tagTable [nzData]="tagPageList.list" [nzTotal]="tagPageList.total"
|
||||
[(nzPageIndex)]="pageIndex"
|
||||
[(nzPageIndex)]="pageIndex" [nzScroll]="{x:'800px'}"
|
||||
[nzPageSize]="pageSize" (nzPageIndexChange)="getTag()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>标签名</th>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<nz-card nzTitle="更新内容管理" nzSize="small">
|
||||
<button nz-button (click)="showModal()" style="margin-bottom: 15px;">新增</button>
|
||||
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
|
||||
(nzPageIndexChange)="getUpdateInfo()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>更新内容</th>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="用户管理" nzSize="small">
|
||||
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
|
||||
(nzPageIndexChange)="getUser()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>邮箱</th>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="访客信息管理" nzSize="small">
|
||||
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading"
|
||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
|
||||
(nzPageIndexChange)="getVisitors()" nzFrontPagination="false">
|
||||
<thead>
|
||||
<th>ip地址</th>
|
||||
|
||||
Reference in New Issue
Block a user