调整接口
调整接口
This commit is contained in:
@@ -111,7 +111,7 @@ export class ApiService extends HttpService {
|
||||
}
|
||||
|
||||
categories() {
|
||||
return super.Service<Category[]>({
|
||||
return super.Service<PageList<Category>>({
|
||||
path: '/categories',
|
||||
method: 'GET'
|
||||
});
|
||||
@@ -183,10 +183,9 @@ export class ApiService extends HttpService {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getCommentByPid(pid: number, pageNumber: number = 1, pageSize: number = 10) {
|
||||
return super.Service<Comment[]>({
|
||||
path: `/comment/pid/${pid}`,
|
||||
getCommentByTypeForAdmin(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||
return super.Service<PageList<Comment>>({
|
||||
path: `/admin/comment/pagePath/${pagePath}`,
|
||||
method: 'GET',
|
||||
queryParam: {
|
||||
page: pageNumber,
|
||||
@@ -195,20 +194,9 @@ export class ApiService extends HttpService {
|
||||
});
|
||||
}
|
||||
|
||||
getCommentByTypeForAdmin(isComment: boolean, pageNumber: number = 1, pageSize: number = 10) {
|
||||
getCommentByTypeForUser(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||
return super.Service<PageList<Comment>>({
|
||||
path: `/admin/comment/type/${isComment ? 1 : 0}`,
|
||||
method: 'GET',
|
||||
queryParam: {
|
||||
page: pageNumber,
|
||||
count: pageSize
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getCommentByTypeForUser(isComment: boolean, pageNumber: number = 1, pageSize: number = 10) {
|
||||
return super.Service<PageList<Comment>>({
|
||||
path: `/user/comment/type/${isComment ? 1 : 0}`,
|
||||
path: `/user/comment/pagePath/${pagePath}`,
|
||||
method: 'GET',
|
||||
queryParam: {
|
||||
page: pageNumber,
|
||||
@@ -234,21 +222,9 @@ export class ApiService extends HttpService {
|
||||
});
|
||||
}
|
||||
|
||||
comments(articleID: number, pageSize: number = 10, pageNumber: number = 1) {
|
||||
comments(pagePath: string, pageSize: number = 10, pageNumber: number = 1) {
|
||||
return super.Service<PageList<Comment>>({
|
||||
path: '/comments',
|
||||
method: 'GET',
|
||||
queryParam: {
|
||||
articleId: articleID,
|
||||
count: pageSize,
|
||||
page: pageNumber
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
leaveMsg(pageSize: number = 10, pageNumber: number = 1) {
|
||||
return super.Service<PageList<Comment>>({
|
||||
path: '/leaveMsg',
|
||||
path: `/comment/pagePath/${pagePath}`,
|
||||
method: 'GET',
|
||||
queryParam: {
|
||||
count: pageSize,
|
||||
@@ -272,7 +248,6 @@ export class ApiService extends HttpService {
|
||||
articleCount: number,
|
||||
visitorCount: number,
|
||||
categoryCount: number,
|
||||
leaveMsgCount: number,
|
||||
tagCount: number,
|
||||
commentCount: number
|
||||
}>({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import {Tag} from './Tag';
|
||||
import {User} from './User';
|
||||
|
||||
export class Article {
|
||||
id: number;
|
||||
title: string;
|
||||
@@ -5,16 +8,16 @@ export class Article {
|
||||
mdContent?: string;
|
||||
original?: boolean;
|
||||
url?: string;
|
||||
publishDateFormat?: string;
|
||||
publishDateFormat: string;
|
||||
updateDateFormat?: string;
|
||||
category?: string;
|
||||
tags?: string[];
|
||||
authorName?: string;
|
||||
preArticleId?: number;
|
||||
nextArticleId?: number;
|
||||
preArticleTitle?: string;
|
||||
nextArticleTitle?: string;
|
||||
readingNumber?: number;
|
||||
tags?: Tag[];
|
||||
author: User;
|
||||
preArticle?: Article;
|
||||
nextArticle?: Article;
|
||||
readingNumber: number;
|
||||
likeCount: number;
|
||||
dislikeCount: number;
|
||||
open?: string;
|
||||
}
|
||||
|
||||
@@ -24,7 +27,7 @@ export class ArticleReq {
|
||||
id?: number;
|
||||
mdContent: string;
|
||||
open: boolean;
|
||||
tags: string;
|
||||
tags: string[];
|
||||
title: string;
|
||||
type: boolean;
|
||||
url?: string;
|
||||
|
||||
@@ -1,33 +1,26 @@
|
||||
import {User} from './User';
|
||||
|
||||
export class Comment {
|
||||
id?: number;
|
||||
authorName?: string;
|
||||
authorAvatarImgUrl?: string;
|
||||
fromUser: User;
|
||||
toUser?: User;
|
||||
content: string;
|
||||
articleID: number;
|
||||
articleTitle: string;
|
||||
pagePath: string;
|
||||
date?: string;
|
||||
responseId: string;
|
||||
pid: number;
|
||||
comment: boolean;
|
||||
respComment: Comment[];
|
||||
status: number;
|
||||
}
|
||||
|
||||
|
||||
export class CommentReq {
|
||||
id?: number;
|
||||
comment: boolean;
|
||||
content: string;
|
||||
pid: number;
|
||||
articleID: number;
|
||||
responseId: string;
|
||||
pid: number = -1;
|
||||
toUserId: number;
|
||||
pagePath: string;
|
||||
|
||||
constructor(comment: boolean) {
|
||||
this.comment = comment;
|
||||
this.responseId = '';
|
||||
if (!comment) {
|
||||
this.articleID = -1;
|
||||
}
|
||||
this.pid = -1;
|
||||
this.id = null;
|
||||
constructor(pagePath: string) {
|
||||
this.pagePath = pagePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ export class Response<T> {
|
||||
code: number;
|
||||
msg: string;
|
||||
result: T;
|
||||
date: number;
|
||||
|
||||
constructor(t: T) {
|
||||
this.code = 0;
|
||||
@@ -28,18 +27,4 @@ export class PageList<T> {
|
||||
list: T[];
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
size: number;
|
||||
startRow: number;
|
||||
endRow: number;
|
||||
pages: number;
|
||||
prePage: number;
|
||||
nextPage: number;
|
||||
isFirstPage: boolean;
|
||||
isLastPage: boolean;
|
||||
hasPreviousPage: boolean;
|
||||
hasNextPage: boolean;
|
||||
navigatePages: number;
|
||||
navigatepageNums: number[];
|
||||
navigateFirstPage: number;
|
||||
navigateLastPage: number;
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ export class Link {
|
||||
name: string;
|
||||
url: string;
|
||||
open?: boolean;
|
||||
iconPath: string;
|
||||
desc: string;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import {Article} from './Article';
|
||||
|
||||
export class Category {
|
||||
id: number;
|
||||
name: string;
|
||||
articles?: number[];
|
||||
articles?: Article[];
|
||||
}
|
||||
|
||||
|
||||
export class Tag {
|
||||
id: number;
|
||||
name: string;
|
||||
articles?: number[];
|
||||
articles?: Article[];
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ export class User {
|
||||
id: number;
|
||||
email: string;
|
||||
displayName: string;
|
||||
emailStatus: boolean;
|
||||
avatarImgUrl?: string;
|
||||
emailStatus?: boolean;
|
||||
avatarImgUrl: string;
|
||||
desc: string;
|
||||
role: string;
|
||||
role?: string;
|
||||
token?: string;
|
||||
pwd?: string;
|
||||
recentlyLandedDate?: string
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="友链管理" nzSize="small">
|
||||
<nz-card nzTitle="友链管理" nzSize="small" [nzExtra]="reload">
|
||||
<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" [nzScroll]="{x:'1200px'}"
|
||||
@@ -29,6 +29,10 @@
|
||||
</nz-card>
|
||||
</div>
|
||||
|
||||
<ng-template #reload>
|
||||
<a (click)="getLinks()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||
</ng-template>
|
||||
|
||||
<nz-modal [(nzVisible)]="modalVisible" [nzTitle]="modalTitle" (nzOnOk)="modalConfirm()"
|
||||
(nzOnCancel)="modalVisible = false" [nzClosable]="true" [nzOkDisabled]="!formGroup.valid">
|
||||
<form nz-form [formGroup]="formGroup">
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="" nzSize="small">
|
||||
<nz-tabset>
|
||||
<nz-tab nzTitle="分类管理" (nzClick)="editInfo.editFocus=false">
|
||||
<nz-tabset [nzTabBarExtraContent]="reload">
|
||||
<nz-tab nzTitle="分类管理" (nzClick)="tabChanged('tag')">
|
||||
<div style="margin-bottom: 15px;">
|
||||
<nz-input-group *ngIf="editInfo.editFocus&&editInfo.isAdd" [nzPrefix]="tagIcon"
|
||||
style="width: 200px">
|
||||
@@ -49,7 +49,7 @@
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-tab>
|
||||
<nz-tab nzTitle="标签管理" (nzClick)="editInfo.editFocus=false">
|
||||
<nz-tab nzTitle="标签管理" (nzClick)="tabChanged('category')">
|
||||
<nz-table #tagTable [nzData]="tagPageList.list" [nzTotal]="tagPageList.total"
|
||||
[(nzPageIndex)]="pageIndex" [nzScroll]="{x:'800px'}"
|
||||
[nzPageSize]="pageSize" (nzPageIndexChange)="getTag()" nzFrontPagination="false">
|
||||
@@ -90,3 +90,8 @@
|
||||
</nz-card>
|
||||
</div>
|
||||
<ng-template #tagIcon><i nz-icon nzType="tag" nzTheme="outline"></i></ng-template>
|
||||
<ng-template #reload>
|
||||
<a (click)="getData()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||
</ng-template>
|
||||
|
||||
|
||||
|
||||
@@ -29,15 +29,17 @@ export class AdminTagComponent implements OnInit {
|
||||
pageIndex: number = 1;
|
||||
pageSize: number = 10;
|
||||
|
||||
getData: any;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.title.setTitle('小海博客 | 标签分类管理')
|
||||
this.getCategory();
|
||||
this.getTag();
|
||||
this.getData = this.getTag;
|
||||
}
|
||||
|
||||
getCategory = () => this.apiService.categories().subscribe({
|
||||
next: data => this.categoryList = data.result,
|
||||
next: data => this.categoryList = data.result.list,
|
||||
complete: () => this.loading = false,
|
||||
error: err => this.loading = false
|
||||
})
|
||||
@@ -138,4 +140,12 @@ export class AdminTagComponent implements OnInit {
|
||||
this.editInfo.isAdd = false
|
||||
this.editInfo.name = null
|
||||
}
|
||||
|
||||
tabChanged(mode: 'tag' | 'category') {
|
||||
this.editInfo.editFocus = false
|
||||
if (mode === 'tag')
|
||||
this.getData = this.getTag;
|
||||
else
|
||||
this.getData = this.getCategory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="更新内容管理" nzSize="small">
|
||||
<nz-card nzTitle="更新内容管理" nzSize="small" [nzExtra]="reload">
|
||||
<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" [nzScroll]="{x:'800px'}"
|
||||
@@ -30,3 +30,6 @@
|
||||
(nzOnOk)="confirm()" [nzTitle]="modalData.title">
|
||||
<textarea nz-input [(ngModel)]="modalData.content" [nzAutosize]="{ minRows: 2, maxRows: 8 }"></textarea>
|
||||
</nz-modal>
|
||||
<ng-template #reload>
|
||||
<a (click)="getUpdateInfo()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||
</ng-template>
|
||||
|
||||
@@ -5,7 +5,7 @@ import {AdminUpdateComponent} from './admin-update.component';
|
||||
import {
|
||||
NzButtonModule,
|
||||
NzCardModule,
|
||||
NzDividerModule, NzInputModule, NzModalModule,
|
||||
NzDividerModule, NzIconModule, NzInputModule, NzModalModule,
|
||||
NzPopconfirmModule,
|
||||
NzTableModule,
|
||||
NzToolTipModule,
|
||||
@@ -30,7 +30,8 @@ import {FormsModule} from '@angular/forms';
|
||||
NzModalModule,
|
||||
FormsModule,
|
||||
NzButtonModule,
|
||||
NzInputModule
|
||||
NzInputModule,
|
||||
NzIconModule
|
||||
]
|
||||
})
|
||||
export class AdminUpdateModule {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="用户管理" nzSize="small">
|
||||
<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)="getUser()" nzFrontPagination="false">
|
||||
@@ -115,3 +115,8 @@
|
||||
</ng-template>
|
||||
|
||||
</nz-modal>
|
||||
|
||||
|
||||
<ng-template #reload>
|
||||
<a (click)="getUser()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||
</ng-template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="inner-content">
|
||||
<nz-card nzTitle="访客信息管理" nzSize="small">
|
||||
<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)="getVisitors()" nzFrontPagination="false">
|
||||
@@ -22,3 +22,6 @@
|
||||
</nz-table>
|
||||
</nz-card>
|
||||
</div>
|
||||
<ng-template #reload>
|
||||
<a (click)="getVisitors()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||
</ng-template>
|
||||
|
||||
@@ -2,7 +2,7 @@ import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {AdminVisitorComponent} from './admin-visitor.component';
|
||||
import {NzButtonModule, NzCardModule, NzDividerModule, NzTableModule} from 'ng-zorro-antd';
|
||||
import {NzButtonModule, NzCardModule, NzDividerModule, NzIconModule, NzTableModule} from 'ng-zorro-antd';
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -15,7 +15,8 @@ import {NzButtonModule, NzCardModule, NzDividerModule, NzTableModule} from 'ng-z
|
||||
NzCardModule,
|
||||
NzTableModule,
|
||||
NzButtonModule,
|
||||
NzDividerModule
|
||||
NzDividerModule,
|
||||
NzIconModule
|
||||
]
|
||||
})
|
||||
export class AdminVisitorModule {
|
||||
|
||||
@@ -24,7 +24,6 @@ export class AdminComponent implements OnInit {
|
||||
next: data => {
|
||||
console.log('更新user')
|
||||
this.user = data.result
|
||||
this.user.avatarImgUrl += '?t=' + Date.now();
|
||||
if (data.result) this.initHelloWords()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<!-- 文章版权 -->
|
||||
<div id="copyright">
|
||||
<p>本文作者:{{article.authorName}} </p>
|
||||
<p>本文作者:{{article.author.displayName}} </p>
|
||||
<p>{{article.original ? "本文" : "原文"}}链接:{{article.original ? copyRightUrl : article.url}}</p>
|
||||
<p>版权声明:转载请注明出处</p>
|
||||
</div>
|
||||
@@ -16,17 +16,19 @@
|
||||
<!-- TODO -->
|
||||
<span *ngFor="let item of (article.tags||'')" class="tag">
|
||||
<i nz-icon nzType="tag" nzTheme="fill"></i>
|
||||
<a class="tag" [routerLink]="['/tags']" [queryParams]="{name:item}">{{item}}</a>
|
||||
</span>
|
||||
<a class="tag" [routerLink]="['/tags/'+item.name]">{{item.name}}</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="article-bAnda">
|
||||
<a (click)="toArticle(article.nextArticleId)" [class.disabled]="article.nextArticleId==-1">
|
||||
<i nz-icon nzType="left" nzTheme="outline"></i> {{article.nextArticleTitle}}
|
||||
<a (click)="toArticle(article.nextArticle.id)" [class.disabled]="!article.nextArticle">
|
||||
<i nz-icon nzType="left" nzTheme="outline"></i>
|
||||
{{(article.nextArticle && article.nextArticle.title) || '无'}}
|
||||
</a>
|
||||
<a (click)="toArticle(article.preArticleId)" [class.disabled]="article.preArticleId==-1"
|
||||
<a (click)="toArticle(article.preArticle.id)" [class.disabled]="!article.preArticle"
|
||||
style="float: right" id="pre">
|
||||
{{article.preArticleTitle}} <i nz-icon nzType="right" nzTheme="outline"></i>
|
||||
{{(article.preArticle && article.preArticle.title) || '无'}}
|
||||
<i nz-icon nzType="right" nzTheme="outline"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -58,19 +60,30 @@
|
||||
|
||||
<nz-list [nzLoading]="!commentPage">
|
||||
<nz-list-item *ngFor="let comment of commentPage.list">
|
||||
<nz-comment [nzAuthor]="comment.authorName" [nzDatetime]="comment.date" style="width: 100%">
|
||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzSrc]="comment.authorAvatarImgUrl"></nz-avatar>
|
||||
<nz-comment [nzAuthor]="comment.fromUser.displayName" [nzDatetime]="comment.date" style="width: 100%">
|
||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzSrc]="comment.fromUser.avatarImgUrl"
|
||||
*ngIf="comment.fromUser.avatarImgUrl">
|
||||
</nz-avatar>
|
||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzText]="comment.fromUser.displayName"
|
||||
*ngIf="!comment.fromUser.avatarImgUrl">
|
||||
</nz-avatar>
|
||||
<nz-comment-content>
|
||||
<p style="font-size: larger">{{ comment.content }}</p>
|
||||
</nz-comment-content>
|
||||
<nz-comment-action>
|
||||
<i nz-icon nzType="message" nzTheme="outline"></i>
|
||||
<button nz-button nzType="link" (click)="resp(comment.id,comment.authorName)">回复</button>
|
||||
<button nz-button nzType="link" (click)="resp(comment.id,comment.fromUser.displayName)">回复
|
||||
</button>
|
||||
</nz-comment-action>
|
||||
|
||||
<nz-list-item *ngFor="let com of comment.respComment">
|
||||
<nz-comment [nzAuthor]="com.authorName" [nzDatetime]="com.date">
|
||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzSrc]="com.authorAvatarImgUrl"></nz-avatar>
|
||||
<nz-comment [nzAuthor]="com.fromUser.displayName" [nzDatetime]="com.date">
|
||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzSrc]="com.fromUser.avatarImgUrl"
|
||||
*ngIf="com.fromUser.avatarImgUrl">
|
||||
</nz-avatar>
|
||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzText]="com.fromUser.displayName"
|
||||
*ngIf="!com.fromUser.avatarImgUrl">
|
||||
</nz-avatar>
|
||||
<nz-comment-content>
|
||||
<p style="font-size: larger">{{ com.content }}</p>
|
||||
</nz-comment-content>
|
||||
|
||||
@@ -51,7 +51,7 @@ export class ArticleComponent implements OnInit {
|
||||
if (data.result) this.avatarImgUrl = data.result.avatarImgUrl;
|
||||
}
|
||||
});
|
||||
this.comment = new CommentReq(true);
|
||||
this.comment = new CommentReq(`article/${this.articleId}`);
|
||||
}
|
||||
|
||||
parseMd(md: string) {
|
||||
@@ -73,7 +73,7 @@ export class ArticleComponent implements OnInit {
|
||||
this.router.navigateByUrl('/article/' + id);
|
||||
this.apiService.getArticle(id).subscribe({
|
||||
next: data => {
|
||||
this.apiService.comments(id).subscribe(commData => {
|
||||
this.apiService.comments(`article+${id}`).subscribe(commData => {
|
||||
this.commentPage = commData.result;
|
||||
});
|
||||
document.getElementById('article-content').innerHTML = '';
|
||||
@@ -89,7 +89,6 @@ export class ArticleComponent implements OnInit {
|
||||
// true ==> 一级评论 false ==>二级评论
|
||||
submitComment(bool: boolean) {
|
||||
this.submitting = true;
|
||||
this.comment.articleID = this.articleId;
|
||||
if (!bool) {
|
||||
this.comment.content = this.content;
|
||||
this.comment.pid = this.pid;
|
||||
|
||||
@@ -38,8 +38,8 @@ export class CategoryComponent implements OnInit {
|
||||
|
||||
getCategories(needGetArticle: boolean) {
|
||||
this.apiService.categories().subscribe(data => {
|
||||
this.categoryList = data.result;
|
||||
this.category = data.result[0];
|
||||
this.categoryList = data.result.list;
|
||||
this.category = this.categoryList[0];
|
||||
if (needGetArticle) {
|
||||
this.getArticles(this.category.name);
|
||||
this.name = this.category.name;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</span>
|
||||
<span *ngIf="showMediaArea" class="badge">
|
||||
<i nz-icon nzType="user" nzTheme="outline"></i>
|
||||
<span>{{data.authorName}}</span>
|
||||
<span>{{data.author.displayName}}</span>
|
||||
</span>
|
||||
<span *ngIf="showMediaArea" class="badge">
|
||||
<i nz-icon nzType="file" nzTheme="outline"></i>
|
||||
@@ -28,7 +28,7 @@
|
||||
<div>
|
||||
<span *ngFor="let tag of data.tags">
|
||||
<i nz-icon nzType="tag" nzTheme="outline"></i>
|
||||
<a [routerLink]="'/tags/'+tag">{{tag}}</a>
|
||||
<a [routerLink]="'/tags/'+tag.name">{{tag.name}}</a>
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -22,7 +22,7 @@ export class ArticleDetailCardComponent implements OnInit {
|
||||
}
|
||||
if (this.showMediaArea == null) {
|
||||
// 如果作者名不为空 则显示
|
||||
this.showMediaArea = this.data.authorName != null;
|
||||
this.showMediaArea = this.data.author.displayName != null;
|
||||
}
|
||||
if (this.showTagArea == null) {
|
||||
this.showTagArea = this.data.tags != null;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {PageList} from '../../class/HttpReqAndResp';
|
||||
import {ErrDispatch} from '../../class/ErrDispatch';
|
||||
import {RequestObj} from '../../class/HttpReqAndResp';
|
||||
import {Router} from '@angular/router';
|
||||
import {Tag} from '../../class/Tag';
|
||||
import {Category, Tag} from '../../class/Tag';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
@@ -36,12 +36,11 @@ export class IndexComponent implements OnInit, ErrDispatch {
|
||||
desc: string;
|
||||
articles: PageList<Article>;
|
||||
tagNameAndNumber: { name: string, size: number }[];
|
||||
categoryList: Tag[];
|
||||
categoryList: Category[];
|
||||
counts: {
|
||||
articleCount: number,
|
||||
visitorCount: number,
|
||||
categoryCount: number,
|
||||
leaveMsgCount: number,
|
||||
tagCount: number,
|
||||
commentCount: number
|
||||
};
|
||||
@@ -75,7 +74,7 @@ export class IndexComponent implements OnInit, ErrDispatch {
|
||||
}
|
||||
});
|
||||
this.apiService.categories().subscribe({
|
||||
next: data => this.categoryList = data.result,
|
||||
next: data => this.categoryList = data.result.list,
|
||||
error: err => {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ export class UpdateComponent implements OnInit {
|
||||
this.lastUpdate = data.result;
|
||||
});
|
||||
this.apiService.webUpdate().subscribe(data => {
|
||||
this.webUpdate = data.result.reverse();
|
||||
this.webUpdate = data.result;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
|
||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||
import {Tag} from '../../../../class/Tag';
|
||||
import {Category, Tag} from '../../../../class/Tag';
|
||||
|
||||
@Component({
|
||||
selector: 'c-publish-form',
|
||||
@@ -15,9 +15,9 @@ export class PublishFormComponent implements OnInit {
|
||||
@ViewChild('inputElement', {static: false}) tagInputElement: ElementRef;
|
||||
|
||||
@Input() tagNacList: { name: string, size: number }[];
|
||||
@Input() categoryList: Tag[];
|
||||
@Input() primaryData: { id: number, type: boolean, tags: string, category: string, url?: string };
|
||||
@Output() submitEvent = new EventEmitter<{ id: number, type: boolean, tags: string, category: string, url?: string }>();
|
||||
@Input() categoryList: Category[];
|
||||
@Input() primaryData: { id: number, type: boolean, tags: string[], category: string, url?: string };
|
||||
@Output() submitEvent = new EventEmitter<{ id: number, type: boolean, tags: string[], category: string, url?: string }>();
|
||||
|
||||
formGroup: FormGroup;
|
||||
tagTmpList: string[] = [];
|
||||
@@ -36,8 +36,8 @@ export class PublishFormComponent implements OnInit {
|
||||
if (this.primaryData) {
|
||||
this.formGroup.get('type').setValue(this.primaryData.type);
|
||||
const tags = this.primaryData.tags;
|
||||
this.formGroup.get('tagList').setValue(tags ? this.primaryData.tags.split(',') : tags);
|
||||
this.tagTmpList = tags ? this.primaryData.tags.split(',') : [...tags];
|
||||
this.formGroup.get('tagList').setValue(tags);
|
||||
this.tagTmpList = tags;
|
||||
this.formGroup.get('category').setValue(this.primaryData.category);
|
||||
this.formGroup.get('url').setValue(this.primaryData.url);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export class PublishFormComponent implements OnInit {
|
||||
const formData = {
|
||||
id: this.formGroup.value.isUpdate ? this.primaryData.id : null,
|
||||
type: this.formGroup.value.type,
|
||||
tags: this.formGroup.value.tagList.toString(),
|
||||
tags: this.formGroup.value.tagList,
|
||||
category: this.formGroup.value.category,
|
||||
url: this.formGroup.value.type ? null : this.formGroup.value.url
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ export class WriteComponent implements OnInit {
|
||||
});
|
||||
this.apiService.categories().subscribe({
|
||||
next: data => {
|
||||
this.categoryList = data.result;
|
||||
this.categoryList = data.result.list;
|
||||
},
|
||||
error: err => {
|
||||
this.message.error('获取分类信息失败');
|
||||
@@ -109,17 +109,19 @@ export class WriteComponent implements OnInit {
|
||||
/**
|
||||
* 文章数据提交
|
||||
*/
|
||||
publishArticle(e: { id: number, type: boolean, tags: string, category: string, url?: string }) {
|
||||
publishArticle(e: { id: number, type: boolean, tags: string[], category: string, url?: string }) {
|
||||
this.article.type = e.type;
|
||||
this.article.tags = e.tags;
|
||||
this.article.category = e.category;
|
||||
this.article.url = e.url;
|
||||
this.article.id = e.id;
|
||||
|
||||
if (!this.article.id && this.title === this.article.title) {
|
||||
this.message.error('文章标题未经更改,请修改后再发布');
|
||||
return;
|
||||
}
|
||||
this.modalVisible = false;
|
||||
|
||||
// if (!this.article.id && this.title === this.article.title) {
|
||||
// this.message.error('文章标题未经更改,请修改后再发布');
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 文章 暂存
|
||||
localStorage.setItem('tmpArticle', JSON.stringify(this.article));
|
||||
@@ -182,7 +184,9 @@ export class WriteComponent implements OnInit {
|
||||
next: data => {
|
||||
this.article.category = data.result.category;
|
||||
this.article.mdContent = data.result.mdContent;
|
||||
this.article.tags = String(data.result.tags);
|
||||
const tags = []
|
||||
data.result.tags.forEach(t => tags.push(t.name))
|
||||
this.article.tags = tags;
|
||||
this.article.type = data.result.original;
|
||||
this.article.url = data.result.url;
|
||||
this.article.title = data.result.title;
|
||||
|
||||
Reference in New Issue
Block a user