From 7a3222a584c48d91dcf42b1ef4760f05407a8452 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 23 Jun 2022 16:06:22 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=AE=8C=E5=96=84=E7=99=BB?= =?UTF-8?q?=E9=99=86=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/login/login.component.ts | 40 +++++++++++--------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 4d96dd7..c7d7294 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -95,11 +95,9 @@ export class LoginComponent implements OnInit { { name: '预警记录', url: '/records_nav/petrolStation' }, { name: '证照管理', url: '/license/petrolStation' }, ] - menu=[] - userMenu=[] - tap=[] - menuList1=[] - menuList2=[] + userMenu = [] + tap = [] + menuList = [] submitForm(): void { if (!this.remember) { @@ -130,11 +128,10 @@ export class LoginComponent implements OnInit { console.log('token', data.result) this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => { console.log('GetCurrentLoginInformations', data.result) - if(data.result.user.menus.length==0){ + if (data.result.user.menus.length == 0) { this.message.create('error', `当前用户未分配菜单`); - this.isLoading=false + this.isLoading = false return - } sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) sessionStorage.setItem('userdataOfgasstation', JSON.stringify(data.result.user)) @@ -151,16 +148,16 @@ export class LoginComponent implements OnInit { this.message.create('success', `登录成功`); } else { if (data.result.user.organization.isGasStation) { - let a= sessionStorage.getItem('userdata') - this.userMenu=JSON.parse(a).menus + let a = sessionStorage.getItem('userdataOfgasstation') + this.userMenu = JSON.parse(a).menus for (let index = 0; index < this.userMenu.length; index++) { - let a=this.userMenu[index].name - this.tap.push(a) + let a = this.userMenu[index].name + this.tap.push(a) } for (let index = 0; index < this.menu2.length; index++) { for (let k = 0; k < this.tap.length; k++) { - if (this.tap[k]==this.menu2[index].name) { - this.menuList2.push(this.menu2[index]) + if (this.tap[k] == this.menu2[index].name) { + this.menuList.push(this.menu2[index]) } } } @@ -169,16 +166,16 @@ export class LoginComponent implements OnInit { this.message.create('success', `登录成功`); sessionStorage.setItem('selectedMenu', '今日预警') } else { - let a= sessionStorage.getItem('userdata') - this.userMenu=JSON.parse(a).menus + let a = sessionStorage.getItem('userdata') + this.userMenu = JSON.parse(a).menus for (let index = 0; index < this.userMenu.length; index++) { - let a=this.userMenu[index].name - this.tap.push(a) + let a = this.userMenu[index].name + this.tap.push(a) } for (let index = 0; index < this.menu1.length; index++) { for (let k = 0; k < this.tap.length; k++) { - if (this.tap[k]==this.menu1[index].name) { - this.menuList1.push(this.menu1[index]) + if (this.tap[k] == this.menu1[index].name) { + this.menuList.push(this.menu1[index]) } } } @@ -191,9 +188,6 @@ export class LoginComponent implements OnInit { }, err => { this.isLoading = false; }) - - //调用服务中的function刷新token - // this.token.startUp() }, (err) => { this.isLoading = false;