|
@@ -156,6 +156,8 @@ export class UserLoginComponent implements OnDestroy, OnInit {
|
|
|
showForgetPasswordButton = false;
|
|
|
registerButtonName = '注册账号';
|
|
|
registerUrl = '/passport/login';
|
|
|
+ lastClickTime = 0;
|
|
|
+ clickInterval = 1000; // 设置合适的点击间隔
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
const queryInfos = { enabled: 'Y' };
|
|
@@ -227,6 +229,11 @@ export class UserLoginComponent implements OnDestroy, OnInit {
|
|
|
this.password.updateValueAndValidity({ onlySelf: true });
|
|
|
return;
|
|
|
}
|
|
|
+ const currentTime = Date.now();
|
|
|
+ if (currentTime - this.lastClickTime < this.clickInterval) {
|
|
|
+ return; // 忽略点击事件
|
|
|
+ }
|
|
|
+ this.lastClickTime = currentTime;
|
|
|
this.http
|
|
|
.post('inControlServer/qualityInspection/zhcxApi/sendCode?_allow_anonymous=true', {
|
|
|
account: this.userName.value,
|
|
@@ -243,7 +250,25 @@ export class UserLoginComponent implements OnDestroy, OnInit {
|
|
|
// }
|
|
|
if (res.code == '200') {
|
|
|
this.phone = res.data.phone;
|
|
|
+ this.btnContent = 59;
|
|
|
+ this.interval$ = setInterval(() => {
|
|
|
+ this.btnContent -= 1;
|
|
|
+ if (this.btnContent <= 0) {
|
|
|
+ clearInterval(this.interval$);
|
|
|
+ this.btnContent = 0;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
|
+ if (res.code == '501') {
|
|
|
+ this.btnContent = 5;
|
|
|
+ this.interval$ = setInterval(() => {
|
|
|
+ this.btnContent -= 1;
|
|
|
+ if (this.btnContent <= 0) {
|
|
|
+ clearInterval(this.interval$);
|
|
|
+ this.btnContent = 0;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
this.phone = '';
|
|
|
this.error = res.msg;
|
|
|
return;
|
|
@@ -251,15 +276,6 @@ export class UserLoginComponent implements OnDestroy, OnInit {
|
|
|
//this.rescode = res.data.smscode;
|
|
|
//this.resmobile = res.data.phone;
|
|
|
});
|
|
|
-
|
|
|
- this.btnContent = 59;
|
|
|
- this.interval$ = setInterval(() => {
|
|
|
- this.btnContent -= 1;
|
|
|
- if (this.btnContent <= 0) {
|
|
|
- clearInterval(this.interval$);
|
|
|
- this.btnContent = 0;
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
}
|
|
|
|
|
|
// #endregion
|