43 changed files with 277 additions and 66 deletions
@ -0,0 +1,46 @@ |
|||||
|
<h1>License 管理</h1> |
||||
|
@if (license.time.includes('过期')) { |
||||
|
<nz-alert nzShowIcon [nzType]="'warning'" nzMessage="授权证书已过期"> </nz-alert> |
||||
|
} @else { |
||||
|
<nz-alert nzShowIcon [nzType]="'success'" nzMessage="授权生效中"> </nz-alert> |
||||
|
} |
||||
|
|
||||
|
<div class="mt-4"> |
||||
|
<nz-table nzTemplateMode nzBordered> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td>证书标题</td> |
||||
|
<td> |
||||
|
{{ license.subject }} |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>描述信息</td> |
||||
|
<td> |
||||
|
{{ license.description }} |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>授权时间</td> |
||||
|
<td> |
||||
|
{{ license.time }} |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>更新证书</td> |
||||
|
<td> |
||||
|
<button class="upload-btn" nz-button [nzLoading]="uploadLoading"> |
||||
|
<i nz-icon nzType="upload"></i> |
||||
|
选择证书 |
||||
|
<input type="file" (change)="onFileChange($event)" /> |
||||
|
</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</nz-table> |
||||
|
@if (!license.time.includes('过期')) { |
||||
|
<div class="mt-4 flex"> |
||||
|
<button nz-button nzType="primary" [routerLink]="['/']">回到首页</button> |
||||
|
</div> |
||||
|
} |
||||
|
</div> |
@ -0,0 +1,55 @@ |
|||||
|
import { Component, Input, OnInit } from '@angular/core' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { finalize } from 'rxjs' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-license', |
||||
|
standalone: true, |
||||
|
imports: [SharedModule], |
||||
|
templateUrl: './license.component.html', |
||||
|
styleUrl: './license.component.less', |
||||
|
}) |
||||
|
export class LicenseComponent implements OnInit { |
||||
|
constructor( |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
license: NzSafeAny = null |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
this.loadLicense() |
||||
|
} |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
loadLicense() { |
||||
|
this.api.getLicenseInfo().subscribe((res) => { |
||||
|
this.license = res.body |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.uploadLoading = true |
||||
|
this.api |
||||
|
.uploadLicenseInfo(formdata) |
||||
|
.pipe( |
||||
|
finalize(() => { |
||||
|
this.uploadLoading = false |
||||
|
}), |
||||
|
) |
||||
|
.subscribe((res) => { |
||||
|
this.msg.success(res.desc) |
||||
|
this.loadLicense() |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
<div class="page-container"> |
||||
|
<div class="bg-white w-1/2 h-[500px] shadow-md p-6"> |
||||
|
<app-license /> |
||||
|
</div> |
||||
|
</div> |
@ -0,0 +1,8 @@ |
|||||
|
.page-container { |
||||
|
position: fixed; |
||||
|
inset: 0; |
||||
|
z-index: 100; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
import { Component } from '@angular/core' |
||||
|
import { LicenseComponent } from 'app/components/license/license.component' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-upload-license', |
||||
|
standalone: true, |
||||
|
imports: [SharedModule, LicenseComponent], |
||||
|
templateUrl: './license.component.html', |
||||
|
styleUrl: './license.component.less', |
||||
|
}) |
||||
|
export class LicensePageComponent {} |
@ -0,0 +1,5 @@ |
|||||
|
<div class="p-4"> |
||||
|
<nz-card [nzBordered]="false"> |
||||
|
<app-license /> |
||||
|
</nz-card> |
||||
|
</div> |
@ -0,0 +1,12 @@ |
|||||
|
import { Component } from '@angular/core' |
||||
|
import { LicenseComponent } from 'app/components/license/license.component' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-system-license', |
||||
|
standalone: true, |
||||
|
imports: [SharedModule, LicenseComponent], |
||||
|
templateUrl: './license.component.html', |
||||
|
styleUrl: './license.component.less', |
||||
|
}) |
||||
|
export class SystemLicenseComponent {} |
Loading…
Reference in new issue