|
@@ -94,12 +94,13 @@ var versionChangeLog = {
|
|
'0.0.1': ['init'],
|
|
'0.0.1': ['init'],
|
|
'0.0.2': ['utils.dateFromNow 函数逻辑修改,具体修改内容查看函数注释'],
|
|
'0.0.2': ['utils.dateFromNow 函数逻辑修改,具体修改内容查看函数注释'],
|
|
'0.0.3': ['utils.formatMoney 新增不使用,分割返回值的选项'],
|
|
'0.0.3': ['utils.formatMoney 新增不使用,分割返回值的选项'],
|
|
|
|
+ '0.0.4': ['utils.checkNowInAppTabbarPage 判断是否app tabbar 页面,返回对应的key'],
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
var utils = {
|
|
var utils = {
|
|
// utils版本号
|
|
// utils版本号
|
|
- version: '0.0.3',
|
|
|
|
|
|
+ version: '0.0.4',
|
|
isWeiXinBrowser: navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1,
|
|
isWeiXinBrowser: navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1,
|
|
isAndroid: navigator.userAgent.toLowerCase().indexOf('android') !== -1,
|
|
isAndroid: navigator.userAgent.toLowerCase().indexOf('android') !== -1,
|
|
isIos: /iphone|ipod|ipad|ios/.test(navigator.userAgent.toLowerCase()),
|
|
isIos: /iphone|ipod|ipad|ios/.test(navigator.userAgent.toLowerCase()),
|
|
@@ -768,5 +769,31 @@ var utils = {
|
|
},delay);
|
|
},delay);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 检查是否 app tabbar页面,并返回对应的key || ''
|
|
|
|
+ * @param link - 需要检查的地址 || location.href
|
|
|
|
+ * @returns {string} - 对应的key
|
|
|
|
+ */
|
|
|
|
+ checkNowInAppTabbarPage: function (link) {
|
|
|
|
+ const appTabbars = {
|
|
|
|
+ search: ['/jyapp/jylab/mainSearch', '/jy_mobile/tabbar/home'],
|
|
|
|
+ subscribe: ['/jyapp/swordfish/historypush', '/jy_mobile/tabbar/subscribe'],
|
|
|
|
+ message: ['/jyapp/frontPage/messageCenter/sess/index'],
|
|
|
|
+ box: ['/jyapp/jylab/index', '/jy_mobile/tabbar/box'],
|
|
|
|
+ me: ['/jyapp/free/me']
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let appTabbarName = ''
|
|
|
|
+ for (const appTabbarsKey in appTabbars) {
|
|
|
|
+ const hasTabbar = appTabbars[appTabbarsKey].some(function (v) {
|
|
|
|
+ return (link || location.href).indexOf(v) > -1
|
|
|
|
+ })
|
|
|
|
+ if (hasTabbar) {
|
|
|
|
+ appTabbarName = appTabbarsKey
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return appTabbarName
|
|
}
|
|
}
|
|
}
|
|
}
|