|
@@ -326,10 +326,11 @@ window.utilsEnv = {
|
|
|
}
|
|
|
return agent
|
|
|
},
|
|
|
- /**
|
|
|
- * 用于判断是否在APP容器内
|
|
|
- * @returns {boolean}
|
|
|
- */
|
|
|
+ getIsH5HostName: function () {
|
|
|
+ var hostname = location.hostname.toLowerCase()
|
|
|
+ return hostname.indexOf('h5') !== -1
|
|
|
+ },
|
|
|
+ // 是否是在app里面运行
|
|
|
getIsInTheAppContainer: function () {
|
|
|
// 判断是否在app环境下
|
|
|
var inApp = false
|
|
@@ -356,7 +357,19 @@ window.utilsEnv = {
|
|
|
var inWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
|
|
|
var inApp = this.getIsInTheAppContainer()
|
|
|
var platformOS = this.androidOrIOS()
|
|
|
- var platform = inApp ? 'app' : (inWX ? 'wx' : 'h5')
|
|
|
+ var getPlatform = function () {
|
|
|
+ var h5host = this.getIsH5HostName()
|
|
|
+ if (inApp) {
|
|
|
+ return 'app'
|
|
|
+ } else if (h5host) {
|
|
|
+ return 'h5'
|
|
|
+ } else if (inWX) {
|
|
|
+ return 'wx'
|
|
|
+ } else {
|
|
|
+ return 'h5'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var platform = getPlatform()
|
|
|
return {
|
|
|
platformOS: platformOS,
|
|
|
platform: platform,
|
|
@@ -365,7 +378,7 @@ window.utilsEnv = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-window.utilsEnv.platformEnvs = utilsEnv.getPlatformEnvs()
|
|
|
+utilsEnv.platformEnvs = utilsEnv.getPlatformEnvs()
|
|
|
|
|
|
/**
|
|
|
* 提供模拟默认客户端函数,避免报错
|