util.js
602 Bytes
const yoho = require('yoho');
const getImgHost = function(url) {
let urlArr = url.split('/'),
num = urlArr[urlArr.length - 1].substr(1, 1),
domain = 'static.yhbimg.com/goodsimg';
url = domain + url;
if (num === '1') {
return '//img11.' + url;
} else {
return '//img12.' + url;
}
};
const visibilitychange = function() {
document.addEventListener('visibilitychange', function() {
if (yoho.isApp && !document.hidden) {
yoho.showLoading(false);
}
});
}
module.exports = {
getImgHost,
visibilitychange
};