Browse Source

[新增]中台跳转

test-assets
邵佳豪 7 months ago
parent
commit
a599173713
  1. 4
      proxy.config.json
  2. 4
      src/app/pages/singlelogin/singlelogin.component.html
  3. 72
      src/app/pages/singlelogin/singlelogin.component.ts

4
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"

4
src/app/pages/singlelogin/singlelogin.component.html

@ -1,4 +1,4 @@
<nz-modal nzWidth="1300px" [(nzVisible)]="isVisible" nzMaskClosable="false" nzTitle="请绑定用户"
<!-- <nz-modal nzWidth="1300px" [(nzVisible)]="isVisible" nzMaskClosable="false" nzTitle="请绑定用户"
(nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" :nzFooter=" " nzClosable="false" nzKeyboard="false">
<ng-container *nzModalContent>
<div class="userBox">
@ -118,4 +118,4 @@
</div>
</div>
</ng-container>
</nz-modal>
</nz-modal> -->

72
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<void>((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<void>((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<void>((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) {

Loading…
Cancel
Save