Browse Source

登录

beijing
jingbowen 2 years ago
parent
commit
00dcb48d8e
  1. 65
      src/app/pages/login/login.component.ts

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

@ -163,43 +163,40 @@ export class LoginComponent implements OnInit {
this.rememberInfo() this.rememberInfo()
//自动登录 //自动登录
this.autoLogin() this.autoLogin()
if (data.result.user.userName == 'admin') {
sessionStorage.setItem("isGasStation", 'false'); if (data.result.user.organization.isGasStation) {
this.router.navigate(['/system/organization']) 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 { } else {
if (data.result.user.organization.isGasStation) { sessionStorage.setItem("isGasStation", 'false');
sessionStorage.setItem("isGasStation", 'true'); let a = sessionStorage.getItem('userdata')
let a = sessionStorage.getItem('userdataOfgasstation') let menuList = this.returnLastMenus(a, this.menu1)
let menuList = this.returnLastMenus(a, this.menu2) let isTrue = menuList.find((item) => {
let isTrue = menuList.find((item) => { return item.name == "首页"
return item.name == "今日预警" });
}); if (isTrue) {
if (isTrue) { this.router.navigate(['/homepage'])
this.router.navigate(['/todaywarning/petrolStation']) sessionStorage.setItem('selectedMenu', '首页')
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 { } else {
sessionStorage.setItem("isGasStation", 'false'); this.router.navigate([menuList[0].url])
let a = sessionStorage.getItem('userdata') sessionStorage.setItem('selectedMenu', menuList[0].name)
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.message.create('success', `登录成功`); this.message.create('success', `登录成功`);
}, err => { }, err => {

Loading…
Cancel
Save