|
@@ -5,7 +5,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="layout">
|
|
|
-import { computed, type Component } from 'vue'
|
|
|
+import { computed, type Component, onMounted } from 'vue'
|
|
|
import { LayoutType } from '@/stores/interface'
|
|
|
import { useGlobalStore } from '@/stores/modules/global'
|
|
|
import ThemeDrawer from './components/ThemeDrawer/index.vue'
|
|
@@ -13,6 +13,14 @@ import LayoutVertical from './LayoutVertical/index.vue'
|
|
|
import LayoutClassic from './LayoutClassic/index.vue'
|
|
|
import LayoutTransverse from './LayoutTransverse/index.vue'
|
|
|
import LayoutColumns from './LayoutColumns/index.vue'
|
|
|
+import { useUserStore } from '@/stores/modules/user'
|
|
|
+import { initWebSocket } from '@/utils/websocket'
|
|
|
+onMounted(() => {
|
|
|
+ const userStore = useUserStore()
|
|
|
+ let protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'
|
|
|
+ // initWebSocket(protocol + 'localhost:8089' + '/resource/websocket')
|
|
|
+ initWebSocket(protocol + window.location.host + import.meta.env.VITE_API_URL + '/websocket/message/' + userStore.name)
|
|
|
+})
|
|
|
const LayoutComponents: Record<LayoutType, Component> = {
|
|
|
vertical: LayoutVertical,
|
|
|
classic: LayoutClassic,
|