|
|
|
@ -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 = ""; //错误信息
|
|
|
|
|