Feature/0723/zr #9

Merged
chenzhen merged 27 commits from feature/0723/ZR into release/0.01 2026-08-08 14:23:42 +08:00
3 changed files with 15 additions and 4 deletions
Showing only changes of commit 117a7f408f - Show all commits
+7
View File
@@ -10,3 +10,10 @@ export const login = (params: { phone: string; password: string }) => {
data: LoginResult;
}>;
};
export const logout = () => {
return post(`/op/logout`) as Promise<{
code: number | string;
msg: string;
}>;
};
+8 -2
View File
@@ -7,6 +7,7 @@ import { usePermissionStore } from '@/stores/permissionStore';
import { useTabsStore } from '@/stores/tabsStore';
import { useUserStore } from '@/stores/userStore';
import { clearAuthDataCache } from '@/api/authCache';
import { logout as logoutApi } from '@/api/login';
import router from '@/router';
const TOKEN_KEY = 'MY_APP_AUTH_TOKEN';
@@ -66,9 +67,14 @@ function createAuth() {
};
/**
* 退出:清除 token → 清除菜单+权限 → 清除动态路由 → 跳转登录页
* 退出:调用登出接口 → 清除 token → 清除菜单+权限 → 清除动态路由 → 跳转登录页
*/
const logout = () => {
const logout = async () => {
try {
await logoutApi();
} catch {
// 即使接口失败也要继续清除本地会话
}
clearSession();
router.push('/login');
};
-2
View File
@@ -113,8 +113,6 @@ export default defineComponent({
okText: '确认',
cancelText: '取消',
onOk: () => {
const { clearUser } = useUserStore();
clearUser();
auth.logout();
},
});