Browse Source

添加Env配置

yanj 2 days ago
parent
commit
272d21ce9b
2 changed files with 5 additions and 2 deletions
  1. 3 0
      package.json
  2. 2 2
      utils/request.js

+ 3 - 0
package.json

@@ -14,6 +14,7 @@
 			"dev": {
 			"dev": {
 				"title": "小程序-开发环境",
 				"title": "小程序-开发环境",
 				"env": {
 				"env": {
+					"ENV_TYPE": "dev",
 					"UNI_PLATFORM": "mp-weixin",
 					"UNI_PLATFORM": "mp-weixin",
 					"NAME": "dev",
 					"NAME": "dev",
 					"TOKEN_KEY": "token",
 					"TOKEN_KEY": "token",
@@ -26,6 +27,7 @@
 			"text": {
 			"text": {
 				"title": "小程序-测试环境",
 				"title": "小程序-测试环境",
 				"env": {
 				"env": {
+					"ENV_TYPE": "test",
 					"UNI_PLATFORM": "mp-weixin",
 					"UNI_PLATFORM": "mp-weixin",
 					"NAME": "test",
 					"NAME": "test",
 					"TOKEN_KEY": "token",
 					"TOKEN_KEY": "token",
@@ -38,6 +40,7 @@
 			"prod": {
 			"prod": {
 				"title": "小程序-生产环境",
 				"title": "小程序-生产环境",
 				"env": {
 				"env": {
+					"ENV_TYPE": "prod",
 					"UNI_PLATFORM": "mp-weixin",
 					"UNI_PLATFORM": "mp-weixin",
 					"NAME": "prod",
 					"NAME": "prod",
 					"TOKEN_KEY": "token",
 					"TOKEN_KEY": "token",

+ 2 - 2
utils/request.js

@@ -68,7 +68,7 @@ class Request {
 			if (process.env.NODE_ENV !== 'development') {
 			if (process.env.NODE_ENV !== 'development') {
 				console.log("请求地址:" + this.url, this.data)
 				console.log("请求地址:" + this.url, this.data)
 			}
 			}
-			
+
 			weixin.request({
 			weixin.request({
 				url: this.url,
 				url: this.url,
 				method: this.method,
 				method: this.method,
@@ -206,4 +206,4 @@ export const upload = (url) =>  (params) => {
 		  }
 		  }
 		})
 		})
 	})
 	})
-}
+}