From a599173713b074f5ac77b8750497f323b0bb2acf Mon Sep 17 00:00:00 2001 From: Sjh <55341701@qq.com> Date: Fri, 26 Jul 2024 16:03:57 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E4=B8=AD=E5=8F=B0=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.config.json | 4 +- .../singlelogin/singlelogin.component.html | 4 +- .../singlelogin/singlelogin.component.ts | 72 ++++++------------- 3 files changed, 27 insertions(+), 53 deletions(-) diff --git a/proxy.config.json b/proxy.config.json index 2cf12b1..28d0a9f 100644 --- a/proxy.config.json +++ b/proxy.config.json @@ -1,6 +1,6 @@ { "/api": { - "target": "http://192.168.1.43:8106", + "target": "http://121.36.37.70:8906/", "测试1": "http://121.36.37.70:8906/", "测试2": "https://znaq.sinochemoilmarketing.com/", "测试3": "https://gas.anxincloud.cn/", @@ -8,7 +8,7 @@ "changeOrigin": true }, "/signalr": { - "target": "http://192.168.1.43:8106", + "target": "http://121.36.37.70:8906/", "secure": false, "ws": true, "logLevel": "debug" diff --git a/src/app/pages/singlelogin/singlelogin.component.html b/src/app/pages/singlelogin/singlelogin.component.html index 63cde09..e6a8560 100644 --- a/src/app/pages/singlelogin/singlelogin.component.html +++ b/src/app/pages/singlelogin/singlelogin.component.html @@ -1,4 +1,4 @@ -
@@ -118,4 +118,4 @@
-
\ No newline at end of file + --> \ No newline at end of file diff --git a/src/app/pages/singlelogin/singlelogin.component.ts b/src/app/pages/singlelogin/singlelogin.component.ts index 92ae525..507c6c2 100644 --- a/src/app/pages/singlelogin/singlelogin.component.ts +++ b/src/app/pages/singlelogin/singlelogin.component.ts @@ -26,7 +26,7 @@ export class SingleloginComponent implements OnInit { let obj = { SAG_USER_TOKEN: - "1zLWxc5737RBqu267e2ek8S0jlvfckggVYuWmu_9uvxvPeX7-RtQl0nrft90zq5w==", + "J0UI55c9334Julcaad1cs5kL_5OEg6x_ONVHdH4kTRJHC_yrfRI6ej5dwPeEsJYg==", }; this.setCookie(obj); @@ -36,36 +36,11 @@ export class SingleloginComponent implements OnInit { return; } else { this.sinToken = token; - console.log("token"); - alert("token获取成功:" + token); - - // return; - // this.bindingUser(); await this.getCurrentUserInfo(); await this.getAuthOrganInfos(); if (this.CurrentUserInfo && this.AuthOrganInfos) { - // await this.getSinochemUsers(this.CurrentUserInfo.name); - } - - let userdata = JSON.parse(sessionStorage.getItem("userdata")); - if (userdata.userName == "admin") { - //是superadmin,是内部制作账号 - this.isAdmin = true; - } else { - this.isAdmin = false; + this.SinochemLogin(); } - this.validateForm = this.fb.group({ - search: [null], - }); - this.level = JSON.parse( - sessionStorage.getItem("userdata") - ).organization.level; - - this.getAllUrl = "/api/services/app/User/GetAll"; - this.CountsByOrganizations = - "/api/services/app/User/GetCountsByOrganizations"; - - this.getAllOrganization(); } } @@ -144,32 +119,31 @@ export class SingleloginComponent implements OnInit { } //确认中化是否绑定了我们的用户 - getSinochemUsers(Keyword) { - return new Promise((resolve, reject) => { - this.http - .get("/api/services/app/User/GetSinochemUsers", { - params: { - Keyword: Keyword, - }, - }) - .subscribe( - (data: any) => { - console.log("中化用户信息", data); - resolve(data); - }, - (err) => { - reject(); - } - ); - }); - } + // getSinochemUsers(Keyword) { + // return new Promise((resolve, reject) => { + // this.http + // .get("/api/services/app/User/GetSinochemUsers", { + // params: { + // Keyword: Keyword, + // }, + // }) + // .subscribe( + // (data: any) => { + // console.log("中化用户信息", data); + // resolve(data); + // }, + // (err) => { + // reject(); + // } + // ); + // }); + // } //中化用户登录获得自己的token信息 SinochemLogin() { return new Promise((resolve, reject) => { this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id; delete this.CurrentUserInfo.data.id; - let body = { user: this.CurrentUserInfo.data, org: this.AuthOrganInfos.data[0], @@ -177,10 +151,11 @@ export class SingleloginComponent implements OnInit { }; this.http.post("/api/TokenAuth/SinochemLogin", body).subscribe( (data: any) => { - console.log("信息验证", data); + this.enterPage(data); resolve(); }, (err) => { + alert("未绑定本地用户!"); reject(); } ); @@ -303,7 +278,6 @@ export class SingleloginComponent implements OnInit { this.router.navigate([menuList[0].url]); sessionStorage.setItem("selectedMenu", menuList[0].name); } - } } returnLastMenus(data, originalMenus) {