| | |
| | | this.storage.store('token', { "accessToken": token }); |
| | | this.user.setAccessToken(token); |
| | | this.showFlg = false; |
| | | this.isShowTitle = true; |
| | | window.parent.location.href = urlHref.replace("?loginKey=main", ""); |
| | | $(window.parent.document.getElementsByClassName('wrapper')).hide(); |
| | | // window.parent.location.reload(); |
| | | window.parent.location.reload(); |
| | | this.router.navigate(['main']); |
| | | |
| | | } else { |
| | | |
| | | let loginFlag = (urlHash != "" && urlHash != "#/"); |
| | | |
| | | if (this.storage.get('token') && loginFlag) { |
| | | //自定义表单 |
| | | this.isShowTitle = true; |
| | | this.showFlg = false; |
| | | this.getCompanys(); |
| | | // this.user.setAccessToken(this.storage.get('token').accessToken); |
| | | if (this.storage.get('tenantID') != undefined && this.storage.get('tenantID') != '') { |
| | | this.user.setTenantID(this.storage.get('tenantID').tenantID); |
| | | } |
| | | if (this.storage.get('userName') != undefined && this.storage.get('userName') != '') { |
| | | this.user.setUsername(this.storage.get('userName').userName); |
| | | } |
| | | this.menuName = this.storage.get('lastMenuName'); |
| | | this.name = this.storage.get('lastMenuName'); |
| | | } else { |
| | | this.storage.clear('userName'); |
| | | this.storage.clear('tenantID'); |
| | | this.storage.clear('token'); |
| | | this.storage.clear('lastMenuName'); |
| | | if (this._cookieService.get('token') && loginFlag) { |
| | | //自定义表单 |
| | | this.isShowTitle = true; |
| | | this.showFlg = false; |
| | | this.getCompanys(); |
| | | // this.user.setAccessToken(this.storage.get('token').accessToken); |
| | | if (this.storage.get('tenantID') != undefined && this.storage.get('tenantID') != '') { |
| | | this.user.setTenantID(this.storage.get('tenantID').tenantID); |
| | | } |
| | | if (this._cookieService.get('userName') != undefined && this._cookieService.get('userName') != '') { |
| | | this.user.setUsername(this._cookieService.get('userName')); |
| | | this.userName = this._cookieService.get('userName'); |
| | | |
| | | this.storage.clear('isShowTitle'); |
| | | this.storage.clear('showFlg'); |
| | | window.location.hash = ''; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | this.menuName = this.storage.get('lastMenuName'); |
| | | this.name = this.storage.get('lastMenuName'); |
| | | } |
| | | // else { |
| | | // this.storage.clear('userName'); |
| | | // this.storage.clear('tenantID'); |
| | | // this.storage.clear('token'); |
| | | // this.storage.clear('lastMenuName'); |
| | | |
| | | // this.storage.clear('isShowTitle'); |
| | | // this.storage.clear('showFlg'); |
| | | // window.location.hash = ''; |
| | | // } |
| | | } |
| | | // history.pushState(null, null, document.URL); |
| | | // window.addEventListener('popstate', function () { |
| | | // history.pushState(null, null, document.URL); |
| | | // }); |
| | | history.pushState(null, null, document.URL); |
| | | window.addEventListener('popstate', function () { |
| | | history.pushState(null, null, document.URL); |
| | | }); |
| | | |
| | | |
| | | |
| | |
| | | (response) => { |
| | | if (response.rspCode == "000000") { |
| | | sessionStorage.setItem("userInfo", JSON.stringify(response.data)); |
| | | if(response.data.realName != undefined && response.data.realName != null) { |
| | | this.userName = response.data.realName; |
| | | } else { |
| | | this.userName = response.data.userName; |
| | | } |
| | | this.userName = response.data.userName; |
| | | this.user.setUsername(this.userName); |
| | | |
| | | this.storage.store('userName', { 'userName': this.userName }) |
| | |
| | | ); |
| | | } |
| | | if(userInfo!=undefined ){ |
| | | if (userInfo.realName != undefined && userInfo.realName != null) { |
| | | this.userName = userInfo.realName; |
| | | } else { |
| | | this.userName = userInfo.userName; |
| | | } |
| | | this.userName = userInfo.userName; |
| | | this.user.setUsername(this.userName); |
| | | } |
| | | this.storage.store('userName', { 'userName': this.userName }) |