You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
pocketcommunityweb/src/app/account/login/login.component.ts

43 lines
1.0 KiB

import {Component, OnInit} from '@angular/core';
import {FormBuilder} from '@angular/forms';
import {Commons} from '../../commons';
import {Router} from '@angular/router';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
// 登陆模块
export class LoginComponent extends Commons implements OnInit {
// 登陆表单
loginForm = this.fb.group({
managerName: [''],
password: ['']
});
constructor(private fb: FormBuilder,private router: Router) {
super();
}
ngOnInit(): void {
}
// 登陆方法
login() {
console.debug(this.loginForm.value);
this.request('http://localhost:8080/api/manager/login', JSON.stringify(this.loginForm.value),
res => {
this.message = res.message;
if (res.result === 'OK') {
this.messageStyle = 'info';
this.router.navigateByUrl('/forum');
} else {
this.messageStyle = 'warning';
}
});
}
}