From 3b86eca19001658c91213b05f4b03414f791f414 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 12 三月 2025 17:16:50 +0800 Subject: [PATCH] // MainUrl: 'http://192.168.1.58:8080/', --- src/stores/global.ts | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/stores/global.ts b/src/stores/global.ts index eeba2d3..f82badc 100644 --- a/src/stores/global.ts +++ b/src/stores/global.ts @@ -1,7 +1,11 @@ -import { MAIN_URL } from '../constants'; +import type { Ref } from 'vue'; +import { ref } from 'vue'; +import { GetSystemGlobalConfig } from '../api/system'; +import { SSE_URL } from '../constants'; import { accessSessionKey } from '../utils/request'; import { SSEClient } from '../utils/sse/SSEClient'; import { Local } from '../utils/storage'; +import type { SystemGlobalConfig } from '../views/types'; /** * 杩炴帴娑堟伅鍚屾鏈嶅姟 @@ -9,10 +13,12 @@ */ const connectMsgSyncService = () => { if (!Local.get(accessSessionKey)) return; + if (!SSE_URL) return; // 鍒涘缓瀹炰緥 const sseClient = new SSEClient( - `${MAIN_URL}chat/connect_broadcast_chat`, + // `https://widev.cpolar.top/sse/chat/connect_broadcast_chat`, // `${MAIN_URL}events` + SSE_URL ); sseClient.connect({ websessionid: Local.get(accessSessionKey), @@ -20,6 +26,18 @@ return sseClient; }; -// export const sseClient = connectMsgSyncService(); -export const sseClient = null; +export const sseClient = connectMsgSyncService(); +/** @description 绯荤粺鍏ㄥ眬閰嶇疆 */ +export const systemGlobalConfig: Ref<SystemGlobalConfig> = ref({} as SystemGlobalConfig); + +/** + * 鑾峰彇绯荤粺鍏ㄥ眬閰嶇疆 + * @returns + */ +export const getSystemGlobalConfig = async () => { + const res = await GetSystemGlobalConfig({ + config_key_list: ['ui.project_city'].join(','), + }); + systemGlobalConfig.value = res.values ?? {}; +}; -- Gitblit v1.9.3