|
|
|
@ -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) { |
|
|
|
|