From bb092fe2e846325a3c78804d3e2576f825dad42d Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 23 Jun 2022 16:01:03 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E7=99=BB=E9=99=86=E8=8F=9C?= =?UTF-8?q?=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 | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index a8afc1a..4d96dd7 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -82,6 +82,24 @@ export class LoginComponent implements OnInit { isLoading = false; messages encryptedAccessToken + menu1 = [ + { name: '首页', url: '/homepage' }, + { name: '数字油站', url: '/plan' }, + { name: '今日预警', url: '/todaywarning' }, + { name: '预警记录', url: '/records_nav' }, + { name: '证照管理', url: '/audit' }, + ] + menu2 = [ + { name: '数字油站', url: '/plan/petrolStation' }, + { name: '今日预警', url: '/todaywarning/petrolStation' }, + { name: '预警记录', url: '/records_nav/petrolStation' }, + { name: '证照管理', url: '/license/petrolStation' }, + ] + menu=[] + userMenu=[] + tap=[] + menuList1=[] + menuList2=[] submitForm(): void { if (!this.remember) { @@ -133,11 +151,37 @@ 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 + for (let index = 0; index < this.userMenu.length; index++) { + 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]) + } + } + } sessionStorage.setItem("isGasStation", 'true'); this.router.navigate(['/todaywarning/petrolStation']) this.message.create('success', `登录成功`); sessionStorage.setItem('selectedMenu', '今日预警') } else { + 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) + } + 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]) + } + } + } sessionStorage.setItem("isGasStation", 'false'); this.router.navigate(['/homepage']) this.message.create('success', `登录成功`);