Skip to content

Commit 1606dbd

Browse files
JavaLionLigitee-org
authored andcommitted
!141 发布 vue 版本 5.2.2 与 cloud 版本 2.2.1
Merge pull request !141 from 疯狂的狮子Li/dev
2 parents ba24afc + 3c2d910 commit 1606dbd

File tree

22 files changed

+132
-280
lines changed

22 files changed

+132
-280
lines changed

.env.development

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ VITE_APP_RSA_PRIVATE_KEY = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3C
2828
# 客户端id
2929
VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
3030

31-
# websocket 开关
32-
VITE_APP_WEBSOCKET = true
31+
# websocket 开关 默认使用sse推送
32+
VITE_APP_WEBSOCKET = false

.env.production

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ VITE_APP_RSA_PRIVATE_KEY = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3C
3131
# 客户端id
3232
VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
3333

34-
# websocket 开关
35-
VITE_APP_WEBSOCKET = true
34+
# websocket 开关 默认使用sse推送
35+
VITE_APP_WEBSOCKET = false

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ruoyi-vue-plus",
3-
"version": "5.2.1",
3+
"version": "5.2.2",
44
"description": "RuoYi-Vue-Plus多租户管理系统",
55
"author": "LionLi",
66
"license": "MIT",
@@ -30,7 +30,7 @@
3030
"diagram-js": "12.3.0",
3131
"didi": "9.0.2",
3232
"echarts": "5.5.0",
33-
"element-plus": "2.7.5",
33+
"element-plus": "2.7.8",
3434
"file-saver": "2.0.5",
3535
"fuse.js": "7.0.0",
3636
"highlight.js": "11.9.0",
@@ -40,7 +40,7 @@
4040
"nprogress": "0.2.0",
4141
"pinia": "2.1.7",
4242
"screenfull": "6.0.2",
43-
"vue": "3.4.25",
43+
"vue": "3.4.34",
4444
"vue-cropper": "1.1.1",
4545
"vue-i18n": "9.10.2",
4646
"vue-router": "4.3.2",
@@ -81,7 +81,7 @@
8181
"unplugin-icons": "0.18.5",
8282
"unplugin-vue-components": "0.26.0",
8383
"unplugin-vue-setup-extend-plus": "1.0.1",
84-
"vite": "5.2.10",
84+
"vite": "5.2.12",
8585
"vite-plugin-compression": "0.5.1",
8686
"vite-plugin-svg-icons": "2.0.1",
8787
"vitest": "1.5.0",

src/api/login.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export function register(data: any) {
5151
* 注销
5252
*/
5353
export function logout() {
54+
request({
55+
url: '/resource/sse/close',
56+
method: 'get'
57+
});
5458
return request({
5559
url: '/auth/logout',
5660
method: 'post'

src/api/workflow/nodeConfig/index.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/layout/components/Navbar.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const dynamicTenantEvent = async (tenantId: string) => {
128128
dynamic.value = true;
129129
proxy?.$tab.closeAllPage();
130130
proxy?.$router.push('/');
131+
proxy?.$tab.refreshPage();
131132
}
132133
};
133134
@@ -136,6 +137,7 @@ const dynamicClearEvent = async () => {
136137
dynamic.value = false;
137138
proxy?.$tab.closeAllPage();
138139
proxy?.$router.push('/');
140+
proxy?.$tab.refreshPage();
139141
};
140142
141143
/** 租户列表 */

src/layout/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { AppMain, Navbar, Settings, TagsView } from './components';
2727
import useAppStore from '@/store/modules/app';
2828
import useSettingsStore from '@/store/modules/settings';
2929
import { initWebSocket } from '@/utils/websocket';
30+
import { initSSE } from "@/utils/sse";
3031
3132
const settingsStore = useSettingsStore();
3233
const theme = computed(() => settingsStore.theme);
@@ -71,6 +72,10 @@ onMounted(() => {
7172
initWebSocket(protocol + window.location.host + import.meta.env.VITE_APP_BASE_API + '/resource/websocket');
7273
});
7374
75+
onMounted(() => {
76+
initSSE(import.meta.env.VITE_APP_BASE_API + '/resource/sse')
77+
});
78+
7479
const handleClickOutside = () => {
7580
useAppStore().closeSideBar({ withoutAnimation: false });
7681
};

src/permission.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ router.beforeEach(async (to, from, next) => {
4040
router.addRoute(route); // 动态添加可访问路由表
4141
}
4242
});
43+
// @ts-ignore
4344
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
4445
}
4546
} else {

src/plugins/tab.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import router from '@/router';
2-
import { RouteLocationMatched, RouteLocationNormalized } from 'vue-router';
2+
import {RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw} from 'vue-router';
33
import useTagsViewStore from '@/store/modules/tagsView';
44

55
export default {
@@ -41,7 +41,7 @@ export default {
4141
});
4242
},
4343
// 关闭当前tab页签,打开新页签
44-
closeOpenPage(obj: RouteLocationNormalized): void {
44+
closeOpenPage(obj: RouteLocationRaw): void {
4545
useTagsViewStore().delView(router.currentRoute.value);
4646
if (obj !== undefined) {
4747
router.push(obj);

src/router/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
159159
path: 'index/:tableId(\\d+)',
160160
component: () => import('@/views/tool/gen/editTable.vue'),
161161
name: 'GenEdit',
162-
meta: { title: '修改生成配置', activeMenu: '/tool/gen', icon: '' }
162+
meta: { title: '修改生成配置', activeMenu: '/tool/gen', icon: '', noCache: true }
163163
}
164164
]
165165
},

src/store/modules/permission.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export const usePermissionStore = defineStore('permission', () => {
2121
const sidebarRouters = ref<RouteRecordRaw[]>([]);
2222

2323
const getRoutes = (): RouteRecordRaw[] => {
24-
return routes.value;
24+
return routes.value as RouteRecordRaw[];
2525
};
2626
const getSidebarRoutes = (): RouteRecordRaw[] => {
27-
return sidebarRouters.value;
27+
return sidebarRouters.value as RouteRecordRaw[];
2828
};
2929
const getTopbarRoutes = (): RouteRecordRaw[] => {
30-
return topbarRouters.value;
30+
return topbarRouters.value as RouteRecordRaw[];
3131
};
3232

3333
const setRoutes = (newRoutes: RouteRecordRaw[]): void => {

src/store/modules/tagsView.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export const useTagsViewStore = defineStore('tagsView', () => {
66
const iframeViews = ref<RouteLocationNormalized[]>([]);
77

88
const getVisitedViews = (): RouteLocationNormalized[] => {
9-
return visitedViews.value;
9+
return visitedViews.value as RouteLocationNormalized[];
1010
};
1111
const getIframeViews = (): RouteLocationNormalized[] => {
12-
return iframeViews.value;
12+
return iframeViews.value as RouteLocationNormalized[];
1313
};
1414
const getCachedViews = (): string[] => {
1515
return cachedViews.value;
@@ -31,7 +31,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
3131
const delIframeView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
3232
return new Promise((resolve) => {
3333
iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path);
34-
resolve([...iframeViews.value]);
34+
resolve([...iframeViews.value as RouteLocationNormalized[]]);
3535
});
3636
};
3737
const addVisitedView = (view: RouteLocationNormalized): void => {
@@ -54,7 +54,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
5454
delCachedView(view);
5555
}
5656
resolve({
57-
visitedViews: [...visitedViews.value],
57+
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
5858
cachedViews: [...cachedViews.value]
5959
});
6060
});
@@ -68,7 +68,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
6868
break;
6969
}
7070
}
71-
resolve([...visitedViews.value]);
71+
resolve([...visitedViews.value as RouteLocationNormalized[]]);
7272
});
7373
};
7474
const delCachedView = (view?: RouteLocationNormalized): Promise<string[]> => {
@@ -92,7 +92,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
9292
delOthersVisitedViews(view);
9393
delOthersCachedViews(view);
9494
resolve({
95-
visitedViews: [...visitedViews.value],
95+
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
9696
cachedViews: [...cachedViews.value]
9797
});
9898
});
@@ -103,7 +103,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
103103
visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => {
104104
return v.meta?.affix || v.path === view.path;
105105
});
106-
resolve([...visitedViews.value]);
106+
resolve([...visitedViews.value as RouteLocationNormalized[]]);
107107
});
108108
};
109109
const delOthersCachedViews = (view: RouteLocationNormalized): Promise<string[]> => {
@@ -124,15 +124,15 @@ export const useTagsViewStore = defineStore('tagsView', () => {
124124
delAllVisitedViews();
125125
delAllCachedViews();
126126
resolve({
127-
visitedViews: [...visitedViews.value],
127+
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
128128
cachedViews: [...cachedViews.value]
129129
});
130130
});
131131
};
132132
const delAllVisitedViews = (): Promise<RouteLocationNormalized[]> => {
133133
return new Promise((resolve) => {
134134
visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix);
135-
resolve([...visitedViews.value]);
135+
resolve([...visitedViews.value as RouteLocationNormalized[]]);
136136
});
137137
};
138138

@@ -167,7 +167,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
167167
}
168168
return false;
169169
});
170-
resolve([...visitedViews.value]);
170+
resolve([...visitedViews.value as RouteLocationNormalized[]]);
171171
});
172172
};
173173
const delLeftTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
@@ -186,7 +186,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
186186
}
187187
return false;
188188
});
189-
resolve([...visitedViews.value]);
189+
resolve([...visitedViews.value as RouteLocationNormalized[]]);
190190
});
191191
};
192192

src/utils/sse.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { getToken } from '@/utils/auth';
2+
import { ElNotification } from 'element-plus';
3+
import useNoticeStore from '@/store/modules/notice';
4+
5+
let message = '';
6+
7+
// 初始化
8+
export const initSSE = (url: any) => {
9+
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
10+
const {
11+
data,
12+
error
13+
} = useEventSource(url, [], {
14+
autoReconnect: {
15+
retries: 10,
16+
delay: 3000,
17+
onFailed() {
18+
console.log('Failed to connect after 10 retries')
19+
},
20+
}
21+
});
22+
23+
watch(error, () => {
24+
console.log('SSE connection error:', error.value)
25+
error.value = null;
26+
});
27+
28+
watch(data, () => {
29+
if (!data.value) return;
30+
useNoticeStore().addNotice({
31+
message: data.value,
32+
read: false,
33+
time: new Date().toLocaleString()
34+
});
35+
ElNotification({
36+
title: '消息',
37+
message: data.value,
38+
type: 'success',
39+
duration: 3000
40+
});
41+
data.value = null;
42+
});
43+
};
44+
45+

0 commit comments

Comments
 (0)