From 8a6349b446af872fa323da814a873e36d505f3de Mon Sep 17 00:00:00 2001 From: Sjh <55341701@qq.com> Date: Tue, 19 Mar 2024 08:57:38 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=A2=9E=E5=8A=A0=E5=85=8D?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.config.json | 2 +- .../lockscreen/lockscreen.component.html | 2 +- .../pages/lockscreen/lockscreen.component.ts | 36 ++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/proxy.config.json b/proxy.config.json index ccda5dc..297adc4 100644 --- a/proxy.config.json +++ b/proxy.config.json @@ -1,6 +1,6 @@ { "/api": { - "target": "http://121.36.37.70:8216/", + "target": "http://121.36.37.70:8213/", "secure": false, "changeOrigin": true } diff --git a/src/app/pages/lockscreen/lockscreen.component.html b/src/app/pages/lockscreen/lockscreen.component.html index 52c1d90..dd9063d 100644 --- a/src/app/pages/lockscreen/lockscreen.component.html +++ b/src/app/pages/lockscreen/lockscreen.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/pages/lockscreen/lockscreen.component.ts b/src/app/pages/lockscreen/lockscreen.component.ts index 2575af1..013ec43 100644 --- a/src/app/pages/lockscreen/lockscreen.component.ts +++ b/src/app/pages/lockscreen/lockscreen.component.ts @@ -20,7 +20,41 @@ export class LockscreenComponent implements OnInit { private isLogin: IsLoginService ) {} - ngOnInit() {} + isAutoSign = false; + ngOnInit() { + let loginName = this.route.snapshot.queryParams.loginName; + let roleType = this.route.snapshot.queryParams.roleType; + let token = this.route.snapshot.queryParams.token; + if (loginName && roleType && token) { + this.isAutoSign = true; + let body = { + loginName: loginName, + token: token, + }; + this.http.post("/api/ExamAccounts/SignInSSO", body).subscribe( + (data: any) => { + sessionStorage.setItem("realName", data.realName); + sessionStorage.setItem("roleType", data.roleType); + sessionStorage.setItem("token", data.token); + sessionStorage.setItem("refreshToken", data.refreshToken); + sessionStorage.setItem("level", data.level); + this.http.get("/api/ExamAccounts/Profiles").subscribe((v: any) => { + this.token.startUp(); //登陆成功启动定时器刷新token + this.roleType == "1" + ? this.router.navigate(["/home/createexam-index"]) + : this.roleType == "2" + ? this.router.navigate(["/home/student-index"]) + : this.router.navigate(["/home/teachear"]); + sessionStorage.setItem("creatorData", JSON.stringify(v)); + }); + }, + (err) => { + this.errmsg = err; + } + ); + console.log(111); + } + } roleType: string = "1"; //登录角色 errmsg: string = ""; //错误信息