陈鹏飞 2 years ago
parent
commit
b0618b6543
  1. 14
      src/app/pages/login/login.component.ts

14
src/app/pages/login/login.component.ts

@ -95,11 +95,9 @@ export class LoginComponent implements OnInit {
{ name: '预警记录', url: '/records_nav/petrolStation' }, { name: '预警记录', url: '/records_nav/petrolStation' },
{ name: '证照管理', url: '/license/petrolStation' }, { name: '证照管理', url: '/license/petrolStation' },
] ]
menu=[]
userMenu = [] userMenu = []
tap = [] tap = []
menuList1=[] menuList = []
menuList2=[]
submitForm(): void { submitForm(): void {
if (!this.remember) { if (!this.remember) {
@ -134,7 +132,6 @@ export class LoginComponent implements OnInit {
this.message.create('error', `当前用户未分配菜单`); this.message.create('error', `当前用户未分配菜单`);
this.isLoading = false this.isLoading = false
return return
} }
sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) sessionStorage.setItem('userdata', JSON.stringify(data.result.user))
sessionStorage.setItem('userdataOfgasstation', JSON.stringify(data.result.user)) sessionStorage.setItem('userdataOfgasstation', JSON.stringify(data.result.user))
@ -151,7 +148,7 @@ export class LoginComponent implements OnInit {
this.message.create('success', `登录成功`); this.message.create('success', `登录成功`);
} else { } else {
if (data.result.user.organization.isGasStation) { if (data.result.user.organization.isGasStation) {
let a= sessionStorage.getItem('userdata') let a = sessionStorage.getItem('userdataOfgasstation')
this.userMenu = JSON.parse(a).menus this.userMenu = JSON.parse(a).menus
for (let index = 0; index < this.userMenu.length; index++) { for (let index = 0; index < this.userMenu.length; index++) {
let a = this.userMenu[index].name let a = this.userMenu[index].name
@ -160,7 +157,7 @@ export class LoginComponent implements OnInit {
for (let index = 0; index < this.menu2.length; index++) { for (let index = 0; index < this.menu2.length; index++) {
for (let k = 0; k < this.tap.length; k++) { for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menu2[index].name) { if (this.tap[k] == this.menu2[index].name) {
this.menuList2.push(this.menu2[index]) this.menuList.push(this.menu2[index])
} }
} }
} }
@ -178,7 +175,7 @@ export class LoginComponent implements OnInit {
for (let index = 0; index < this.menu1.length; index++) { for (let index = 0; index < this.menu1.length; index++) {
for (let k = 0; k < this.tap.length; k++) { for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k] == this.menu1[index].name) { if (this.tap[k] == this.menu1[index].name) {
this.menuList1.push(this.menu1[index]) this.menuList.push(this.menu1[index])
} }
} }
} }
@ -191,9 +188,6 @@ export class LoginComponent implements OnInit {
}, err => { }, err => {
this.isLoading = false; this.isLoading = false;
}) })
//调用服务中的function刷新token
// this.token.startUp()
}, },
(err) => { (err) => {
this.isLoading = false; this.isLoading = false;

Loading…
Cancel
Save