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()
]),

View File

@@ -4,7 +4,7 @@ import {NzModalService} from 'ng-zorro-antd/modal';
import {Title} from '@angular/platform-browser';
import {ApiService} from '../../api/api.service';
import {ApplyLinkReq, Link} from '../../class/Link';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {UntypedFormBuilder, UntypedFormGroup, Validators} from '@angular/forms';
import {Color, randomColor} from '../../utils/color';
@Component({
@@ -19,14 +19,14 @@ export class LinkComponent implements OnInit {
link: Link;
linkList: Link[];
loading: boolean = false;
applyFormGroup: FormGroup;
applyFormGroup: UntypedFormGroup;
colors: Color[];
private lastUrl: string = '';
constructor(private message: NzMessageService,
private titleService: Title,
private apiService: ApiService,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private modal: NzModalService) {
titleService.setTitle('小海博客 | 友链');
}

View File

@@ -1,5 +1,5 @@
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {UntypedFormBuilder, UntypedFormGroup, Validators} from '@angular/forms';
import {Category} from '../../../../class/Tag';
import {COLOR_LIST} from '../../../../utils/color';
@@ -22,14 +22,14 @@ export class PublishFormComponent implements OnInit {
isUpdate: boolean;
url?: string;
}>();
formGroup: FormGroup;
formGroup: UntypedFormGroup;
tagTmpList: string[] = [];
tagInputVisible: boolean = false;
tagListTouched: boolean = false;
editTagText: string = '新增';
color: string[] = [];
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
randomColor = () => this.color = COLOR_LIST.map(c => c.bgColor).sort(() => Math.floor(Math.random() * 2));