Commit 76e6f810 authored by wangqinghua's avatar wangqinghua

signal update

parent 8b4d912c
import {Component, ElementRef, OnInit, Renderer} from '@angular/core';
import {LoginService, StateStorageService} from '..';
import {FormBuilder, Validators} from '@angular/forms';
import {Route, Router} from '@angular/router';
import {JhiEventManager} from 'ng-jhipster';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
import {EmitService} from '../event/eventEmitter';
import {NzNotificationService} from 'ng-zorro-antd';
import {LocalStorageService} from 'ngx-webstorage';
import {OverAllService} from '../../overAll/overAll.service';
@Component({
selector: 'smart-signal',
templateUrl: './signal.component.html',
styles: []
})
//模拟登录
export class SignalComponent implements OnInit {
constructor(private fb: FormBuilder,
private eventManager: JhiEventManager,
private loginService: LoginService,
private stateStorageService: StateStorageService,
private elementRef: ElementRef,
private renderer: Renderer,
private router: Router,
public activeModal: NgbActiveModal,
public emitService: EmitService,
public notification: NzNotificationService,
public $localStorage: LocalStorageService,
public overAll: OverAllService) {
}
ngOnInit() {
const data = {
loginName: 'superadmin',
password: '000000',
rememberMe: true,
};
this.loginService.login(data).then((res) => {
if (res) {
this.router.navigate(['app/main/home']);
this.notification.create('success', '登录成功', '', {nzDuration: 2000});
this.$localStorage.store('userInfo', data);
} else {
this.notification.create('error', '登录失败', '用户名或密码错误', {nzDuration: 2000});
}
}).catch(() => {
});
}
}
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