From c6c3b47a40f3c1ecdd273bc9639d600c93c49c26 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 13 Jul 2022 17:17:29 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/login/login.component.ts | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 6cef638..b582dd8 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -96,14 +96,12 @@ export class LoginComponent implements OnInit { { name: '证照管理', url: '/license/petrolStation' }, ] init3D - getGasStationBaseInfo() { - return new Promise((resolve, reject) => { + async getGasStationBaseInfo() { + new Promise((resolve, reject) => { let params = { organizationUnitId: (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization.id } this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any) => { resolve(data.result) - this.init3D=data.result.hasBuildingInfo - console.log(this.init3D); - + this.init3D = data.result.hasBuildingInfo }) }) } @@ -134,26 +132,28 @@ export class LoginComponent implements OnInit { (data: any) => { sessionStorage.setItem("token", data.result.accessToken); sessionStorage.setItem("encryptedAccessToken", data.result.encryptedAccessToken); - this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => { + this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe(async (data: any) => { console.log('GetCurrentLoginInformations', data.result) - if (data.result.user.menus.length == 0 && data.result.user.userName!="admin") { + if (data.result.user.menus.length == 0 && data.result.user.userName != "admin") { this.message.create('error', `当前用户未分配菜单`); this.isLoading = false return } - + sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) sessionStorage.setItem('userdataOfgasstation', JSON.stringify(data.result.user)) sessionStorage.setItem('isDefaultPassword', JSON.stringify(data.result.user.isDefaultPassword)) sessionStorage.setItem('isPasswordExpired', JSON.stringify(data.result.user.isPasswordExpired)) this.isLoading = false; - if(data.result.user.organization.isGasStation){ - this.getGasStationBaseInfo() - if(data.result.user.menus[0].name=="数字油站" && data.result.user.menus.length==1&&!this.init3D){ - this.message.create('error', `当前用户油站未开通3D且仅分配油站菜单`); - return - - } + if (data.result.user.organization.isGasStation) { + + await this.getGasStationBaseInfo() + + if (data.result.user.menus[0].name == "数字油站" && data.result.user.menus.length == 1 && !this.init3D) { + this.message.create('error', `当前用户油站未开通3D且仅分配油站菜单`); + return + + } } //记住密码 this.rememberInfo() @@ -173,10 +173,10 @@ export class LoginComponent implements OnInit { if (isTrue) { this.router.navigate(['/todaywarning/petrolStation']) sessionStorage.setItem('selectedMenu', '今日预警') - } else if(data.result.user.menus[0].name=="数字油站" && !this.init3D) { + } else if (data.result.user.menus[0].name == "数字油站" && !this.init3D) { this.router.navigate([menuList[1].url]) sessionStorage.setItem('selectedMenu', menuList[1].name) - }else{ + } else { this.router.navigate([menuList[0].url]) sessionStorage.setItem('selectedMenu', menuList[0].name) } @@ -190,7 +190,7 @@ export class LoginComponent implements OnInit { if (isTrue) { this.router.navigate(['/homepage']) sessionStorage.setItem('selectedMenu', '首页') - } else { + } else { this.router.navigate([menuList[0].url]) sessionStorage.setItem('selectedMenu', menuList[0].name) }