bhq@iemsoft.cn
2018-11-06 0693e4dbd75a8c23a7e6dd34aa9a9ecee0a3a7b3
修改登录问题
4 files modified
83 ■■■■ changed files
formManagement/src/app/app.component.html 2 ●●●●● patch | view | raw | blame | history
formManagement/src/app/app.component.ts 76 ●●●● patch | view | raw | blame | history
formManagement/src/app/form/main/main.component.ts 1 ●●●● patch | view | raw | blame | history
formManagement/src/app/templateCenter/industryCategory/IndustryCategoryAction.ts 4 ●●●● patch | view | raw | blame | history
formManagement/src/app/app.component.html
@@ -1,5 +1,7 @@
<main>
      <router-outlet>
            <div class="layout-fixed" *ngIf="isShowTitle">
                  <div class="wrapper">
                        <div class="topnavbar-wrapper">
formManagement/src/app/app.component.ts
@@ -186,43 +186,51 @@
            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);
        });
        
@@ -366,11 +374,7 @@
                (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 })
@@ -379,11 +383,7 @@
              );
        }
        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 })
formManagement/src/app/form/main/main.component.ts
@@ -53,6 +53,7 @@
          sessionStorage.setItem("userInfo", JSON.stringify(res.data));
          this.getTenantOrCompany();
          // this.toTdCenter();
        }
      }
    );
formManagement/src/app/templateCenter/industryCategory/IndustryCategoryAction.ts
@@ -14,8 +14,8 @@
    }
    // 初期化
    public init(item) {
        if(this.storage.get('tenantID')){
            let tenantID = this.storage.get('tenantID').tenantID;
        if(this._cookieService.get('tenantId')){
            let tenantID = this._cookieService.get('tenantId');
            let observableCode = this.httpService.get(AppConfig.GETSYSCODELIST,{"codeDiv":"001", "subCodeDiv":"000"})
            observableCode.subscribe(
                (code) => {