Browse Source

[完善]中台登录错误参数下载

master
邵佳豪 3 months ago
parent
commit
a6888a1b63
  1. 18
      src/app/pages/singlelogin/singlelogin.component.ts

18
src/app/pages/singlelogin/singlelogin.component.ts

@ -123,11 +123,28 @@ export class SingleloginComponent implements OnInit {
});
}
downloadAsTxt(obj) {
// 将对象转换为 JSON 字符串
const jsonString = JSON.stringify(obj, null, 2);
// 创建 Blob 对象
const blob = new Blob([jsonString], { type: "text/plain" });
// 创建下载链接
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "错误参数.txt"; // 文件名为 data.txt
link.click(); // 触发下载
// 释放 URL 对象
URL.revokeObjectURL(link.href);
}
//中化用户登录获得自己的token信息
SinochemLogin() {
return new Promise<void>((resolve, reject) => {
this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id;
delete this.CurrentUserInfo.data.id;
delete this.CurrentUserInfo.data.permissions;
let body = {
user: this.CurrentUserInfo.data,
org: this.AuthOrganInfos.data[0],
@ -146,6 +163,7 @@ export class SingleloginComponent implements OnInit {
resolve();
},
(err) => {
this.downloadAsTxt(body);
alert(err?.error?.error?.message || "SinochemLogin接口请求失败");
reject();
}

Loading…
Cancel
Save