|
|
@ -9,14 +9,15 @@ import {
|
|
|
|
Input
|
|
|
|
Input
|
|
|
|
} from '@angular/core';
|
|
|
|
} from '@angular/core';
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
import {NavigationEnd, Router} from '@angular/router';
|
|
|
|
import {ModalController, NavController, ToastController} from '@ionic/angular';
|
|
|
|
import {ModalController, NavController, ToastController} from '@ionic/angular';
|
|
|
|
import { MineService } from '../mine.service';
|
|
|
|
import {getUser, MineService} from '../mine.service';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
SlidePoint,
|
|
|
|
SlidePoint,
|
|
|
|
SlideRef
|
|
|
|
SlideRef
|
|
|
|
} from "go-captcha-angular";
|
|
|
|
} from "go-captcha-angular";
|
|
|
|
import {CaptchaModalComponent} from "../component/captcha-modal/captcha-modal.component";
|
|
|
|
import {CaptchaModalComponent} from "../component/captcha-modal/captcha-modal.component";
|
|
|
|
|
|
|
|
import {Subscription} from "rxjs";
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'app-login',
|
|
|
|
selector: 'app-login',
|
|
|
@ -34,6 +35,7 @@ export class LoginPage implements OnInit, OnDestroy,AfterViewInit {
|
|
|
|
private timer: any;
|
|
|
|
private timer: any;
|
|
|
|
private verifyToken: string | null = null;
|
|
|
|
private verifyToken: string | null = null;
|
|
|
|
private returnUrl: string | null = null;
|
|
|
|
private returnUrl: string | null = null;
|
|
|
|
|
|
|
|
private routerSub!: Subscription;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
private fb: FormBuilder,
|
|
|
|
private fb: FormBuilder,
|
|
|
@ -58,16 +60,31 @@ export class LoginPage implements OnInit, OnDestroy,AfterViewInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
ngOnInit() {
|
|
|
|
|
|
|
|
|
|
|
|
this.createForm();
|
|
|
|
this.createForm();
|
|
|
|
|
|
|
|
this.routerSub = this.router.events.subscribe(event => {
|
|
|
|
|
|
|
|
if (event instanceof NavigationEnd) {
|
|
|
|
|
|
|
|
if(event.url == "/mine/login") {
|
|
|
|
|
|
|
|
this.checkLoginStatus()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
checkLoginStatus() {
|
|
|
|
|
|
|
|
const t = localStorage.getItem("token")
|
|
|
|
|
|
|
|
if(t!=""){
|
|
|
|
|
|
|
|
this.navCtrl.navigateBack("/mine/login")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ngAfterViewInit() {
|
|
|
|
ngAfterViewInit() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
ngOnDestroy() {
|
|
|
|
this.stopCountdown() ;
|
|
|
|
this.stopCountdown() ;
|
|
|
|
|
|
|
|
if (this.routerSub) {
|
|
|
|
|
|
|
|
this.routerSub.unsubscribe();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private createForm() {
|
|
|
|
private createForm() {
|
|
|
|
// 根据登录类型动态设置验证器
|
|
|
|
// 根据登录类型动态设置验证器
|
|
|
|
this.loginForm.get('password')?.setValidators(
|
|
|
|
this.loginForm.get('password')?.setValidators(
|
|
|
|