Jelajahi Sumber

配置请求地址

张文飞 3 tahun lalu
induk
melakukan
267fa2e888
2 mengubah file dengan 15 tambahan dan 39 penghapusan
  1. 1 39
      App.vue
  2. 14 0
      static/config.js

+ 1 - 39
App.vue

@@ -10,45 +10,7 @@
 				url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+config.appid+"&redirect_uri="+url+"&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect"
 				window.location.href = url;
 			}
-			let BASE_URL = "";
-			var env ='';
-			let res = "3"
-			switch(res){
-			   case '1': //dev
-			     BASE_URL = 'http://192.168.4.212:8866' // 开发环境
-				 env = 'dev'
-				  break;
-			   case '2': //test
-			      BASE_URL = 'https://opentest1.elab.ink'
-				  env = 'test'
-				  break;
-			   case '3'://test2
-				  BASE_URL = 'https://opentest2.elab.ink'
-				  env = 'test2'
-				  break;
-			   case '4'://test3
-				  BASE_URL = 'https://gatewaytest3.skyforestcity.com'
-				  env = 'test3'
-				  break;
-			   case '5'://test4
-				  BASE_URL = 'https://gatewaytest4.skyforestcity.com'
-				  env = 'test4'
-				  break;
-			   case '6'://uat3
-			      BASE_URL = "https://api-uat3.elaber.cn"
-				  env = 'uat3'
-				  break;
-			   case '7': //uat
-			       BASE_URL = "https://api-uat.elaber.cn"
-				   env = 'uat'
-				  break;
-			   case '8':  // 线上 product 
-			   default:
-			       BASE_URL = "https://dm-api.elab-plus.cn"
-				   env = 'production'
-				   break;
-			}
-			this.globalData.BASE_URL = BASE_URL;
+			this.globalData.BASE_URL = config.BASE_URL;
 			this.globalData.env = env;
 		},
 		onShow: function() {

+ 14 - 0
static/config.js

@@ -1,10 +1,24 @@
 /**
  * appid配置文件
  */
+const env = 'test2';
 var config = function() {
 	var result = {
 		appid:"wx55d4c9f89b3b743f"
 	};
+	if (env === 'dev') {
+		result.BASE_URL = "http://192.168.4.212:8866";
+	}else if(env === 'test'){
+		result.BASE_URL = "https://opentest1.elab.ink";
+	}else if(env === 'test2'){
+		result.BASE_URL = "https://opentest2.elab.ink";
+	}else if(env === 'uat'){
+		result.BASE_URL = "";
+	}else if(env === 'product'){
+		result.BASE_URL = "";
+	}else{
+		result.BASE_URL = "";
+	}
     return result;
 }