|
@@ -47,14 +47,15 @@ export class LoginComponent implements OnInit {
|
47
|
47
|
data => {
|
48
|
48
|
this.loading = false;
|
49
|
49
|
this.msg.remove(loadingId);
|
50
|
|
- if (data.status == 200) {
|
51
|
|
- this.toRoute2(data)
|
52
|
|
- this.initMenu(data.user.menu)
|
53
|
|
- } else {
|
54
|
|
- this.msg.error(data.remarks, {
|
55
|
|
- nzDuration: 1000
|
56
|
|
- });
|
57
|
|
- }
|
|
50
|
+ localStorage.removeItem('remember');
|
|
51
|
+ this.apiLogin(data.userId,data.pwd);
|
|
52
|
+ },err=>{
|
|
53
|
+ this.loading = false;
|
|
54
|
+ this.msg.remove(loadingId);
|
|
55
|
+ this.msg.error('登录失败', {
|
|
56
|
+ nzDuration: 1000
|
|
57
|
+ });
|
|
58
|
+ this.router.navigateByUrl('/login');
|
58
|
59
|
}
|
59
|
60
|
)
|
60
|
61
|
}
|
|
@@ -128,9 +129,13 @@ export class LoginComponent implements OnInit {
|
128
|
129
|
this.msg.info('用户名或密码不能为空!');
|
129
|
130
|
return;
|
130
|
131
|
}
|
|
132
|
+ this.apiLogin(this.validateForm.value.userName,this.validateForm.value.password);
|
|
133
|
+ }
|
|
134
|
+ // 登录接口
|
|
135
|
+ apiLogin(user,pwd){
|
131
|
136
|
const loadingId = this.msg.loading('登录中..', { nzDuration: 0 }).messageId;
|
132
|
137
|
this.loading = true;
|
133
|
|
- this.mainService.login(this.validateForm.value.userName, this.validateForm.value.password).subscribe(
|
|
138
|
+ this.mainService.login(user, pwd).subscribe(
|
134
|
139
|
data => {
|
135
|
140
|
this.loading = false;
|
136
|
141
|
this.msg.remove(loadingId);
|