diff --git a/App.vue b/App.vue index 452bf3e..d6f3e30 100644 --- a/App.vue +++ b/App.vue @@ -9,6 +9,7 @@ import appConfig from '@/config/appConfig.js'; import { provide, onMounted } from 'vue'; import WebsocketUtil from '@/commons/utils/websocket.js'; +console.log('appConfig.wss',appConfig.wss); const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // 创建 WebSocket 工具类实例 provide('websocketUtil', websocketUtil); // 提供给所有子组件 onMounted(() => {}); diff --git a/config/appConfig.js b/config/appConfig.js index 6ea43e1..b5d47bb 100644 --- a/config/appConfig.js +++ b/config/appConfig.js @@ -25,8 +25,8 @@ export function returnBaseUrl(param) { env, apiType } = param - if(!env){ - env=ENV + if (!env) { + env = ENV } console.log('env', env); console.log('apiType', apiType); @@ -70,6 +70,23 @@ export function returnBaseUrl(param) { } +function returnWss(env) { + // #ifdef H5 + if (env === 'test') { + return 'http://192.168.1.42:2348' + } else { + return 'https://czgeatws.sxczgkj.com/wss' + } + // #endif + // #ifndef H5 + if (env === 'test') { + return 'ws://192.168.1.42:2348' + } else { + return 'wss://czgeatws.sxczgkj.com/wss' + } + // #endif + +} const appConfig = { @@ -85,7 +102,7 @@ const appConfig = { env: {}, // wss: "wss://sockets.sxczgkj.com/wss", //测试环境 - wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境 + wss: returnWss(), //正式环境 // 环境变量常量 ENV_ENUM: { DEVELOPMENT: 'development', // 本地调试地址 diff --git a/env/config.js b/env/config.js index ac34664..ae7f5de 100644 --- a/env/config.js +++ b/env/config.js @@ -30,7 +30,7 @@ const processEnv = process.env.NODE_ENV // 改变env环境 function changeEnv(envMode){ appConfig.env = allEnvMap[envMode || processEnv] - appConfig.wss = allEnvMap[envMode || processEnv].JEEPAY_BASE_URL_WSS + // appConfig.wss = allEnvMap[envMode || processEnv].JEEPAY_BASE_URL_WSS } export default { changeEnv: changeEnv } diff --git a/pagesOrder/detail/components/order.vue b/pagesOrder/detail/components/order.vue index ffa7974..a24edab 100644 --- a/pagesOrder/detail/components/order.vue +++ b/pagesOrder/detail/components/order.vue @@ -43,7 +43,7 @@ 打印状态 - +