接口调整,对接后端部分的v2版本
This commit is contained in:
@@ -111,7 +111,7 @@ export class ApiService extends HttpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
categories() {
|
categories() {
|
||||||
return super.Service<Category[]>({
|
return super.Service<PageList<Category>>({
|
||||||
path: '/categories',
|
path: '/categories',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
@@ -183,10 +183,9 @@ export class ApiService extends HttpService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCommentByTypeForAdmin(pagePath: string, pageNumber: number = 1, pageSize: number = 10) {
|
||||||
getCommentByPid(pid: number, pageNumber: number = 1, pageSize: number = 10) {
|
return super.Service<PageList<Comment>>({
|
||||||
return super.Service<Comment[]>({
|
path: `/admin/comment/pagePath/${pagePath}`,
|
||||||
path: `/comment/pid/${pid}`,
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
page: pageNumber,
|
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>>({
|
return super.Service<PageList<Comment>>({
|
||||||
path: `/admin/comment/type/${isComment ? 1 : 0}`,
|
path: `/user/comment/pagePath/${pagePath}`,
|
||||||
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}`,
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
page: pageNumber,
|
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>>({
|
return super.Service<PageList<Comment>>({
|
||||||
path: '/comments',
|
path: `/comment/pagePath/${pagePath}`,
|
||||||
method: 'GET',
|
|
||||||
queryParam: {
|
|
||||||
articleId: articleID,
|
|
||||||
count: pageSize,
|
|
||||||
page: pageNumber
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
leaveMsg(pageSize: number = 10, pageNumber: number = 1) {
|
|
||||||
return super.Service<PageList<Comment>>({
|
|
||||||
path: '/leaveMsg',
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
count: pageSize,
|
count: pageSize,
|
||||||
@@ -272,7 +248,6 @@ export class ApiService extends HttpService {
|
|||||||
articleCount: number,
|
articleCount: number,
|
||||||
visitorCount: number,
|
visitorCount: number,
|
||||||
categoryCount: number,
|
categoryCount: number,
|
||||||
leaveMsgCount: number,
|
|
||||||
tagCount: number,
|
tagCount: number,
|
||||||
commentCount: number
|
commentCount: number
|
||||||
}>({
|
}>({
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import {Tag} from './Tag';
|
||||||
|
import {User} from './User';
|
||||||
|
|
||||||
export class Article {
|
export class Article {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -5,16 +8,16 @@ export class Article {
|
|||||||
mdContent?: string;
|
mdContent?: string;
|
||||||
original?: boolean;
|
original?: boolean;
|
||||||
url?: string;
|
url?: string;
|
||||||
publishDateFormat?: string;
|
publishDateFormat: string;
|
||||||
updateDateFormat?: string;
|
updateDateFormat?: string;
|
||||||
category?: string;
|
category?: string;
|
||||||
tags?: string[];
|
tags?: Tag[];
|
||||||
authorName?: string;
|
author: User;
|
||||||
preArticleId?: number;
|
preArticle?: Article;
|
||||||
nextArticleId?: number;
|
nextArticle?: Article;
|
||||||
preArticleTitle?: string;
|
readingNumber: number;
|
||||||
nextArticleTitle?: string;
|
likeCount: number;
|
||||||
readingNumber?: number;
|
dislikeCount: number;
|
||||||
open?: string;
|
open?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +27,7 @@ export class ArticleReq {
|
|||||||
id?: number;
|
id?: number;
|
||||||
mdContent: string;
|
mdContent: string;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
tags: string;
|
tags: string[];
|
||||||
title: string;
|
title: string;
|
||||||
type: boolean;
|
type: boolean;
|
||||||
url?: string;
|
url?: string;
|
||||||
|
|||||||
@@ -1,33 +1,26 @@
|
|||||||
|
import {User} from './User';
|
||||||
|
|
||||||
export class Comment {
|
export class Comment {
|
||||||
id?: number;
|
id?: number;
|
||||||
authorName?: string;
|
fromUser: User;
|
||||||
authorAvatarImgUrl?: string;
|
toUser?: User;
|
||||||
content: string;
|
content: string;
|
||||||
articleID: number;
|
pagePath: string;
|
||||||
articleTitle: string;
|
|
||||||
date?: string;
|
date?: string;
|
||||||
responseId: string;
|
|
||||||
pid: number;
|
pid: number;
|
||||||
comment: boolean;
|
|
||||||
respComment: Comment[];
|
respComment: Comment[];
|
||||||
|
status: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class CommentReq {
|
export class CommentReq {
|
||||||
id?: number;
|
id?: number;
|
||||||
comment: boolean;
|
|
||||||
content: string;
|
content: string;
|
||||||
pid: number;
|
pid: number = -1;
|
||||||
articleID: number;
|
toUserId: number;
|
||||||
responseId: string;
|
pagePath: string;
|
||||||
|
|
||||||
constructor(comment: boolean) {
|
constructor(pagePath: string) {
|
||||||
this.comment = comment;
|
this.pagePath = pagePath;
|
||||||
this.responseId = '';
|
|
||||||
if (!comment) {
|
|
||||||
this.articleID = -1;
|
|
||||||
}
|
|
||||||
this.pid = -1;
|
|
||||||
this.id = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export class Response<T> {
|
|||||||
code: number;
|
code: number;
|
||||||
msg: string;
|
msg: string;
|
||||||
result: T;
|
result: T;
|
||||||
date: number;
|
|
||||||
|
|
||||||
constructor(t: T) {
|
constructor(t: T) {
|
||||||
this.code = 0;
|
this.code = 0;
|
||||||
@@ -28,18 +27,4 @@ export class PageList<T> {
|
|||||||
list: T[];
|
list: T[];
|
||||||
pageNum: number;
|
pageNum: number;
|
||||||
pageSize: 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;
|
name: string;
|
||||||
url: string;
|
url: string;
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
|
iconPath: string;
|
||||||
|
desc: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
|
import {Article} from './Article';
|
||||||
|
|
||||||
export class Category {
|
export class Category {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
articles?: number[];
|
articles?: Article[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class Tag {
|
export class Tag {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
articles?: number[];
|
articles?: Article[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ export class User {
|
|||||||
id: number;
|
id: number;
|
||||||
email: string;
|
email: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
emailStatus: boolean;
|
emailStatus?: boolean;
|
||||||
avatarImgUrl?: string;
|
avatarImgUrl: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
role: string;
|
role?: string;
|
||||||
token?: string;
|
token?: string;
|
||||||
pwd?: string;
|
pwd?: string;
|
||||||
recentlyLandedDate?: string
|
recentlyLandedDate?: string
|
||||||
|
|||||||
@@ -1,14 +1,22 @@
|
|||||||
<div class="inner-content">
|
<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)]="page"
|
<nz-table #table [nzData]="pageList.list"
|
||||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'1100px'}"
|
[nzTotal]="pageList.total"
|
||||||
(nzPageIndexChange)="getArticle()" nzFrontPagination="false">
|
[(nzPageIndex)]="page"
|
||||||
|
[nzPageSize]="pageSize"
|
||||||
|
[nzLoading]="loading"
|
||||||
|
[nzScroll]="{x:'1100px'}"
|
||||||
|
(nzPageIndexChange)="getArticle()"
|
||||||
|
nzFrontPagination="false"
|
||||||
|
nzTableLayout="fixed">
|
||||||
<thead>
|
<thead>
|
||||||
<th>标题</th>
|
<th>标题</th>
|
||||||
<th>发布日期</th>
|
<th>发布日期</th>
|
||||||
<th>更新日期</th>
|
<th>更新日期</th>
|
||||||
<th>文章类型</th>
|
<th>文章类型</th>
|
||||||
<th>阅读量</th>
|
<th>阅读量</th>
|
||||||
|
<th>👍赞</th>
|
||||||
|
<th>👎踩</th>
|
||||||
<th>是否可见</th>
|
<th>是否可见</th>
|
||||||
<th>操作</th>
|
<th>操作</th>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -25,6 +33,12 @@
|
|||||||
<td>
|
<td>
|
||||||
<nz-tag [nzColor]="'purple'">{{data.readingNumber}}</nz-tag>
|
<nz-tag [nzColor]="'purple'">{{data.readingNumber}}</nz-tag>
|
||||||
</td>
|
</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><input type="checkbox" [checked]="data.open" disabled></td>
|
||||||
<td>
|
<td>
|
||||||
<a routerLink="/write" [queryParams]="{id:data.id}" class="edit-opr">编辑</a>
|
<a routerLink="/write" [queryParams]="{id:data.id}" class="edit-opr">编辑</a>
|
||||||
@@ -36,6 +50,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
<ng-template #reload>
|
||||||
|
<a (click)="getArticle()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
|
||||||
|
</ng-template>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
</nz-card>
|
</nz-card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {RouterModule} from '@angular/router';
|
|||||||
import {AdminArticleComponent} from './admin-article.component';
|
import {AdminArticleComponent} from './admin-article.component';
|
||||||
import {
|
import {
|
||||||
NzCardModule,
|
NzCardModule,
|
||||||
NzDividerModule,
|
NzDividerModule, NzIconModule,
|
||||||
NzPopconfirmModule,
|
NzPopconfirmModule,
|
||||||
NzTableModule, NzTagModule,
|
NzTableModule, NzTagModule,
|
||||||
NzToolTipModule,
|
NzToolTipModule,
|
||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
NzDividerModule,
|
NzDividerModule,
|
||||||
NzPopconfirmModule,
|
NzPopconfirmModule,
|
||||||
NzTagModule,
|
NzTagModule,
|
||||||
|
NzIconModule,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminArticleModule {
|
export class AdminArticleModule {
|
||||||
|
|||||||
@@ -1,20 +1,25 @@
|
|||||||
<div class="inner-content">
|
<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"
|
<nz-table #table [nzData]="pageList.list"
|
||||||
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
|
[nzTotal]="pageList.total"
|
||||||
(nzPageIndexChange)="getComment()" nzFrontPagination="false">
|
[(nzPageIndex)]="pageIndex"
|
||||||
|
[nzPageSize]="pageSize"
|
||||||
|
[nzLoading]="loading"
|
||||||
|
[nzScroll]="{x:'800px'}"
|
||||||
|
(nzPageIndexChange)="getComment()"
|
||||||
|
nzFrontPagination="false"
|
||||||
|
nzTableLayout="fixed">
|
||||||
<thead>
|
<thead>
|
||||||
<th>文章标题</th>
|
<th nzAlign="center">评论页面</th>
|
||||||
<th>评论内容</th>
|
<th nzAlign="center">评论内容</th>
|
||||||
<th>评论者</th>
|
<th nzAlign="center">评论日期</th>
|
||||||
<th>评论日期</th>
|
<th nzAlign="center">操作</th>
|
||||||
<th>操作</th>
|
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let data of table.data">
|
<tr *ngFor="let data of table.data">
|
||||||
<td nz-typography nzEllipsis="true" [nzTooltipTitle]="data.articleTitle" nzTooltipPlacement="right"
|
<td nzAlign="center"><a [href]="data.pagePath">{{data.pagePath}}</a></td>
|
||||||
nz-tooltip>{{data.articleTitle}}</td>
|
<td nzAlign="center" nzEllipsis="true" [nzTooltipTitle]="data.content"
|
||||||
<td nz-typography nzEllipsis="true" [nzTooltipTitle]="data.content" nzTooltipPlacement="right"
|
nzTooltipPlacement="right"
|
||||||
nz-tooltip style="min-width: 100px;max-width: 400px">
|
nz-tooltip style="min-width: 100px;max-width: 400px">
|
||||||
<span *ngIf="!editInfo.editFocus||data.id!==editInfo.id">{{data.content}}</span>
|
<span *ngIf="!editInfo.editFocus||data.id!==editInfo.id">{{data.content}}</span>
|
||||||
<nz-input-group *ngIf="editInfo.editFocus&&data.id===editInfo.id"
|
<nz-input-group *ngIf="editInfo.editFocus&&data.id===editInfo.id"
|
||||||
@@ -26,9 +31,8 @@
|
|||||||
<button nz-button (click)="editInfo.editFocus=false" nzSize="small">取消</button>
|
<button nz-button (click)="editInfo.editFocus=false" nzSize="small">取消</button>
|
||||||
</nz-input-group>
|
</nz-input-group>
|
||||||
</td>
|
</td>
|
||||||
<td>{{data.authorName}}</td>
|
<td nzAlign="center">{{data.date}}</td>
|
||||||
<td>{{data.date}}</td>
|
<td nzAlign="center">
|
||||||
<td>
|
|
||||||
<a (click)="editFocus(data)" class="edit-opr">编辑</a>
|
<a (click)="editFocus(data)" class="edit-opr">编辑</a>
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<a nz-popconfirm nzPopconfirmTitle="确定要删除这篇文章吗?" nzOkText="删除" nzCancelText="点错了"
|
<a nz-popconfirm nzPopconfirmTitle="确定要删除这篇文章吗?" nzOkText="删除" nzCancelText="点错了"
|
||||||
@@ -40,3 +44,6 @@
|
|||||||
</nz-card>
|
</nz-card>
|
||||||
</div>
|
</div>
|
||||||
<ng-template #tagIcon><i nz-icon nzType="message" nzTheme="outline"></i></ng-template>
|
<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 {
|
} else {
|
||||||
this.getComment = this.getCommentForUser;
|
this.getComment = this.getCommentForUser;
|
||||||
}
|
}
|
||||||
|
if (this.requested) return;
|
||||||
this.getComment()
|
this.getComment()
|
||||||
|
this.requested = true
|
||||||
},
|
},
|
||||||
error: null,
|
error: null,
|
||||||
complete: null
|
complete: null
|
||||||
@@ -40,23 +42,25 @@ export class AdminCommentComponent implements OnInit {
|
|||||||
pageList: PageList<Comment> = new PageList<Comment>();
|
pageList: PageList<Comment> = new PageList<Comment>();
|
||||||
editInfo = {
|
editInfo = {
|
||||||
id: null,
|
id: null,
|
||||||
content: new CommentReq(true),
|
content: new CommentReq(null),
|
||||||
editFocus: false,
|
editFocus: false,
|
||||||
}
|
}
|
||||||
getComment: any;// 存放获取评论的方法
|
getComment: any;// 存放获取评论的方法
|
||||||
|
private requested: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
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,
|
next: data => this.pageList = data.result,
|
||||||
complete: () => this.loading = false,
|
complete: () => this.loading = false,
|
||||||
error: err => 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,
|
next: data => this.pageList = data.result,
|
||||||
complete: () => this.loading = false,
|
complete: () => this.loading = false,
|
||||||
error: err => this.loading = false
|
error: err => this.loading = false
|
||||||
@@ -97,9 +101,9 @@ export class AdminCommentComponent implements OnInit {
|
|||||||
this.editInfo.id = data.id;
|
this.editInfo.id = data.id;
|
||||||
this.editInfo.content.content = data.content;
|
this.editInfo.content.content = data.content;
|
||||||
this.editInfo.content.id = data.id;
|
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.pid = data.pid;
|
||||||
this.editInfo.content.responseId = data.responseId;
|
// this.editInfo.content.responseId = data.responseId;
|
||||||
this.editInfo.editFocus = true;
|
this.editInfo.editFocus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ export class AdminDashboardComponent implements OnInit {
|
|||||||
articleCount: number,
|
articleCount: number,
|
||||||
visitorCount: number,
|
visitorCount: number,
|
||||||
categoryCount: number,
|
categoryCount: number,
|
||||||
leaveMsgCount: number,
|
|
||||||
tagCount: number,
|
tagCount: number,
|
||||||
commentCount: 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;
|
dayVisitCount: number = 0;
|
||||||
userInfo: User = new User();
|
userInfo: User = new User();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
NzButtonModule,
|
NzButtonModule,
|
||||||
NzCardModule,
|
NzCardModule,
|
||||||
NzDividerModule,
|
NzDividerModule,
|
||||||
NzFormModule, NzInputModule,
|
NzFormModule, NzIconModule, NzInputModule,
|
||||||
NzModalModule,
|
NzModalModule,
|
||||||
NzPopconfirmModule, NzSelectModule,
|
NzPopconfirmModule, NzSelectModule,
|
||||||
NzTableModule
|
NzTableModule
|
||||||
@@ -30,7 +30,8 @@ import {ReactiveFormsModule} from '@angular/forms';
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
NzInputModule,
|
NzInputModule,
|
||||||
NzSelectModule,
|
NzSelectModule,
|
||||||
NzButtonModule
|
NzButtonModule,
|
||||||
|
NzIconModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminLinkModule {
|
export class AdminLinkModule {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<!-- 文章版权 -->
|
<!-- 文章版权 -->
|
||||||
<div id="copyright">
|
<div id="copyright">
|
||||||
<p>本文作者:{{article.authorName}} </p>
|
<p>本文作者:{{article.author.displayName}} </p>
|
||||||
<p>{{article.original ? "本文" : "原文"}}链接:{{article.original ? copyRightUrl : article.url}}</p>
|
<p>{{article.original ? "本文" : "原文"}}链接:{{article.original ? copyRightUrl : article.url}}</p>
|
||||||
<p>版权声明:转载请注明出处</p>
|
<p>版权声明:转载请注明出处</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,17 +16,19 @@
|
|||||||
<!-- TODO -->
|
<!-- TODO -->
|
||||||
<span *ngFor="let item of (article.tags||'')" class="tag">
|
<span *ngFor="let item of (article.tags||'')" class="tag">
|
||||||
<i nz-icon nzType="tag" nzTheme="fill"></i>
|
<i nz-icon nzType="tag" nzTheme="fill"></i>
|
||||||
<a class="tag" [routerLink]="['/tags']" [queryParams]="{name:item}">{{item}}</a>
|
<a class="tag" [routerLink]="['/tags/'+item.name]">{{item.name}}</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="article-bAnda">
|
<div class="article-bAnda">
|
||||||
<a (click)="toArticle(article.nextArticleId)" [class.disabled]="article.nextArticleId==-1">
|
<a (click)="toArticle(article.nextArticle.id)" [class.disabled]="!article.nextArticle">
|
||||||
<i nz-icon nzType="left" nzTheme="outline"></i> {{article.nextArticleTitle}}
|
<i nz-icon nzType="left" nzTheme="outline"></i>
|
||||||
|
{{(article.nextArticle && article.nextArticle.title) || '无'}}
|
||||||
</a>
|
</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">
|
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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -58,19 +60,30 @@
|
|||||||
|
|
||||||
<nz-list [nzLoading]="!commentPage">
|
<nz-list [nzLoading]="!commentPage">
|
||||||
<nz-list-item *ngFor="let comment of commentPage.list">
|
<nz-list-item *ngFor="let comment of commentPage.list">
|
||||||
<nz-comment [nzAuthor]="comment.authorName" [nzDatetime]="comment.date" style="width: 100%">
|
<nz-comment [nzAuthor]="comment.fromUser.displayName" [nzDatetime]="comment.date" style="width: 100%">
|
||||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzSrc]="comment.authorAvatarImgUrl"></nz-avatar>
|
<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>
|
<nz-comment-content>
|
||||||
<p style="font-size: larger">{{ comment.content }}</p>
|
<p style="font-size: larger">{{ comment.content }}</p>
|
||||||
</nz-comment-content>
|
</nz-comment-content>
|
||||||
<nz-comment-action>
|
<nz-comment-action>
|
||||||
<i nz-icon nzType="message" nzTheme="outline"></i>
|
<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-comment-action>
|
||||||
|
|
||||||
<nz-list-item *ngFor="let com of comment.respComment">
|
<nz-list-item *ngFor="let com of comment.respComment">
|
||||||
<nz-comment [nzAuthor]="com.authorName" [nzDatetime]="com.date">
|
<nz-comment [nzAuthor]="com.fromUser.displayName" [nzDatetime]="com.date">
|
||||||
<nz-avatar nz-comment-avatar nzIcon="user" [nzSrc]="com.authorAvatarImgUrl"></nz-avatar>
|
<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>
|
<nz-comment-content>
|
||||||
<p style="font-size: larger">{{ com.content }}</p>
|
<p style="font-size: larger">{{ com.content }}</p>
|
||||||
</nz-comment-content>
|
</nz-comment-content>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export class ArticleComponent implements OnInit {
|
|||||||
if (data.result) this.avatarImgUrl = data.result.avatarImgUrl;
|
if (data.result) this.avatarImgUrl = data.result.avatarImgUrl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.comment = new CommentReq(true);
|
this.comment = new CommentReq(`article/${this.articleId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
parseMd(md: string) {
|
parseMd(md: string) {
|
||||||
@@ -73,7 +73,7 @@ export class ArticleComponent implements OnInit {
|
|||||||
this.router.navigateByUrl('/article/' + id);
|
this.router.navigateByUrl('/article/' + id);
|
||||||
this.apiService.getArticle(id).subscribe({
|
this.apiService.getArticle(id).subscribe({
|
||||||
next: data => {
|
next: data => {
|
||||||
this.apiService.comments(id).subscribe(commData => {
|
this.apiService.comments(`article+${id}`).subscribe(commData => {
|
||||||
this.commentPage = commData.result;
|
this.commentPage = commData.result;
|
||||||
});
|
});
|
||||||
document.getElementById('article-content').innerHTML = '';
|
document.getElementById('article-content').innerHTML = '';
|
||||||
@@ -89,7 +89,6 @@ export class ArticleComponent implements OnInit {
|
|||||||
// true ==> 一级评论 false ==>二级评论
|
// true ==> 一级评论 false ==>二级评论
|
||||||
submitComment(bool: boolean) {
|
submitComment(bool: boolean) {
|
||||||
this.submitting = true;
|
this.submitting = true;
|
||||||
this.comment.articleID = this.articleId;
|
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
this.comment.content = this.content;
|
this.comment.content = this.content;
|
||||||
this.comment.pid = this.pid;
|
this.comment.pid = this.pid;
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ export class CategoryComponent implements OnInit {
|
|||||||
|
|
||||||
getCategories(needGetArticle: boolean) {
|
getCategories(needGetArticle: boolean) {
|
||||||
this.apiService.categories().subscribe(data => {
|
this.apiService.categories().subscribe(data => {
|
||||||
this.categoryList = data.result;
|
this.categoryList = data.result.list;
|
||||||
this.category = data.result[0];
|
this.category = this.categoryList[0];
|
||||||
if (needGetArticle) {
|
if (needGetArticle) {
|
||||||
this.getArticles(this.category.name);
|
this.getArticles(this.category.name);
|
||||||
this.name = this.category.name;
|
this.name = this.category.name;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span *ngIf="showMediaArea" class="badge">
|
<span *ngIf="showMediaArea" class="badge">
|
||||||
<i nz-icon nzType="user" nzTheme="outline"></i>
|
<i nz-icon nzType="user" nzTheme="outline"></i>
|
||||||
<span>{{data.authorName}}</span>
|
<span>{{data.author.displayName}}</span>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="showMediaArea" class="badge">
|
<span *ngIf="showMediaArea" class="badge">
|
||||||
<i nz-icon nzType="file" nzTheme="outline"></i>
|
<i nz-icon nzType="file" nzTheme="outline"></i>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<span *ngFor="let tag of data.tags">
|
<span *ngFor="let tag of data.tags">
|
||||||
<i nz-icon nzType="tag" nzTheme="outline"></i>
|
<i nz-icon nzType="tag" nzTheme="outline"></i>
|
||||||
<a [routerLink]="'/tags/'+tag">{{tag}}</a>
|
<a [routerLink]="'/tags/'+tag.name">{{tag.name}}</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class ArticleDetailCardComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
if (this.showMediaArea == null) {
|
if (this.showMediaArea == null) {
|
||||||
// 如果作者名不为空 则显示
|
// 如果作者名不为空 则显示
|
||||||
this.showMediaArea = this.data.authorName != null;
|
this.showMediaArea = this.data.author.displayName != null;
|
||||||
}
|
}
|
||||||
if (this.showTagArea == null) {
|
if (this.showTagArea == null) {
|
||||||
this.showTagArea = this.data.tags != null;
|
this.showTagArea = this.data.tags != null;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {PageList} from '../../class/HttpReqAndResp';
|
|||||||
import {ErrDispatch} from '../../class/ErrDispatch';
|
import {ErrDispatch} from '../../class/ErrDispatch';
|
||||||
import {RequestObj} from '../../class/HttpReqAndResp';
|
import {RequestObj} from '../../class/HttpReqAndResp';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {Tag} from '../../class/Tag';
|
import {Category, Tag} from '../../class/Tag';
|
||||||
import {Title} from '@angular/platform-browser';
|
import {Title} from '@angular/platform-browser';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -36,12 +36,11 @@ export class IndexComponent implements OnInit, ErrDispatch {
|
|||||||
desc: string;
|
desc: string;
|
||||||
articles: PageList<Article>;
|
articles: PageList<Article>;
|
||||||
tagNameAndNumber: { name: string, size: number }[];
|
tagNameAndNumber: { name: string, size: number }[];
|
||||||
categoryList: Tag[];
|
categoryList: Category[];
|
||||||
counts: {
|
counts: {
|
||||||
articleCount: number,
|
articleCount: number,
|
||||||
visitorCount: number,
|
visitorCount: number,
|
||||||
categoryCount: number,
|
categoryCount: number,
|
||||||
leaveMsgCount: number,
|
|
||||||
tagCount: number,
|
tagCount: number,
|
||||||
commentCount: number
|
commentCount: number
|
||||||
};
|
};
|
||||||
@@ -75,7 +74,7 @@ export class IndexComponent implements OnInit, ErrDispatch {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.apiService.categories().subscribe({
|
this.apiService.categories().subscribe({
|
||||||
next: data => this.categoryList = data.result,
|
next: data => this.categoryList = data.result.list,
|
||||||
error: err => {
|
error: err => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export class UpdateComponent implements OnInit {
|
|||||||
this.lastUpdate = 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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
|
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
|
||||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||||
import {Tag} from '../../../../class/Tag';
|
import {Category, Tag} from '../../../../class/Tag';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'c-publish-form',
|
selector: 'c-publish-form',
|
||||||
@@ -15,9 +15,9 @@ export class PublishFormComponent implements OnInit {
|
|||||||
@ViewChild('inputElement', {static: false}) tagInputElement: ElementRef;
|
@ViewChild('inputElement', {static: false}) tagInputElement: ElementRef;
|
||||||
|
|
||||||
@Input() tagNacList: { name: string, size: number }[];
|
@Input() tagNacList: { name: string, size: number }[];
|
||||||
@Input() categoryList: Tag[];
|
@Input() categoryList: Category[];
|
||||||
@Input() primaryData: { id: number, type: boolean, tags: string, category: string, url?: string };
|
@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 }>();
|
@Output() submitEvent = new EventEmitter<{ id: number, type: boolean, tags: string[], category: string, url?: string }>();
|
||||||
|
|
||||||
formGroup: FormGroup;
|
formGroup: FormGroup;
|
||||||
tagTmpList: string[] = [];
|
tagTmpList: string[] = [];
|
||||||
@@ -36,8 +36,8 @@ export class PublishFormComponent implements OnInit {
|
|||||||
if (this.primaryData) {
|
if (this.primaryData) {
|
||||||
this.formGroup.get('type').setValue(this.primaryData.type);
|
this.formGroup.get('type').setValue(this.primaryData.type);
|
||||||
const tags = this.primaryData.tags;
|
const tags = this.primaryData.tags;
|
||||||
this.formGroup.get('tagList').setValue(tags ? this.primaryData.tags.split(',') : tags);
|
this.formGroup.get('tagList').setValue(tags);
|
||||||
this.tagTmpList = tags ? this.primaryData.tags.split(',') : [...tags];
|
this.tagTmpList = tags;
|
||||||
this.formGroup.get('category').setValue(this.primaryData.category);
|
this.formGroup.get('category').setValue(this.primaryData.category);
|
||||||
this.formGroup.get('url').setValue(this.primaryData.url);
|
this.formGroup.get('url').setValue(this.primaryData.url);
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ export class PublishFormComponent implements OnInit {
|
|||||||
const formData = {
|
const formData = {
|
||||||
id: this.formGroup.value.isUpdate ? this.primaryData.id : null,
|
id: this.formGroup.value.isUpdate ? this.primaryData.id : null,
|
||||||
type: this.formGroup.value.type,
|
type: this.formGroup.value.type,
|
||||||
tags: this.formGroup.value.tagList.toString(),
|
tags: this.formGroup.value.tagList,
|
||||||
category: this.formGroup.value.category,
|
category: this.formGroup.value.category,
|
||||||
url: this.formGroup.value.type ? null : this.formGroup.value.url
|
url: this.formGroup.value.type ? null : this.formGroup.value.url
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export class WriteComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this.apiService.categories().subscribe({
|
this.apiService.categories().subscribe({
|
||||||
next: data => {
|
next: data => {
|
||||||
this.categoryList = data.result;
|
this.categoryList = data.result.list;
|
||||||
},
|
},
|
||||||
error: err => {
|
error: err => {
|
||||||
this.message.error('获取分类信息失败');
|
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.type = e.type;
|
||||||
this.article.tags = e.tags;
|
this.article.tags = e.tags;
|
||||||
this.article.category = e.category;
|
this.article.category = e.category;
|
||||||
this.article.url = e.url;
|
this.article.url = e.url;
|
||||||
this.article.id = e.id;
|
this.article.id = e.id;
|
||||||
|
|
||||||
if (!this.article.id && this.title === this.article.title) {
|
this.modalVisible = false;
|
||||||
this.message.error('文章标题未经更改,请修改后再发布');
|
|
||||||
return;
|
// if (!this.article.id && this.title === this.article.title) {
|
||||||
}
|
// this.message.error('文章标题未经更改,请修改后再发布');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
// 文章 暂存
|
// 文章 暂存
|
||||||
localStorage.setItem('tmpArticle', JSON.stringify(this.article));
|
localStorage.setItem('tmpArticle', JSON.stringify(this.article));
|
||||||
@@ -182,7 +184,9 @@ export class WriteComponent implements OnInit {
|
|||||||
next: data => {
|
next: data => {
|
||||||
this.article.category = data.result.category;
|
this.article.category = data.result.category;
|
||||||
this.article.mdContent = data.result.mdContent;
|
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.type = data.result.original;
|
||||||
this.article.url = data.result.url;
|
this.article.url = data.result.url;
|
||||||
this.article.title = data.result.title;
|
this.article.title = data.result.title;
|
||||||
|
|||||||
Reference in New Issue
Block a user