|
@@ -264,23 +264,19 @@ const handleLogin = async (params) => {
|
|
|
authUtil.removeLoginForm()
|
|
|
}
|
|
|
authUtil.setToken(res)
|
|
|
- try {
|
|
|
- const userType = await LoginApi.getInfo();
|
|
|
- console.log(userType,"我在这里");
|
|
|
- console.log(userType); // 查看 userType 的结构
|
|
|
- if (userType && Array.isArray(userType.roles)) {
|
|
|
- if (userType.roles.indexOf("student") !== -1) {
|
|
|
- console.log("我是学生");
|
|
|
- window.location.href = '/system/studentSelf/index';
|
|
|
- } else {
|
|
|
- console.log("我不是学生");
|
|
|
- window.location.href = '/system/Home/index';
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.error("userType 或 roles 格式错误");
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error("获取用户信息时发生错误:", error);
|
|
|
+ const userType = await LoginApi.getInfo()
|
|
|
+ console.log(userType,"我在这里")
|
|
|
+ console.log(userType); // 查看 userType 的结构
|
|
|
+ if (userType && Array.isArray(userType.roles)) {
|
|
|
+ if (userType.roles.indexOf("student") !== -1) {
|
|
|
+ console.log("我是学生");
|
|
|
+ window.location.href = '/system/studentSelf/index';
|
|
|
+ } else {
|
|
|
+ console.log("我不是学生");
|
|
|
+ window.location.href = '/system/Home/index';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error("userType 或 roles 格式错误");
|
|
|
}
|
|
|
} finally {
|
|
|
loginLoading.value = false
|