This commit is contained in:
禾几海
2020-07-02 23:16:34 +08:00
parent 8bd8986bdd
commit c8fe9c3658
5 changed files with 36 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
<common-table cardTitle="文章管理" <common-table cardTitle="文章管理"
#commonTableComponent #commonTableComponent
[data]="headData" [headData]="headData"
[request]="request" [request]="request"
[template]="{ [template]="{
original:{temp:original,param:{true:'原创',false:'转载'}}, original:{temp:original,param:{true:'原创',false:'转载'}},

View File

@@ -33,21 +33,21 @@ export class AdminArticleComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.title.setTitle('小海博客 | 文章管理') this.title.setTitle('小海博客 | 文章管理')
this.headData = [ this.headData = [
{fieldName: '主键', fieldValue: 'id', show: false, primaryKey: true}, {title: '主键', fieldValue: 'id', show: false, primaryKey: true},
{fieldName: '标题', fieldValue: 'title', show: true}, {title: '标题', fieldValue: 'title', show: true},
{fieldName: '分类', fieldValue: 'category', show: true}, {title: '分类', fieldValue: 'category', show: true},
{fieldName: '文章类型', fieldValue: 'original', show: true}, {title: '文章类型', fieldValue: 'original', show: true},
{fieldName: '阅读量', fieldValue: 'readingNumber', show: true}, {title: '阅读量', fieldValue: 'readingNumber', show: true},
{fieldName: '👍数', fieldValue: 'likeCount', show: true}, {title: '👍数', fieldValue: 'likeCount', show: true},
{fieldName: '👎数', fieldValue: 'dislikeCount', show: true}, {title: '👎数', fieldValue: 'dislikeCount', show: true},
{fieldName: '发布日期', fieldValue: 'publishDateFormat', show: true}, {title: '发布日期', fieldValue: 'publishDateFormat', show: true},
{fieldName: '更新日期', fieldValue: 'updateDateFormat', show: true}, {title: '更新日期', fieldValue: 'updateDateFormat', show: true},
{fieldName: '状态', fieldValue: 'open', show: true}, {title: '状态', fieldValue: 'open', show: true},
{fieldName: '简介', fieldValue: 'summary', show: false}, {title: '简介', fieldValue: 'summary', show: false},
{fieldName: '作者', fieldValue: 'author.displayName', show: false}, {title: '作者', fieldValue: 'author.displayName', show: false},
{fieldName: '标签数', fieldValue: 'tags.length', show: false}, {title: '标签数', fieldValue: 'tags.length', show: false},
{ {
fieldName: '操作', fieldValue: '', show: true, isActionColumns: true, title: '操作', fieldValue: '', show: true, isActionColumns: true,
action: [ action: [
{name: '查看', click: (d) => this.router.navigateByUrl(`/article/${d.id}`)}, {name: '查看', click: (d) => this.router.navigateByUrl(`/article/${d.id}`)},
{name: '删除', color: '#ff0000', needConfirm: true, click: (d) => this.deleteArticle(d)}, {name: '删除', color: '#ff0000', needConfirm: true, click: (d) => this.deleteArticle(d)},

View File

@@ -50,11 +50,15 @@
</ng-template> </ng-template>
--> -->
<common-table [request]="request" [data]="headData" cardTitle="评论管理" <common-table [request]="request" [headData]="headData" cardTitle="评论管理"
[template]="{status:{temp:status,param:{'0':' 正常 ','3':'已删除'}}}"> [template]="{status:{temp:status,param:{'0':' 正常 ','3':'已删除'}},content:{temp:content}}">
</common-table> </common-table>
<ng-template let-originValue="originValue" let-value="value" #status> <ng-template let-originValue="originValue" let-value="value" #status>
<nz-tag nzColor="geekblue" *ngIf="originValue==0">{{value}}</nz-tag> <nz-tag nzColor="geekblue" *ngIf="originValue==0">{{value}}</nz-tag>
<nz-tag nzColor="#f50" *ngIf="originValue==3">{{value}}</nz-tag> <nz-tag nzColor="#f50" *ngIf="originValue==3">{{value}}</nz-tag>
</ng-template> </ng-template>
<ng-template #content let-value="value">
<editable-tag [showBorder]="false" [text]="value" (valueChange)="textChange($event)"></editable-tag>
</ng-template>

View File

@@ -50,16 +50,16 @@ export class AdminCommentComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.headData = [ this.headData = [
{fieldName: '主键', fieldValue: 'id', show: false, primaryKey: true}, {title: '主键', fieldValue: 'id', show: false, primaryKey: true},
{fieldName: '评论路径', fieldValue: 'pagePath', show: true}, {title: '评论路径', fieldValue: 'pagePath', show: true},
{fieldName: '评论创建者昵称', fieldValue: 'fromUser.displayName', show: true}, {title: '评论创建者昵称', fieldValue: 'fromUser.displayName', show: true},
{fieldName: '评论接收者昵称', fieldValue: 'toUser.displayName', show: true}, {title: '评论内容', fieldValue: 'content', show: true},
{fieldName: '评论内容', fieldValue: 'content', show: false}, {title: '评论接收者昵称', fieldValue: 'toUser.displayName', show: true},
{fieldName: '评论日期', fieldValue: 'date', show: true}, {title: '评论日期', fieldValue: 'date', show: true},
{fieldName: '父评论id', fieldValue: 'pid', show: false}, {title: '父评论id', fieldValue: 'pid', show: false},
{fieldName: '状态', fieldValue: 'status', show: true}, {title: '状态', fieldValue: 'status', show: true},
{ {
fieldName: '操作', title: '操作',
fieldValue: '', fieldValue: '',
show: true, show: true,
isActionColumns: true, isActionColumns: true,
@@ -118,4 +118,8 @@ export class AdminCommentComponent implements OnInit {
// this.editInfo.content.responseId = data.responseId; // this.editInfo.content.responseId = data.responseId;
this.editInfo.editFocus = true; this.editInfo.editFocus = true;
} }
textChange(value: { value: string; originalValue: string; changed: boolean }) {
console.log(value)
}
} }

View File

@@ -4,6 +4,7 @@ import {RouterModule} from '@angular/router';
import {AdminCommentComponent} from './admin-comment.component'; import {AdminCommentComponent} from './admin-comment.component';
import {CommonTableModule} from '../components/common-table/common-table.module'; import {CommonTableModule} from '../components/common-table/common-table.module';
import {NzTagModule} from 'ng-zorro-antd'; import {NzTagModule} from 'ng-zorro-antd';
import {EditableTagModule} from '../components/editable-tag/editable-tag.module';
@NgModule({ @NgModule({
@@ -15,6 +16,7 @@ import {NzTagModule} from 'ng-zorro-antd';
RouterModule.forChild([{path: '', component: AdminCommentComponent}]), RouterModule.forChild([{path: '', component: AdminCommentComponent}]),
CommonTableModule, CommonTableModule,
NzTagModule, NzTagModule,
EditableTagModule,
] ]
}) })
export class AdminCommentModule { export class AdminCommentModule {