|
@@ -1,4 +1,6 @@
|
|
import store from 'store'
|
|
import store from 'store'
|
|
|
|
+import { getQuery } from "./queryString";
|
|
|
|
+
|
|
/** 获取浏览器信息 */
|
|
/** 获取浏览器信息 */
|
|
export const browser = () => {
|
|
export const browser = () => {
|
|
const u = navigator.userAgent;
|
|
const u = navigator.userAgent;
|
|
@@ -97,3 +99,42 @@ export const getStorageSpeed = (id: any) => {
|
|
const speeds = store.get(SPEEDKEY) || {}
|
|
const speeds = store.get(SPEEDKEY) || {}
|
|
return speeds[id] || 0
|
|
return speeds[id] || 0
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/** 返回各产品应用对应的服务接口地址 */
|
|
|
|
+export const matchProductApiUrl = () => {
|
|
|
|
+ const query: any = getQuery();
|
|
|
|
+ const apiUrls = {
|
|
|
|
+ 'cbs': {
|
|
|
|
+ 'dev': 'http://dev.resource.colexiu.com',
|
|
|
|
+ 'test': 'https://test.resource.colexiu.com',
|
|
|
|
+ 'online': 'https://online.resource.colexiu.com'
|
|
|
|
+ },
|
|
|
|
+ 'gym': {
|
|
|
|
+ 'dev': 'https://dev.dayaedu.com',
|
|
|
|
+ 'test': 'https://test.dayaedu.com',
|
|
|
|
+ 'online': 'https://online.dayaedu.com'
|
|
|
|
+ },
|
|
|
|
+ 'colexiu': {
|
|
|
|
+ 'dev': 'https://dev.colexiu.com/',
|
|
|
|
+ 'test': 'https://test.colexiu.com',
|
|
|
|
+ 'online': 'https://online.colexiu.com'
|
|
|
|
+ },
|
|
|
|
+ 'orchestra': {
|
|
|
|
+ 'dev': 'https://dev.lexiaoya.cn',
|
|
|
|
+ 'test': 'https://test.lexiaoya.cn',
|
|
|
|
+ 'online': 'https://online.lexiaoya.cn'
|
|
|
|
+ },
|
|
|
|
+ 'instrument': {
|
|
|
|
+ 'dev': 'https://dev.kt.colexiu.com',
|
|
|
|
+ 'test': 'https://test.lexiaoya.cn',
|
|
|
|
+ 'online': 'https://kt.colexiu.com'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const environment = location.origin.includes('//dev') ? 'dev' : location.origin.includes('//test') ? 'test' : location.origin.includes('//online') ? 'online' : 'dev'
|
|
|
|
+ if (query.isCbs) {
|
|
|
|
+ return apiUrls.cbs[environment]
|
|
|
|
+ } else {
|
|
|
|
+ const pathName = location.pathname.includes('index') ? 'gym' : location.pathname.includes('colexiu') ? 'colexiu' : location.pathname.includes('orchestra') ? 'orchestra' : 'instrument'
|
|
|
|
+ return apiUrls[pathName][environment]
|
|
|
|
+ }
|
|
|
|
+}
|