diff --git a/.env.development b/.env.development index 7edd98a..53ae057 100644 --- a/.env.development +++ b/.env.development @@ -26,5 +26,5 @@ VITE_APP_RSA_PRIVATE_KEY = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3C # 客户端id VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e' -# websocket 开关(开发环境默认关闭ws 因vite的bug导致如ws无法连接则会崩溃) -VITE_APP_WEBSOCKET = false +# websocket 开关 +VITE_APP_WEBSOCKET = true diff --git a/package.json b/package.json index aec69c0..1395590 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "5.1.1", + "version": "5.1.2", "description": "RuoYi-Vue-Plus多租户管理系统", "author": "LionLi", "license": "MIT", @@ -23,10 +23,10 @@ "@vueuse/core": "10.7.0", "animate.css": "4.1.1", "await-to-js": "^3.0.0", - "axios": "^1.3.4", - "crypto-js": "^4.1.1", + "axios": "^1.6.0", + "crypto-js": "^4.2.0", "echarts": "5.4.3", - "element-plus": "2.4.3", + "element-plus": "2.4.4", "file-saver": "2.0.5", "fuse.js": "6.6.2", "js-cookie": "3.0.5", @@ -37,7 +37,7 @@ "pinia": "2.1.7", "screenfull": "6.0.0", "vform3-builds": "3.0.8", - "vue": "3.3.11", + "vue": "3.3.13", "vue-cropper": "1.1.1", "vue-i18n": "9.2.2", "vue-router": "4.2.5", @@ -46,9 +46,9 @@ "devDependencies": { "@iconify/json": "^2.2.157", "@intlify/unplugin-vue-i18n": "1.6.0", - "@types/crypto-js": "^4.1.1", + "@types/crypto-js": "^4.2.0", "@types/file-saver": "2.0.5", - "@types/js-cookie": "3.0.3", + "@types/js-cookie": "3.0.5", "@types/node": "18.14.2", "@types/nprogress": "0.2.0", "@types/path-browserify": "^1.0.0", @@ -74,7 +74,7 @@ "postcss": "^8.4.21", "prettier": "3.1.1", "sass": "1.69.5", - "typescript": "5.2.2", + "typescript": "5.3.3", "unocss": "^0.58.0", "unplugin-auto-import": "0.17.2", "unplugin-icons": "0.18.1", @@ -85,6 +85,6 @@ "vitest": "^0.29.7", "vue-eslint-parser": "9.3.2", "vue-tsc": "0.35.0", - "vite": "5.0.4" + "vite": "5.0.5" } } diff --git a/src/api/system/client/index.ts b/src/api/system/client/index.ts index 06544da..6b302b0 100644 --- a/src/api/system/client/index.ts +++ b/src/api/system/client/index.ts @@ -64,12 +64,12 @@ export const delClient = (id: string | number | Array) => { /** * 状态修改 - * @param id ID + * @param clientId 客户端id * @param status 状态 */ -export function changeStatus(id: number | string, status: string) { +export function changeStatus(clientId: string, status: string) { const data = { - id, + clientId, status }; return request({ diff --git a/src/api/system/client/types.ts b/src/api/system/client/types.ts index d7cb926..142118d 100644 --- a/src/api/system/client/types.ts +++ b/src/api/system/client/types.ts @@ -7,7 +7,7 @@ export interface ClientVO { /** * 客户端id */ - clientId: string | number; + clientId: string; /** * 客户端key diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 939d08b..f42473a 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -13,7 +13,7 @@ :collapse-transition="false" mode="vertical" > - + @@ -35,7 +35,7 @@ const route = useRoute(); const appStore = useAppStore(); const settingsStore = useSettingsStore(); const permissionStore = usePermissionStore(); -const sidebarRouters = computed(() => permissionStore.sidebarRouters as any); +const sidebarRouters = computed(() => permissionStore.sidebarRouters); const showLogo = computed(() => settingsStore.sidebarLogo); const sideTheme = computed(() => settingsStore.sideTheme); const theme = computed(() => settingsStore.theme); diff --git a/src/layout/index.vue b/src/layout/index.vue index fa43e69..8fe5554 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -26,6 +26,7 @@ import SideBar from './components/Sidebar/index.vue'; import { AppMain, Navbar, Settings, TagsView } from './components'; import useAppStore from '@/store/modules/app'; import useSettingsStore from '@/store/modules/settings'; +import { initWebSocket } from '@/utils/websocket'; const settingsStore = useSettingsStore(); const theme = computed(() => settingsStore.theme); @@ -65,6 +66,11 @@ onMounted(() => { }); }); +onMounted(() => { + let protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'; + initWebSocket(protocol + window.location.host + import.meta.env.VITE_APP_BASE_API + '/resource/websocket'); +}); + const handleClickOutside = () => { useAppStore().closeSideBar({ withoutAnimation: false }); }; diff --git a/src/types/element.d.ts b/src/types/element.d.ts index 4ab01d5..2087773 100644 --- a/src/types/element.d.ts +++ b/src/types/element.d.ts @@ -16,11 +16,6 @@ declare global { declare type ElColorPickerInstance = ep.ColorPickerInstance; declare type ElRateInstance = ep.RateInstance; declare type ElSliderInstance = ep.SliderInstance; - declare type TransferKey = ep.TransferKey; - declare type CheckboxValueType = ep.CheckboxValueType; - declare type ElFormRules = ep.FormRules; - declare type DateModelType = ep.DateModelType; - declare type UploadFile = ep.UploadFile; declare type ElTreeInstance = InstanceType; declare type ElTreeSelectInstance = InstanceType; @@ -31,4 +26,11 @@ declare global { declare type ElDatePickerInstance = InstanceType; declare type ElTimePickerInstance = InstanceType; declare type ElTimeSelectInstance = InstanceType; + + declare type TransferKey = ep.TransferKey; + declare type CheckboxValueType = ep.CheckboxValueType; + declare type ElFormRules = ep.FormRules; + declare type DateModelType = ep.DateModelType; + declare type UploadFile = ep.UploadFile; + } diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index 7add725..d4dd8a8 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -19,10 +19,8 @@ */ import { getToken } from '@/utils/auth'; -import useNoticeStore from '@/store/modules/notice'; import { ElNotification } from 'element-plus'; - -const { addNotice } = useNoticeStore(); +import useNoticeStore from '@/store/modules/notice'; let socketUrl: any = ''; // socket地址 let websocket: any = null; // websocket 实例 @@ -125,7 +123,7 @@ export const websocketonmessage = () => { if (e.data.indexOf('ping') > 0) { return; } - addNotice({ + useNoticeStore().addNotice({ message: e.data, read: false, time: new Date().toLocaleString() diff --git a/src/views/index.vue b/src/views/index.vue index efb8b50..3f853a3 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -33,7 +33,7 @@ * 部署方式 Docker 容器编排 一键部署业务集群
* 国际化 SpringMessage Spring标准国际化方案

-

当前版本: v5.1.1

+

当前版本: v5.1.2

¥免费开源

@@ -78,7 +78,7 @@ * 分布式监控 Prometheus、Grafana 全方位性能监控
* 其余与 Vue 版本一致

-

当前版本: v2.1.1

+

当前版本: v2.1.2

¥免费开源

@@ -96,13 +96,6 @@