update to 14

This commit is contained in:
2022-12-01 23:50:05 +08:00
parent 548a2014d9
commit 7cba060b9f
8 changed files with 51 additions and 52 deletions

View File

@@ -3,7 +3,7 @@ import {RequestObj, Response} from '../../../class/HttpReqAndResp';
import {Link} from '../../../class/Link';
import {ApiService} from '../../../api/api.service';
import {NzMessageService} from 'ng-zorro-antd/message';
import {FormControl, FormGroup, Validators} from '@angular/forms';
import {UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {Observable} from 'rxjs';
import {Title} from '@angular/platform-browser';
import {CommonTableComponent} from '../components/common-table/common-table.component';
@@ -18,27 +18,27 @@ export class AdminLinkComponent implements OnInit {
@ViewChild('commonTableComponent') commonTableComponent: CommonTableComponent<Link>;
modalVisible: boolean = false;
modalTitle: string = '';
formGroup: FormGroup;
formGroup: UntypedFormGroup;
request: RequestObj;
headData: Data<Link>[];
constructor(private apiService: ApiService, private messageService: NzMessageService, private title: Title) {
this.title.setTitle('小海博客 | 友链管理');
this.formGroup = new FormGroup({
id: new FormControl(null),
name: new FormControl(null, [Validators.required]),
url: new FormControl(null, [
this.formGroup = new UntypedFormGroup({
id: new UntypedFormControl(null),
name: new UntypedFormControl(null, [Validators.required]),
url: new UntypedFormControl(null, [
Validators.required,
Validators.pattern(/^(https:\/\/|http:\/\/|)([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$/)
]
),
open: new FormControl(null, [Validators.required]),
desc: new FormControl(null, [Validators.maxLength(255)]),
iconPath: new FormControl(null, [
open: new UntypedFormControl(null, [Validators.required]),
desc: new UntypedFormControl(null, [Validators.maxLength(255)]),
iconPath: new UntypedFormControl(null, [
Validators.pattern(/^(https:\/\/|http:\/\/|)([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$/)
]
),
oper: new FormControl(null)
oper: new UntypedFormControl(null)
});
}

View File

@@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {NzMessageService} from 'ng-zorro-antd/message';
import {Title} from '@angular/platform-browser';
import {FormControl, FormGroup} from '@angular/forms';
import {UntypedFormControl, UntypedFormGroup} from '@angular/forms';
import {RequestObj} from '../../../class/HttpReqAndResp';
import {ApiService} from '../../../api/api.service';
import {User} from '../../../class/User';
@@ -21,20 +21,20 @@ export class AdminUserComponent implements OnInit {
isEdit: false,
resetPwd: false
};
formGroup: FormGroup;
formGroup: UntypedFormGroup;
headData: Data<User>[];
request: RequestObj;
constructor(private apiService: ApiService, private title: Title, private messageService: NzMessageService,
private userService: GlobalUserService) {
this.formGroup = new FormGroup({
id: new FormControl(null),
email: new FormControl(''),
displayName: new FormControl(''),
emailStatus: new FormControl(null),
desc: new FormControl(null),
role: new FormControl(null),
pwd: new FormControl(''),
this.formGroup = new UntypedFormGroup({
id: new UntypedFormControl(null),
email: new UntypedFormControl(''),
displayName: new UntypedFormControl(''),
emailStatus: new UntypedFormControl(null),
desc: new UntypedFormControl(null),
role: new UntypedFormControl(null),
pwd: new UntypedFormControl(''),
});
this.userService.watchUserInfo({
next: data => this.user = data.result,

View File

@@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {AbstractControl, FormControl, FormGroup, Validators} from '@angular/forms';
import {AbstractControl, UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {NzMessageService} from 'ng-zorro-antd/message';
import {NzUploadFile} from 'ng-zorro-antd/upload';
import {Router} from '@angular/router';
@@ -23,8 +23,8 @@ export class AdminComponent implements OnInit {
sayHelloContent: string;
editInfoModalVisible: boolean = false;
resetPwdModalVisible: boolean = false;
editInfoFormGroup: FormGroup;
resetPwdFormGroup: FormGroup;
editInfoFormGroup: UntypedFormGroup;
resetPwdFormGroup: UntypedFormGroup;
noAvatarUrl = 'https://cdn.celess.cn/';
host: string;
@@ -39,17 +39,17 @@ export class AdminComponent implements OnInit {
}
}
);
this.editInfoFormGroup = new FormGroup({
desc: new FormControl(),
displayName: new FormControl(),
email: new FormControl({value: null, disabled: true})
this.editInfoFormGroup = new UntypedFormGroup({
desc: new UntypedFormControl(),
displayName: new UntypedFormControl(),
email: new UntypedFormControl({value: null, disabled: true})
});
this.resetPwdFormGroup = new FormGroup({
originPwd: new FormControl(null, [Validators.required]),
newPwd: new FormControl(null, [
this.resetPwdFormGroup = new UntypedFormGroup({
originPwd: new UntypedFormControl(null, [Validators.required]),
newPwd: new UntypedFormControl(null, [
Validators.required, Validators.minLength(6), Validators.maxLength(16), Validators.pattern(/^[\w_-]{6,16}$/)
]),
newPwdConfirm: new FormControl(null, [
newPwdConfirm: new UntypedFormControl(null, [
Validators.required, Validators.minLength(6), Validators.maxLength(16), Validators.pattern(/^[\w_-]{6,16}$/),
this.checkSamePwd()
]),