diff --git a/index/src/app/view/admin/admin-comment/admin-comment.component.ts b/index/src/app/view/admin/admin-comment/admin-comment.component.ts index c17b567..f1693d1 100644 --- a/index/src/app/view/admin/admin-comment/admin-comment.component.ts +++ b/index/src/app/view/admin/admin-comment/admin-comment.component.ts @@ -3,6 +3,7 @@ import {NzMessageService} from 'ng-zorro-antd'; import {ApiService} from '../../../api/api.service'; import {PageList} from '../../../class/HttpReqAndResp'; import {Comment, CommentReq} from '../../../class/Comment'; +import {GlobalUserService} from '../../../services/global-user.service'; @Component({ selector: 'app-admin-comment', @@ -11,7 +12,23 @@ import {Comment, CommentReq} from '../../../class/Comment'; }) export class AdminCommentComponent implements OnInit { - constructor(private apiService: ApiService, private messageService: NzMessageService) { + constructor(private apiService: ApiService, private messageService: NzMessageService, private userService: GlobalUserService) { + this.userService.watchUserInfo({ + next: data => { + if (data.result) { + if (data.result.role === 'admin') { + this.getComment = this.getCommentForAdmin; + } else { + this.getComment = this.getCommentForUser; + } + } else { + this.getComment = this.getCommentForUser; + } + this.getComment() + }, + error: null, + complete: null + }) } loading: boolean = true; @@ -23,12 +40,20 @@ export class AdminCommentComponent implements OnInit { content: new CommentReq(true), editFocus: false, } + getComment: any;// 存放获取评论的方法 + ngOnInit(): void { - this.getComment(); } - getComment = () => this.apiService.getCommentByTypeForAdmin(true, this.pageIndex, this.pageSize).subscribe({ + + getCommentForAdmin = () => this.apiService.getCommentByTypeForAdmin(true, 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({ next: data => this.pageList = data.result, complete: () => this.loading = false, error: err => this.loading = false diff --git a/index/src/app/view/admin/admin-dashboard/admin-dashboard.component.html b/index/src/app/view/admin/admin-dashboard/admin-dashboard.component.html index 4678b48..90fd9d9 100644 --- a/index/src/app/view/admin/admin-dashboard/admin-dashboard.component.html +++ b/index/src/app/view/admin/admin-dashboard/admin-dashboard.component.html @@ -1,42 +1,67 @@ -
{{logText}}
- 此博客由 禾几海(郑海) 设计并实现的
+博客自2019年3月开始开发编写 5月开始正式运行至今
+博客所有代码都是开源的,你可以随意修改,运行和发布
+
+ 后端代码可以在此处找到
+
如果觉得博客还不错,请前往Github支持我,给我点一个star吧
+坚强的信心,能使平凡的人做出惊人的事业。
+——马尔顿
+