This commit is contained in:
dap
2024-08-21 19:45:28 +08:00
33 changed files with 286 additions and 254 deletions

View File

@@ -44,7 +44,7 @@
"@vueuse/core": "^11.0.1",
"ant-design-vue": "^4.2.3",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.12",
"dayjs": "^1.11.13",
"echarts": "^5.5.1",
"jsencrypt": "^3.3.2",
"lodash-es": "^4.17.21",

View File

@@ -62,7 +62,10 @@ function createRequestClient(baseURL: string) {
const accessStore = useAccessStore();
const authStore = useAuthStore();
accessStore.setAccessToken(null);
if (preferences.app.loginExpiredMode === 'modal') {
if (
preferences.app.loginExpiredMode === 'modal' &&
accessStore.isAccessChecked
) {
accessStore.setLoginExpired(true);
} else {
await authStore.logout();

View File

@@ -91,4 +91,4 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
});
}
export { $t, antdLocale, loadMessages, setupI18n };
export { $t, antdLocale, setupI18n };

View File

@@ -92,10 +92,8 @@ function setupAccessGuard(router: Router) {
return to;
}
const accessRoutes = accessStore.accessRoutes;
// 是否已经生成过动态路由
if (accessRoutes && accessRoutes.length > 0) {
if (accessStore.isAccessChecked) {
return true;
}
@@ -115,6 +113,7 @@ function setupAccessGuard(router: Router) {
// 保存菜单信息和路由信息
accessStore.setAccessMenus(accessibleMenus);
accessStore.setAccessRoutes(accessibleRoutes);
accessStore.setIsAccessChecked(true);
const redirectPath = (from.query.redirect ?? to.fullPath) as string;
return {