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 859d1a2..8dee0e8 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -55,7 +55,7 @@ module.exports = configure(function (/* ctx */) { env: { // test:测试服务器;publish:正式服务器;其他本地 ENV_MODE: process.env.NODE_ENV, - API_URL: process.env.API_URL, + URL_ENV: process.env.URL_ENV }, target: { browser: ['es2020'], diff --git a/src/configs/UrlManage.ts b/src/configs/UrlManage.ts index eaee881..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.API_URL, '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 = '';