From 0509519e7f4b51bb943c97884507a2aea19532aa Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 11 Jan 2023 17:23:22 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=A2=9E=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83=E5=8E=BB=E6=8E=89?= =?UTF-8?q?logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../change-password/change-password.component.ts | 3 ++- src/app/pages/home/home.component.html | 2 +- src/app/pages/home/home.component.ts | 8 +++++--- src/app/pages/login/forget/forget.component.ts | 9 +++++---- src/app/pages/login/login.component.html | 9 ++++----- src/app/pages/login/login.component.ts | 7 +++++-- src/app/service/pattern.service.ts | 13 +++++++++++++ .../navigation/navigation.component.html | 2 +- .../navigation/navigation.component.ts | 5 ++++- 9 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 src/app/service/pattern.service.ts diff --git a/src/app/pages/change-password/change-password.component.ts b/src/app/pages/change-password/change-password.component.ts index 7eae4fb..2663989 100644 --- a/src/app/pages/change-password/change-password.component.ts +++ b/src/app/pages/change-password/change-password.component.ts @@ -22,6 +22,7 @@ export class ChangePasswordComponent implements OnInit { } } +import { PatternService } from 'src/app/service/pattern.service'; export type MyErrorsOptions = { 'zh-cn': string; en: string } & Record; export type MyValidationErrors = Record; @@ -33,7 +34,7 @@ export class MyValidators extends Validators { return null; } - return isPassword(value) ? null : { mobile: { 'zh-cn': `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符`, en: `Password phone number is not valid` } }; + return isPassword(value) ? null : { mobile: { 'zh-cn': PatternService.isProd ? `长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种,且口令禁止包含 sinochem、sino、zhonghua (含大小写变体) 等中国中化相关字符` : '长度至少 8 位,必须包含大写字母、小写字母、数字、符号四种中的三种', en: `Password phone number is not valid` } }; } } diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html index 0ab9bf3..4f08f8d 100644 --- a/src/app/pages/home/home.component.html +++ b/src/app/pages/home/home.component.html @@ -4,7 +4,7 @@ --> \ No newline at end of file diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 5d2db0b..3f36c37 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -10,6 +10,7 @@ import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { SelectedMenu } from 'src/app/service/selectedMenu.service'; import { NzModalService } from 'ng-zorro-antd/modal'; import { ForgetComponent } from './forget/forget.component'; +import { PatternService } from 'src/app/service/pattern.service'; // import { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; declare var abp: any @@ -22,7 +23,7 @@ export class LoginComponent implements OnInit { validateForm!: FormGroup; passwordValidateForm!: FormGroup; - constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public token: CacheTokenService, private fb: FormBuilder, private message: NzMessageService, private notificationService: NzNotificationService, private selectedMenu: SelectedMenu, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { + constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public token: CacheTokenService, private fb: FormBuilder, private message: NzMessageService, private notificationService: NzNotificationService, private selectedMenu: SelectedMenu, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private patternService: PatternService) { const { password } = MyValidators; this.validateForm = this.fb.group({ userName: [null, [Validators.required]], @@ -37,8 +38,10 @@ export class LoginComponent implements OnInit { }); } - ngOnInit() { + isProd: boolean + ngOnInit() { + this.isProd = this.patternService.isProd //如果本地储存了账号密码信息,那就回显在输入框 let account = localStorage.getItem('account') let password = localStorage.getItem('password') diff --git a/src/app/service/pattern.service.ts b/src/app/service/pattern.service.ts new file mode 100644 index 0000000..813dfe3 --- /dev/null +++ b/src/app/service/pattern.service.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class PatternService { + static isProd: any = true; + + constructor() { } + + public isProd: boolean = true //是否是生产环境 + +} diff --git a/src/app/system-management/navigation/navigation.component.html b/src/app/system-management/navigation/navigation.component.html index 9a4135c..8d9c5d7 100644 --- a/src/app/system-management/navigation/navigation.component.html +++ b/src/app/system-management/navigation/navigation.component.html @@ -2,7 +2,7 @@
diff --git a/src/app/system-management/navigation/navigation.component.ts b/src/app/system-management/navigation/navigation.component.ts index 06b9301..95a1ec7 100644 --- a/src/app/system-management/navigation/navigation.component.ts +++ b/src/app/system-management/navigation/navigation.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { PatternService } from 'src/app/service/pattern.service'; @Component({ selector: 'app-navigation', @@ -8,7 +9,7 @@ import { Router } from '@angular/router'; }) export class NavigationComponent implements OnInit { - constructor(private router: Router) { } + constructor(private router: Router, private patternService: PatternService) { } userMenu = [] menu = [] tap = [] @@ -33,7 +34,9 @@ export class NavigationComponent implements OnInit { ] name + isProd: boolean ngOnInit(): void { + this.isProd = this.patternService.isProd let a = sessionStorage.getItem('userdata') this.userMenu = JSON.parse(a).menus this.name = JSON.parse(a).name