From 9f8d45f450f968a22f6287e5e05f498bb126b6fc Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Tue, 2 Apr 2024 20:20:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +++--- quasar.config.js | 1 + src/configs/UrlManage.ts | 15 +++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b052c6a..08eba57 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore", "test": "echo \"No test specified\" && exit 0", "dev": "quasar dev", - "build": "set URL_ENV=local_test&&quasar build", - "build:test": "API_URL=local quasar build", - "build:publish": "set URL_ENV=publish&&quasar build", + "build": "URL_ENV=local quasar build", + "build:test": "URL_ENV=test quasar build", + "build:publish": "URL_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 805c43e..ff27f67 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -55,6 +55,7 @@ module.exports = configure(function (/* ctx */) { env: { // test:测试服务器;publish:正式服务器;其他本地 ENV_MODE: process.env.NODE_ENV, + URL_ENV: process.env.URL_ENV }, target: { browser: ['es2020'], diff --git a/src/configs/UrlManage.ts b/src/configs/UrlManage.ts index 0334a30..6a575cd 100644 --- a/src/configs/UrlManage.ts +++ b/src/configs/UrlManage.ts @@ -1,16 +1,15 @@ function getHost(): string { - console.log(process.env.ENV_MODE, process.env.URL_ENV, '000'); - if (process.env.ENV_MODE == 'test') { + if (process.env.URL_ENV == 'test') { return 'test.joylink.club/bjrtsts-server'; - } else if (process.env.ENV_MODE == 'publish') { + } else if (process.env.URL_ENV == 'publish') { return 'joylink.club/bjrtsts-server'; - } else if (process.env.ENV_MODE == 'local_test') { + } else if (process.env.URL_ENV == 'local_test') { return '192.168.33.233:9091'; } // return '192.168.3.7:9091'; // return '192.168.3.47:9091'; // return '192.168.3.37:9091'; - // return '192.168.33.207:9091'; // 张骞 + return '192.168.33.207:9091'; // 张骞 // return '192.168.33.93:9091'; // return '192.168.3.37:9091'; //卫志宏 // return 'test.joylink.club/bjrtsts-service'; // 测试 @@ -19,7 +18,7 @@ function getHost(): string { export function getHttpBase() { let protocol = 'http'; - if (['publish'].includes(process.env.ENV_MODE as string)) { + if (['publish'].includes(process.env.URL_ENV as string)) { protocol = 'https'; } return `${protocol}://${getHost()}`; @@ -31,12 +30,12 @@ export function getWebsocketUrl() { // let host = 'test.joylink.club'; let port = '8083'; let url = `${protocol}://${host}:${port}`; - if (process.env.ENV_MODE == 'test') { + if (process.env.URL_ENV == 'test') { // protocol = 'wss'; host = 'test.joylink.club/bjrtsts-server'; port = ''; url = `${protocol}://${host}`; - } else if (process.env.ENV_MODE == 'publish') { + } else if (process.env.URL_ENV == 'publish') { protocol = 'wss'; host = 'joylink.club/bjrtsts-server'; port = '';