增加刷新按钮

This commit is contained in:
禾几海
2020-05-27 16:41:32 +08:00
parent dba21730ca
commit e66d3bbf62
9 changed files with 44 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
<div class="inner-content"> <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> <button nz-button (click)="addLink()" style="margin-bottom: 15px">新增</button>
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex" <nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'1200px'}" [nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'1200px'}"
@@ -29,6 +29,10 @@
</nz-card> </nz-card>
</div> </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()" <nz-modal [(nzVisible)]="modalVisible" [nzTitle]="modalTitle" (nzOnOk)="modalConfirm()"
(nzOnCancel)="modalVisible = false" [nzClosable]="true" [nzOkDisabled]="!formGroup.valid"> (nzOnCancel)="modalVisible = false" [nzClosable]="true" [nzOkDisabled]="!formGroup.valid">
<form nz-form [formGroup]="formGroup"> <form nz-form [formGroup]="formGroup">

View File

@@ -1,7 +1,7 @@
<div class="inner-content"> <div class="inner-content">
<nz-card nzTitle="" nzSize="small"> <nz-card nzTitle="" nzSize="small">
<nz-tabset> <nz-tabset [nzTabBarExtraContent]="reload">
<nz-tab nzTitle="分类管理" (nzClick)="editInfo.editFocus=false"> <nz-tab nzTitle="分类管理" (nzClick)="tabChanged('tag')">
<div style="margin-bottom: 15px;"> <div style="margin-bottom: 15px;">
<nz-input-group *ngIf="editInfo.editFocus&&editInfo.isAdd" [nzPrefix]="tagIcon" <nz-input-group *ngIf="editInfo.editFocus&&editInfo.isAdd" [nzPrefix]="tagIcon"
style="width: 200px"> style="width: 200px">
@@ -49,7 +49,7 @@
</tbody> </tbody>
</nz-table> </nz-table>
</nz-tab> </nz-tab>
<nz-tab nzTitle="标签管理" (nzClick)="editInfo.editFocus=false"> <nz-tab nzTitle="标签管理" (nzClick)="tabChanged('category')">
<nz-table #tagTable [nzData]="tagPageList.list" [nzTotal]="tagPageList.total" <nz-table #tagTable [nzData]="tagPageList.list" [nzTotal]="tagPageList.total"
[(nzPageIndex)]="pageIndex" [nzScroll]="{x:'800px'}" [(nzPageIndex)]="pageIndex" [nzScroll]="{x:'800px'}"
[nzPageSize]="pageSize" (nzPageIndexChange)="getTag()" nzFrontPagination="false"> [nzPageSize]="pageSize" (nzPageIndexChange)="getTag()" nzFrontPagination="false">
@@ -90,3 +90,8 @@
</nz-card> </nz-card>
</div> </div>
<ng-template #tagIcon><i nz-icon nzType="tag" nzTheme="outline"></i></ng-template> <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>

View File

@@ -29,15 +29,17 @@ export class AdminTagComponent implements OnInit {
pageIndex: number = 1; pageIndex: number = 1;
pageSize: number = 10; pageSize: number = 10;
getData: any;
ngOnInit(): void { ngOnInit(): void {
this.title.setTitle('小海博客 | 标签分类管理') this.title.setTitle('小海博客 | 标签分类管理')
this.getCategory(); this.getCategory();
this.getTag(); this.getTag();
this.getData = this.getTag;
} }
getCategory = () => this.apiService.categories().subscribe({ getCategory = () => this.apiService.categories().subscribe({
next: data => this.categoryList = data.result, next: data => this.categoryList = data.result.list,
complete: () => this.loading = false, complete: () => this.loading = false,
error: err => this.loading = false error: err => this.loading = false
}) })
@@ -138,4 +140,12 @@ export class AdminTagComponent implements OnInit {
this.editInfo.isAdd = false this.editInfo.isAdd = false
this.editInfo.name = null this.editInfo.name = null
} }
tabChanged(mode: 'tag' | 'category') {
this.editInfo.editFocus = false
if (mode === 'tag')
this.getData = this.getTag;
else
this.getData = this.getCategory;
}
} }

View File

@@ -1,5 +1,5 @@
<div class="inner-content"> <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> <button nz-button (click)="showModal()" style="margin-bottom: 15px;">新增</button>
<nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex" <nz-table #table [nzData]="pageList.list" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}" [nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
@@ -30,3 +30,6 @@
(nzOnOk)="confirm()" [nzTitle]="modalData.title"> (nzOnOk)="confirm()" [nzTitle]="modalData.title">
<textarea nz-input [(ngModel)]="modalData.content" [nzAutosize]="{ minRows: 2, maxRows: 8 }"></textarea> <textarea nz-input [(ngModel)]="modalData.content" [nzAutosize]="{ minRows: 2, maxRows: 8 }"></textarea>
</nz-modal> </nz-modal>
<ng-template #reload>
<a (click)="getUpdateInfo()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
</ng-template>

View File

@@ -5,7 +5,7 @@ import {AdminUpdateComponent} from './admin-update.component';
import { import {
NzButtonModule, NzButtonModule,
NzCardModule, NzCardModule,
NzDividerModule, NzInputModule, NzModalModule, NzDividerModule, NzIconModule, NzInputModule, NzModalModule,
NzPopconfirmModule, NzPopconfirmModule,
NzTableModule, NzTableModule,
NzToolTipModule, NzToolTipModule,
@@ -30,7 +30,8 @@ import {FormsModule} from '@angular/forms';
NzModalModule, NzModalModule,
FormsModule, FormsModule,
NzButtonModule, NzButtonModule,
NzInputModule NzInputModule,
NzIconModule
] ]
}) })
export class AdminUpdateModule { export class AdminUpdateModule {

View File

@@ -1,5 +1,5 @@
<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" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}" [nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
(nzPageIndexChange)="getUser()" nzFrontPagination="false"> (nzPageIndexChange)="getUser()" nzFrontPagination="false">
@@ -115,3 +115,8 @@
</ng-template> </ng-template>
</nz-modal> </nz-modal>
<ng-template #reload>
<a (click)="getUser()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
</ng-template>

View File

@@ -1,5 +1,5 @@
<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" [nzTotal]="pageList.total" [(nzPageIndex)]="pageIndex"
[nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}" [nzPageSize]="pageSize" [nzLoading]="loading" [nzScroll]="{x:'800px'}"
(nzPageIndexChange)="getVisitors()" nzFrontPagination="false"> (nzPageIndexChange)="getVisitors()" nzFrontPagination="false">
@@ -22,3 +22,6 @@
</nz-table> </nz-table>
</nz-card> </nz-card>
</div> </div>
<ng-template #reload>
<a (click)="getVisitors()" title="刷新"><i nz-icon nzType="reload" nzTheme="outline"></i></a>
</ng-template>

View File

@@ -2,7 +2,7 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {AdminVisitorComponent} from './admin-visitor.component'; 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({ @NgModule({
@@ -15,7 +15,8 @@ import {NzButtonModule, NzCardModule, NzDividerModule, NzTableModule} from 'ng-z
NzCardModule, NzCardModule,
NzTableModule, NzTableModule,
NzButtonModule, NzButtonModule,
NzDividerModule NzDividerModule,
NzIconModule
] ]
}) })
export class AdminVisitorModule { export class AdminVisitorModule {

View File

@@ -24,7 +24,6 @@ export class AdminComponent implements OnInit {
next: data => { next: data => {
console.log('更新user') console.log('更新user')
this.user = data.result this.user = data.result
this.user.avatarImgUrl += '?t=' + Date.now();
if (data.result) this.initHelloWords() if (data.result) this.initHelloWords()
} }
} }