diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index a30c123..aa89e9c 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -163,43 +163,40 @@ export class LoginComponent implements OnInit { this.rememberInfo() //自动登录 this.autoLogin() - if (data.result.user.userName == 'admin') { - sessionStorage.setItem("isGasStation", 'false'); - this.router.navigate(['/system/organization']) + + if (data.result.user.organization.isGasStation) { + sessionStorage.setItem("isGasStation", 'true'); + let a = sessionStorage.getItem('userdataOfgasstation') + let menuList = this.returnLastMenus(a, this.menu2) + let isTrue = menuList.find((item) => { + return item.name == "今日预警" + }); + if (isTrue) { + this.router.navigate(['/todaywarning/petrolStation']) + sessionStorage.setItem('selectedMenu', '今日预警') + } else if (data.result.user.menus[0].name == "数字油站" && !this.init3D) { + this.router.navigate([menuList[1].url]) + sessionStorage.setItem('selectedMenu', menuList[1].name) + } else { + this.router.navigate([menuList[0].url]) + sessionStorage.setItem('selectedMenu', menuList[0].name) + } } else { - if (data.result.user.organization.isGasStation) { - sessionStorage.setItem("isGasStation", 'true'); - let a = sessionStorage.getItem('userdataOfgasstation') - let menuList = this.returnLastMenus(a, this.menu2) - let isTrue = menuList.find((item) => { - return item.name == "今日预警" - }); - if (isTrue) { - this.router.navigate(['/todaywarning/petrolStation']) - sessionStorage.setItem('selectedMenu', '今日预警') - } else if (data.result.user.menus[0].name == "数字油站" && !this.init3D) { - this.router.navigate([menuList[1].url]) - sessionStorage.setItem('selectedMenu', menuList[1].name) - } else { - this.router.navigate([menuList[0].url]) - sessionStorage.setItem('selectedMenu', menuList[0].name) - } + sessionStorage.setItem("isGasStation", 'false'); + let a = sessionStorage.getItem('userdata') + let menuList = this.returnLastMenus(a, this.menu1) + let isTrue = menuList.find((item) => { + return item.name == "首页" + }); + if (isTrue) { + this.router.navigate(['/homepage']) + sessionStorage.setItem('selectedMenu', '首页') } else { - sessionStorage.setItem("isGasStation", 'false'); - let a = sessionStorage.getItem('userdata') - let menuList = this.returnLastMenus(a, this.menu1) - let isTrue = menuList.find((item) => { - return item.name == "首页" - }); - if (isTrue) { - this.router.navigate(['/homepage']) - sessionStorage.setItem('selectedMenu', '首页') - } else { - this.router.navigate([menuList[0].url]) - sessionStorage.setItem('selectedMenu', menuList[0].name) - } - // + this.router.navigate([menuList[0].url]) + sessionStorage.setItem('selectedMenu', menuList[0].name) } + // + } this.message.create('success', `登录成功`); }, err => {