diff --git a/.env.development b/.env.development
index 05d6778..14e1335 100644
--- a/.env.development
+++ b/.env.development
@@ -30,3 +30,6 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
# websocket 开关 默认使用sse推送
VITE_APP_WEBSOCKET = false
+
+# sse 开关
+VITE_APP_SSE = true
diff --git a/.env.production b/.env.production
index c6b1f85..1109bc6 100644
--- a/.env.production
+++ b/.env.production
@@ -33,3 +33,6 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
# websocket 开关 默认使用sse推送
VITE_APP_WEBSOCKET = false
+
+# sse 开关
+VITE_APP_SSE = true
diff --git a/package.json b/package.json
index 48b1571..e67d60f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ruoyi-vue-plus",
- "version": "5.2.2",
+ "version": "5.2.3",
"description": "RuoYi-Vue-Plus多租户管理系统",
"author": "LionLi",
"license": "MIT",
diff --git a/src/api/system/tenant/index.ts b/src/api/system/tenant/index.ts
index 4380dbe..7b7b93f 100644
--- a/src/api/system/tenant/index.ts
+++ b/src/api/system/tenant/index.ts
@@ -91,3 +91,11 @@ export function syncTenantPackage(tenantId: string | number, packageId: string |
params: data
});
}
+
+// 同步租户字典
+export function syncTenantDict() {
+ return request({
+ url: '/system/tenant/syncTenantDict',
+ method: 'get',
+ });
+}
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 0919aad..ce47a30 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -73,7 +73,7 @@ onMounted(() => {
});
onMounted(() => {
- initSSE(import.meta.env.VITE_APP_BASE_API + '/resource/sse')
+ initSSE(import.meta.env.VITE_APP_BASE_API + '/resource/sse');
});
const handleClickOutside = () => {
diff --git a/src/types/env.d.ts b/src/types/env.d.ts
index 777c858..1fb9f62 100644
--- a/src/types/env.d.ts
+++ b/src/types/env.d.ts
@@ -19,6 +19,7 @@ interface ImportMetaEnv {
VITE_APP_RSA_PRIVATE_KEY: string;
VITE_APP_CLIENT_ID: string;
VITE_APP_WEBSOCKET: string;
+ VITE_APP_SSE: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
diff --git a/src/utils/request.ts b/src/utils/request.ts
index f2a69f0..f8f1f53 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -10,6 +10,7 @@ import FileSaver from 'file-saver';
import { getLanguage } from '@/lang';
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
import { encrypt, decrypt } from '@/utils/jsencrypt';
+import router from "@/router";
const encryptHeader = 'encrypt-key';
let downloadLoadingInstance: LoadingInstance;
@@ -134,8 +135,13 @@ service.interceptors.response.use(
}).then(() => {
isRelogin.show = false;
useUserStore().logout().then(() => {
- location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
- });
+ router.replace({
+ path: '/login',
+ query: {
+ redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
+ }
+ })
+ });
}).catch(() => {
isRelogin.show = false;
});
diff --git a/src/utils/sse.ts b/src/utils/sse.ts
index a08f282..9174f0d 100644
--- a/src/utils/sse.ts
+++ b/src/utils/sse.ts
@@ -2,10 +2,12 @@ import { getToken } from '@/utils/auth';
import { ElNotification } from 'element-plus';
import useNoticeStore from '@/store/modules/notice';
-let message = '';
-
// 初始化
export const initSSE = (url: any) => {
+ if (import.meta.env.VITE_APP_SSE === 'false') {
+ return;
+ }
+
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
const {
data,
@@ -15,13 +17,13 @@ export const initSSE = (url: any) => {
retries: 10,
delay: 3000,
onFailed() {
- console.log('Failed to connect after 10 retries')
- },
+ console.log('Failed to connect after 10 retries');
+ }
}
});
watch(error, () => {
- console.log('SSE connection error:', error.value)
+ console.log('SSE connection error:', error.value);
error.value = null;
});
@@ -41,5 +43,3 @@ export const initSSE = (url: any) => {
data.value = null;
});
};
-
-
diff --git a/src/views/index.vue b/src/views/index.vue
index 7bd19e4..b67eb07 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -33,7 +33,7 @@
* 部署方式 Docker 容器编排 一键部署业务集群
* 国际化 SpringMessage Spring标准国际化方案
当前版本: v5.2.2
+当前版本: v5.2.3
当前版本: v2.2.1
+当前版本: v2.2.2