From 919b8c2b99cbf4dae5e4eccd3722415edac993fd Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 24 Mar 2023 17:48:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=90=86=E5=95=86?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/login/login/login.component.html | 4 ++-- src/app/admin/login/login/login.component.ts | 22 ++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/app/admin/login/login/login.component.html b/src/app/admin/login/login/login.component.html index 1eb40fd..95b7cd0 100644 --- a/src/app/admin/login/login/login.component.html +++ b/src/app/admin/login/login/login.component.html @@ -50,10 +50,10 @@ -

验证码

+

验证码

- +
diff --git a/src/app/admin/login/login/login.component.ts b/src/app/admin/login/login/login.component.ts index b4b1a47..ee9049a 100644 --- a/src/app/admin/login/login/login.component.ts +++ b/src/app/admin/login/login/login.component.ts @@ -16,22 +16,20 @@ import {HttpClient} from '@angular/common/http'; export class LoginComponent implements OnInit { loginForm: FormGroup; // 登录表单 - code:string=""; - + code: string; constructor(private store: LocalStorageService, // 数据请求 private router: Router, // 路由 private form: FormBuilder, // 表单校验 private http: HttpClient, // http请求 private loginService: LoginService, - private message: NzMessageService, - private modal: NzModalService) { + private message: NzMessageService) { } ngOnInit() { this.loginForm = this.form.group({ loginName: [null, [Validators.required]], password: [null, [Validators.required]], - vertifyCode:[null, [Validators.required]]//验证码 + verifyCode: [null, [Validators.required]] }); } @@ -40,29 +38,23 @@ export class LoginComponent implements OnInit { */ submitLogin() { - - // tslint:disable-next-line:forin for (const i in this.loginForm.controls) { this.loginForm.controls[i].markAsDirty(); this.loginForm.controls[i].updateValueAndValidity(); } if (this.loginForm.status == null || this.loginForm.status !== 'VALID') { - // this.modal.warning({ - // nzTitle: '提示', - // nzContent: '请填写用户和密码', - // }); return; } - if(this.loginForm.value.vertifyCode.toLowerCase() !== this.code ){ - this.message.error("请填写正确的验证码"); + if (this.loginForm.value.verifyCode.toLowerCase() !== this.code ) { + this.message.error('请填写正确的验证码'); return; } this.loginService.userLogin(this.loginForm.value, data => { if (data['return_code'] === '000000') { - data['return_data']['object']['menuList'] = data['return_data']['object']['menuList'].filter(o => o.showOnMobile == 0); + data['return_data']['object']['menuList'] = data['return_data']['object']['menuList'].filter(o => o.showOnMobile === 0); this.store.set(ADMIN_INFO_OBJECT, data['return_data']['object']); this.store.set(TOKEN, data['return_data']['uniqueCode']); this.store.set(INIT_FLAG, true); @@ -76,7 +68,7 @@ export class LoginComponent implements OnInit { } // 子组件验证方法 - validateFun(str:string) { + validateFun(str: string) { this.code = str; } }