From 565900536afaece54ba107c863a2fef31b9100f9 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 20 Oct 2023 17:33:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=89=93=E5=8C=85=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 ++ quasar.config.js | 4 ++++ src/configs/UrlManage.ts | 31 +++++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a6cd46f..3198a09 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "test": "echo \"No test specified\" && exit 0", "dev": "quasar dev", "build": "quasar build", + "build:test": "set NODE_ENV=test&&quasar build", + "build:publish": "set NODE_ENV=publish&&quasar build", "protoc": "node scripts/proto.cjs", "sync": "node scripts/sync.cjs" }, diff --git a/quasar.config.js b/quasar.config.js index 3f02c23..7973526 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -52,6 +52,10 @@ module.exports = configure(function (/* ctx */) { // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build build: { + env: { + // test:测试服务器;publish:正式服务器;其他本地 + ENV_MODE: process.env.NODE_ENV, + }, target: { browser: ['es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1'], node: 'node16', diff --git a/src/configs/UrlManage.ts b/src/configs/UrlManage.ts index 73b2dcd..48def03 100644 --- a/src/configs/UrlManage.ts +++ b/src/configs/UrlManage.ts @@ -1,4 +1,9 @@ function getHost(): string { + if (process.env.ENV_MODE == 'test') { + return 'test.joylink.club/bjrtss-server'; + } else if (process.env.ENV_MODE == 'publish') { + return 'joylink.club/bjrtss-server'; + } // return '192.168.3.7:9091'; // return '192.168.3.47:9091'; // return '192.168.3.37:9091'; @@ -6,18 +11,28 @@ function getHost(): string { // return '192.168.3.5:9091'; // return '192.168.3.37:9091'; return '192.168.3.233:9091'; - // return 'test.joylink.club/bjrtss-server'; } export function getHttpBase() { - return `http://${getHost()}`; - // return `https://${getHost()}`; + let protocol = 'http'; + if (['test', 'publish'].includes(process.env.ENV_MODE as string)) { + protocol = 'https'; + } + return `${protocol}://${getHost()}`; } export function getWebsocketUrl() { - const host = '192.168.3.233'; - const port = 8000; - // return `ws://${host}/ws-bj`; - return `ws://${host}:${port}/connection/websocket`; - // return `wss://${getHost()}/ws-bj`; + let protocol = 'ws'; + let host = '192.168.3.233'; + let port = '8000'; + if (process.env.ENV_MODE == 'test') { + protocol = 'wss'; + host = 'test.joylink.club/bjrtss-server'; + port = ''; + } else if (process.env.ENV_MODE == 'publish') { + protocol = 'wss'; + host = 'joylink.club/bjrtss-server'; + port = ''; + } + return `${protocol}://${host}:${port}/connection/websocket`; } From c5e186911a76535ff95b3b3beda48f8feede8f48 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 20 Oct 2023 17:50:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=85=AC=E9=87=8C=E6=A0=87=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/DrawLayout.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 7a85343..69c7db1 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -36,12 +36,6 @@ - 关联设备列表 + + + 公里标转换 + +