This commit is contained in:
Putoo
2026-05-15 17:08:04 +08:00
parent 52ad7e79ec
commit 78759387f7
13 changed files with 511 additions and 632 deletions

View File

@@ -64,25 +64,37 @@ export class ApiService {
}
const result = response.data;
if (result.code === 401) {
//401刷新token
console.log(result.data);
} else if (result.code === 40101) {
this.redirectToLogin();
throw {
handled: true,
redirectTo: "/login/login",
redirectTo: "/",//跳转回首页
message: result.msg || "登录已失效"
} satisfies HandledRedirectError;
} else if (result.code === 500) {
// 跳转错误页面
throw {
handled: true,
redirectTo: "/",//跳转回首页
message: result.msg || "登录已失效"
} satisfies HandledRedirectError;
} else if (result.code === 404) {
// 跳转不存在页面
throw {
handled: true,
redirectTo: "/",//跳转回首页
message: result.msg || "登录已失效"
} satisfies HandledRedirectError;
}
return response;
},
onRejected: (error) => {
if (error && typeof error === "object" && "status" in error) {
// console.log("接口错误:", error);
// console.log("接口错误:", error);
}
return error;

View File

@@ -25,5 +25,12 @@ export class StateHelper {
{
this.userStore.offOnline();
}
static get IsAccLogin(){
return this.userStore.isLoginAccount;
}
static get IsLogin(){
return this.userStore.isLogin;
}
}