import { Component } from '@angular/core';
import { Router } from '@angular/router';



@Component({
  selector: 'app-enroll-page',
  templateUrl: './enroll-page.component.html',
  styleUrls: ['./enroll-page.component.scss']
})
export class EnrollPageComponent {
  username: string = '';
  password: string = '';
  confirmPassword: string = '';
  passwordMismatch: boolean = false;

  constructor(private router: Router) {}

  register() {
    if (this.password !== this.confirmPassword) {
      this.passwordMismatch = true;
    } else {
      this.passwordMismatch = false;
      // 实现注册逻辑，例如发送注册请求到服务器
      // 如果注册成功，可以跳转到登录页面
      this.goToLoginPage();
    }
  }

  goToLoginPage() {
    this.router.navigate(['/login']);
  }
}
