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": { "/api": {
"target": "http://192.168.1.43:8106", "target": "http://121.36.37.70:8906/",
"测试1": "http://121.36.37.70:8906/", "测试1": "http://121.36.37.70:8906/",
"测试2": "https://znaq.sinochemoilmarketing.com/", "测试2": "https://znaq.sinochemoilmarketing.com/",
"测试3": "https://gas.anxincloud.cn/", "测试3": "https://gas.anxincloud.cn/",
@ -8,7 +8,7 @@
"changeOrigin": true "changeOrigin": true
}, },
"/signalr": { "/signalr": {
"target": "http://192.168.1.43:8106", "target": "http://121.36.37.70:8906/",
"secure": false, "secure": false,
"ws": true, "ws": true,
"logLevel": "debug" "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"> (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" :nzFooter=" " nzClosable="false" nzKeyboard="false">
<ng-container *nzModalContent> <ng-container *nzModalContent>
<div class="userBox"> <div class="userBox">
@ -118,4 +118,4 @@
</div> </div>
</div> </div>
</ng-container> </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 = { let obj = {
SAG_USER_TOKEN: SAG_USER_TOKEN:
"1zLWxc5737RBqu267e2ek8S0jlvfckggVYuWmu_9uvxvPeX7-RtQl0nrft90zq5w==", "J0UI55c9334Julcaad1cs5kL_5OEg6x_ONVHdH4kTRJHC_yrfRI6ej5dwPeEsJYg==",
}; };
this.setCookie(obj); this.setCookie(obj);
@ -36,36 +36,11 @@ export class SingleloginComponent implements OnInit {
return; return;
} else { } else {
this.sinToken = token; this.sinToken = token;
console.log("token");
alert("token获取成功:" + token);
// return;
// this.bindingUser();
await this.getCurrentUserInfo(); await this.getCurrentUserInfo();
await this.getAuthOrganInfos(); await this.getAuthOrganInfos();
if (this.CurrentUserInfo && this.AuthOrganInfos) { if (this.CurrentUserInfo && this.AuthOrganInfos) {
// await this.getSinochemUsers(this.CurrentUserInfo.name); this.SinochemLogin();
}
let userdata = JSON.parse(sessionStorage.getItem("userdata"));
if (userdata.userName == "admin") {
//是superadmin,是内部制作账号
this.isAdmin = true;
} else {
this.isAdmin = false;
} }
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) { // getSinochemUsers(Keyword) {
return new Promise<void>((resolve, reject) => { // return new Promise<void>((resolve, reject) => {
this.http // this.http
.get("/api/services/app/User/GetSinochemUsers", { // .get("/api/services/app/User/GetSinochemUsers", {
params: { // params: {
Keyword: Keyword, // Keyword: Keyword,
}, // },
}) // })
.subscribe( // .subscribe(
(data: any) => { // (data: any) => {
console.log("中化用户信息", data); // console.log("中化用户信息", data);
resolve(data); // resolve(data);
}, // },
(err) => { // (err) => {
reject(); // reject();
} // }
); // );
}); // });
} // }
//中化用户登录获得自己的token信息 //中化用户登录获得自己的token信息
SinochemLogin() { SinochemLogin() {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id; this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id;
delete this.CurrentUserInfo.data.id; delete this.CurrentUserInfo.data.id;
let body = { let body = {
user: this.CurrentUserInfo.data, user: this.CurrentUserInfo.data,
org: this.AuthOrganInfos.data[0], org: this.AuthOrganInfos.data[0],
@ -177,10 +151,11 @@ export class SingleloginComponent implements OnInit {
}; };
this.http.post("/api/TokenAuth/SinochemLogin", body).subscribe( this.http.post("/api/TokenAuth/SinochemLogin", body).subscribe(
(data: any) => { (data: any) => {
console.log("信息验证", data); this.enterPage(data);
resolve(); resolve();
}, },
(err) => { (err) => {
alert("未绑定本地用户!");
reject(); reject();
} }
); );
@ -303,7 +278,6 @@ export class SingleloginComponent implements OnInit {
this.router.navigate([menuList[0].url]); this.router.navigate([menuList[0].url]);
sessionStorage.setItem("selectedMenu", menuList[0].name); sessionStorage.setItem("selectedMenu", menuList[0].name);
} }
} }
} }
returnLastMenus(data, originalMenus) { returnLastMenus(data, originalMenus) {

Loading…
Cancel
Save