Commit 9ee73576 authored by wangqinghua's avatar wangqinghua

update

parent 6bd0bc90
...@@ -17,6 +17,8 @@ import {NzNotificationService} from 'ng-zorro-antd'; ...@@ -17,6 +17,8 @@ import {NzNotificationService} from 'ng-zorro-antd';
import {LocalStorageService} from 'ngx-webstorage'; import {LocalStorageService} from 'ngx-webstorage';
import {OverAllService} from '../../overAll/overAll.service'; import {OverAllService} from '../../overAll/overAll.service';
import {SystemService} from '../../system/system.service'; import {SystemService} from '../../system/system.service';
import {Base64} from 'js-base64';
import {LayoutService} from '../../layouts/layout.service';
@Component({ @Component({
selector: 'jhi-login-modal', selector: 'jhi-login-modal',
...@@ -46,6 +48,7 @@ export class JhiLoginModalComponent implements OnInit { ...@@ -46,6 +48,7 @@ export class JhiLoginModalComponent implements OnInit {
public $localStorage: LocalStorageService, public $localStorage: LocalStorageService,
public overAll: OverAllService, public overAll: OverAllService,
private sysSer: SystemService, private sysSer: SystemService,
private layoutSer: LayoutService,
) { ) {
this.credentials = {}; this.credentials = {};
this.emitService.eventEmit.subscribe((value: any) => { this.emitService.eventEmit.subscribe((value: any) => {
...@@ -65,8 +68,21 @@ export class JhiLoginModalComponent implements OnInit { ...@@ -65,8 +68,21 @@ export class JhiLoginModalComponent implements OnInit {
if (this.validateForm.invalid) { if (this.validateForm.invalid) {
return false; return false;
} }
this.getEncodepassword();
}
getEncodepassword() {
const data = {
userName: this.validateForm.value.loginName,
password: Base64.encode(this.validateForm.value.password)
};
this.layoutSer.encodePassword(data).subscribe(
(res) => {
this.validateForm.patchValue({password: res.data});
this.login(); this.login();
} }
);
}
ngOnInit(): void { ngOnInit(): void {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
...@@ -137,7 +153,11 @@ export class JhiLoginModalComponent implements OnInit { ...@@ -137,7 +153,11 @@ export class JhiLoginModalComponent implements OnInit {
this.userInfo.organizationName = res.data.name; this.userInfo.organizationName = res.data.name;
} }
this.$localStorage.store('userInfo', this.userInfo); this.$localStorage.store('userInfo', this.userInfo);
} }, (error1 => {
this.router.navigate(['app/main/home']);
this.notification.create('success', '登录成功', '', {nzDuration: 2000});
this.$localStorage.store('userInfo', this.userInfo);
})
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment