接口调整,对接后端部分的v2版本

This commit is contained in:
禾几海
2020-05-27 16:41:06 +08:00
parent deb8646bda
commit dba21730ca
22 changed files with 153 additions and 148 deletions

View File

@@ -1,14 +1,22 @@
<div class="inner-content">
<nz-card nzTitle="文章管理" nzSize="small">
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="page"
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'1100px'}"
(nzPageIndexChange)="getArticle()" nzFrontPagination="false">
<nz-card nzTitle="文章管理" nzSize="small" [nzExtra]="reload">
<nz-table #table [nzData]="pageList.list"
[nzTotal]="pageList.total"
[(nzPageIndex)]="page"
[nzPageSize]="pageSize"
[nzLoading]="loading"
[nzScroll]="{x:'1100px'}"
(nzPageIndexChange)="getArticle()"
nzFrontPagination="false"
nzTableLayout="fixed">
<thead>
<th>标题</th>
<th>发布日期</th>
<th>更新日期</th>
<th>文章类型</th>
<th>阅读量</th>
<th>👍赞</th>
<th>👎踩</th>
<th>是否可见</th>
<th>操作</th>
</thead>
@@ -25,6 +33,12 @@
<td>
<nz-tag [nzColor]="'purple'">{{data.readingNumber}}</nz-tag>
</td>
<td>
<nz-tag [nzColor]="'blue'">{{data.likeCount}}</nz-tag>
</td>
<td>
<nz-tag [nzColor]="'magenta'">{{data.dislikeCount}}</nz-tag>
</td>
<td><input type="checkbox" [checked]="data.open" disabled></td>
<td>
<a routerLink="/write" [queryParams]="{id:data.id}" class="edit-opr">编辑</a>
@@ -36,6 +50,10 @@
</td>
</tr>
</tbody>
<ng-template #reload>
<a (click)="getArticle()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
</ng-template>
</nz-table>
</nz-card>
</div>

View File

@@ -4,7 +4,7 @@ import {RouterModule} from '@angular/router';
import {AdminArticleComponent} from './admin-article.component';
import {
NzCardModule,
NzDividerModule,
NzDividerModule, NzIconModule,
NzPopconfirmModule,
NzTableModule, NzTagModule,
NzToolTipModule,
@@ -25,6 +25,7 @@ import {
NzDividerModule,
NzPopconfirmModule,
NzTagModule,
NzIconModule,
]
})
export class AdminArticleModule {

View File

@@ -1,20 +1,25 @@
<div class="inner-content">
<nz-card nzTitle="评论管理" nzSize="small">
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
(nzPageIndexChange)="getComment()" nzFrontPagination="false">
<nz-card nzTitle="评论管理" nzSize="small" [nzExtra]="reload">
<nz-table #table [nzData]="pageList.list"
[nzTotal]="pageList.total"
[(nzPageIndex)]="pageIndex"
[nzPageSize]="pageSize"
[nzLoading]="loading"
[nzScroll]="{x:'800px'}"
(nzPageIndexChange)="getComment()"
nzFrontPagination="false"
nzTableLayout="fixed">
<thead>
<th>文章标题</th>
<th>评论内容</th>
<th>评论</th>
<th>评论日期</th>
<th>操作</th>
<th nzAlign="center">评论页面</th>
<th nzAlign="center">评论内容</th>
<th nzAlign="center">评论日期</th>
<th nzAlign="center">操作</th>
</thead>
<tbody>
<tr *ngFor="let data of table.data">
<td nz-typography nzEllipsis="true" [nzTooltipTitle]="data.articleTitle" nzTooltipPlacement="right"
nz-tooltip>{{data.articleTitle}}</td>
<td nz-typography nzEllipsis="true" [nzTooltipTitle]="data.content" nzTooltipPlacement="right"
<td nzAlign="center"><a [href]="data.pagePath">{{data.pagePath}}</a></td>
<td nzAlign="center" nzEllipsis="true" [nzTooltipTitle]="data.content"
nzTooltipPlacement="right"
nz-tooltip style="min-width: 100px;max-width: 400px">
<span *ngIf="!editInfo.editFocus||data.id!==editInfo.id">{{data.content}}</span>
<nz-input-group *ngIf="editInfo.editFocus&&data.id===editInfo.id"
@@ -26,9 +31,8 @@
<button nz-button (click)="editInfo.editFocus=false" nzSize="small">取消</button>
</nz-input-group>
</td>
<td>{{data.authorName}}</td>
<td>{{data.date}}</td>
<td>
<td nzAlign="center">{{data.date}}</td>
<td nzAlign="center">
<a (click)="editFocus(data)" class="edit-opr">编辑</a>
<nz-divider nzType="vertical"></nz-divider>
<a nz-popconfirm nzPopconfirmTitle="确定要删除这篇文章吗?" nzOkText="删除" nzCancelText="点错了"
@@ -40,3 +44,6 @@
</nz-card>
</div>
<ng-template #tagIcon><i nz-icon nzType="message" nzTheme="outline"></i></ng-template>
<ng-template #reload>
<a (click)="getComment()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
</ng-template>

View File

@@ -27,7 +27,9 @@ export class AdminCommentComponent implements OnInit {
} else {
this.getComment = this.getCommentForUser;
}
if (this.requested) return;
this.getComment()
this.requested = true
},
error: null,
complete: null
@@ -40,23 +42,25 @@ export class AdminCommentComponent implements OnInit {
pageList: PageList<Comment> = new PageList<Comment>();
editInfo = {
id: null,
content: new CommentReq(true),
content: new CommentReq(null),
editFocus: false,
}
getComment: any;// 存放获取评论的方法
private requested: boolean = false;
ngOnInit(): void {
}
getCommentForAdmin = () => this.apiService.getCommentByTypeForAdmin(true, this.pageIndex, this.pageSize).subscribe({
// TODO:: pagePath
getCommentForAdmin = () => this.apiService.getCommentByTypeForAdmin('*', this.pageIndex, this.pageSize).subscribe({
next: data => this.pageList = data.result,
complete: () => this.loading = false,
error: err => this.loading = false
})
getCommentForUser = () => this.apiService.getCommentByTypeForUser(true, this.pageIndex, this.pageSize).subscribe({
getCommentForUser = () => this.apiService.getCommentByTypeForUser('*', this.pageIndex, this.pageSize).subscribe({
next: data => this.pageList = data.result,
complete: () => this.loading = false,
error: err => this.loading = false
@@ -97,9 +101,9 @@ export class AdminCommentComponent implements OnInit {
this.editInfo.id = data.id;
this.editInfo.content.content = data.content;
this.editInfo.content.id = data.id;
this.editInfo.content.articleID = data.articleID;
// this.editInfo.content.articleID = data.articleID;
this.editInfo.content.pid = data.pid;
this.editInfo.content.responseId = data.responseId;
// this.editInfo.content.responseId = data.responseId;
this.editInfo.editFocus = true;
}
}

View File

@@ -23,10 +23,9 @@ export class AdminDashboardComponent implements OnInit {
articleCount: number,
visitorCount: number,
categoryCount: number,
leaveMsgCount: number,
tagCount: number,
commentCount: number
} = {articleCount: 0, visitorCount: 0, categoryCount: 0, tagCount: 0, commentCount: 0, leaveMsgCount: 0}
} = {articleCount: 0, visitorCount: 0, categoryCount: 0, tagCount: 0, commentCount: 0}
dayVisitCount: number = 0;
userInfo: User = new User();

View File

@@ -6,7 +6,7 @@ import {
NzButtonModule,
NzCardModule,
NzDividerModule,
NzFormModule, NzInputModule,
NzFormModule, NzIconModule, NzInputModule,
NzModalModule,
NzPopconfirmModule, NzSelectModule,
NzTableModule
@@ -30,7 +30,8 @@ import {ReactiveFormsModule} from '@angular/forms';
ReactiveFormsModule,
NzInputModule,
NzSelectModule,
NzButtonModule
NzButtonModule,
NzIconModule
]
})
export class AdminLinkModule {