lalala 6 yıl önce
ebeveyn
işleme
e3f4c94224

+ 2 - 2
admin-update/src/config/env.js

@@ -1,5 +1,5 @@
 import store from 'store';
-import { getUrlParam } from '@/cool/utils';
+import { getUrlParam, getFirstHost } from '@/cool/utils';
 
 const env = process.env;
 
@@ -22,7 +22,7 @@ const baseUrl = (() => {
 			return `/${proxy}`;
 		case 'production':
 			// return `http://api.b.huaml.com`;
-			return `${window.location.protocol}//api.${window.location.host}`;
+			return `${window.location.protocol}//api.b.${getFirstHost()}.com`;
 		default:
 			return '';
 	}

+ 2 - 2
admin-update/src/config/s-env.js

@@ -1,5 +1,5 @@
 import store from 'store';
-import { getUrlParam } from '@/cool/utils';
+import { getUrlParam, getFirstHost } from '@/cool/utils';
 
 // 路由模式
 const routerMode = 'hash';
@@ -20,7 +20,7 @@ const baseUrl = (function() {
 			return `/${proxy}`;
 		case 'production':
 			// return `http://api.s.huaml.com`;
-			return `${window.location.protocol}//api.${window.location.host}`;
+			return `${window.location.protocol}//api.s.${getFirstHost()}.com`;
 		default:
 			return '';
 	}

+ 7 - 0
admin-update/src/cool/utils/index.js

@@ -1,5 +1,12 @@
 import { routerMode } from '@/config/env';
 
+export const getFirstHost = () => {
+	let host = window.location.host;
+	host = host.split('.');
+	host = host.length == 3 ? host[1] : host[0];
+	return process.env.NODE_ENV == 'development' ? 'huaml' : host;
+};
+
 export const revisePath = path => {
 	if (!path) {
 		return '';