From f72f4930fa93aa990d70256ee3a8e2bbedab0b47 Mon Sep 17 00:00:00 2001 From: ywk <317226901@qq.com> Date: Wed, 9 Apr 2025 09:30:26 +0800 Subject: [PATCH] chore(package): add env --- config/request.js | 9 +++++++++ package.json | 24 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/config/request.js b/config/request.js index 68faa98..2ee1cd8 100644 --- a/config/request.js +++ b/config/request.js @@ -10,7 +10,16 @@ module.exports = (vm) => { uni.$u.http.setConfig((config) => { // config.baseURL = 'https://p1.hzs413.com/inter-api'; // 192.168.0.100:8080 + + //#ifdef DEV_SERVER + console.log('DEV_SERVER') + config.baseURL = 'http://192.168.0.100:8080'; + //#endif + + //#ifdef QA_SERVER + console.log('QA_SERVER') config.baseURL = 'http://60.205.203.247/prod-api'; + //#endif config.timeout = 30000; return config }) diff --git a/package.json b/package.json index edac290..2783b95 100644 --- a/package.json +++ b/package.json @@ -33,5 +33,27 @@ }, "keywords": [], "author": "", - "license": "ISC" + "license": "ISC", + "uni-app": { + "scripts": { + "dev-env": { + "title": "开发环境", + "env": { + "UNI_PLATFORM": "h5" + }, + "define": { + "DEV_SERVER": true + } + }, + "prod-env": { + "title": "测试环境", + "env": { + "UNI_PLATFORM": "h5" + }, + "define": { + "QA_SERVER": true + } + } + } + } } \ No newline at end of file