|
@@ -0,0 +1,27 @@
|
|
|
+import { Component } from '@angular/core';
|
|
|
+import { Router } from '@angular/router';
|
|
|
+import { RegisterPage } from '../register/register.page';
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'app-login',
|
|
|
+ templateUrl: 'login.page.html',
|
|
|
+ styleUrls: ['login.page.scss']
|
|
|
+})
|
|
|
+export class LoginPage {
|
|
|
+ username: string='';
|
|
|
+ password: string='';
|
|
|
+ loginFailed: boolean = false;
|
|
|
+
|
|
|
+ constructor(private router: Router) {}
|
|
|
+
|
|
|
+ goToFirst() {
|
|
|
+ // 真实项目中应该调用后端API验证用户名和密码
|
|
|
+
|
|
|
+ // 这里简单模拟登录成功
|
|
|
+ this.router.navigate(['/tabs']);
|
|
|
+ }
|
|
|
+
|
|
|
+ goToRegister() {
|
|
|
+ this.router.navigate(['/register']);
|
|
|
+ }
|
|
|
+}
|