Authored by baoss

Merge branch 'userAgentTest' into develop

... ... @@ -134,7 +134,7 @@
<div id="productDesc" {{#if limit}}class="limit"{{/if}}> </div>
<div class="bottom">
<div class="bottom iphonex-bottom-tab">
{{#ifcond storage_sum '&&' activityIdDetail.currentTime}}
<div class="count-down">
<div data-current="{{activityIdDetail.currentTime}}"
... ...
... ... @@ -25,7 +25,7 @@
</div>
</div>
<a class="my-group my-group-handler" href="/activity/group/order">我的拼团</a>
<a class="my-group my-group-handler iphonex-bottom-tab" href="/activity/group/order">我的拼团</a>
{{#if shareInfo}}
<div class='my-share'></div>
{{/if}}
... ...
... ... @@ -52,7 +52,7 @@
</div>
<!-- 我的抽奖码 -->
<div class="js-my-draw-code" data-type=3>我的抽奖码</div>
<div class="js-my-draw-code iphonex-bottom-tab" data-type=3>我的抽奖码</div>
{{/ifcond}}
</div>
{{/each}}
... ...
<div class="group-tabbar">
<div class="group-tabbar iphonex-bottom-tab">
{{#each items}}
<div class="group-tabbar-item">
{{#ifcond @index '==' ../active}}
... ...
<div class="action-bar-comp">
<div class="action-bar">
<div class="action-bar iphonex-bottom-tab">
<a class="action-item action-list" href="/activity/yoluck/index.html">
<div class="action-image action-icon"></div>
</a>
... ...
<div class="action-bar-comp">
<div class="action-bar">
<div class="action-bar iphonex-bottom-tab">
<a class="action-item action-list" href="/activity/yoluck/index.html">
<div class="action-image action-icon"></div>
</a>
... ...
... ... @@ -97,7 +97,7 @@
</div>
<div id="shop-goods-container" class="goods-container">{{{preference}}}</div>
<div class="cart-bar-fixed">
<div class="cart-bar">
<div class="cart-bar iphonex-bottom-tab">
<a href="//m.yohobuy.com/cart/index/index?union_type=100000000013130" class="new-foot-ico" rel="nofollow">
<div class="cart-icon"></div>
<div class="tip">购物车</div>
... ...
<div class="shop-foot-wrapper">
<div class="shop-foot-wrapper iphonex-bottom-tab">
<ul>
<li data-bp-id="shop_footnav_one_1">
{{#if category.url}}
... ...
... ... @@ -88,7 +88,7 @@
{{!--占位: 购物车部分--}}
<div id="placeholder-infodata">
<div class="cart-bar">
<div class="cart-bar iphonex-bottom-tab">
<a href="javascript:;" class="new-foot-ico" rel="nofollow">
<div class="num-incart iconfont">
<span class="num-tag {{#unless @root.cartCount}}hide{{/unless}}">{{@root.cartCount}}</span>
... ...
... ... @@ -84,7 +84,7 @@
<div id="productDesc" class="product-desc"></div>
<div class="cart-bar">
<div class="cart-bar iphonex-bottom-tab">
{{#unless @root.wap.common.removeCartCount}}
<input type="hidden" id="remove-cart-count" value="1">
{{/unless}}
... ...
<div class="shop-foot-wrapper">
<div class="shop-foot-wrapper iphonex-bottom-tab">
<ul>
<li data-bp-id="shop_footnav_one_1">
{{#if category.url}}
... ...
<div class="shop-foot-wrapper">
<div class="shop-foot-wrapper iphonex-bottom-tab">
<ul{{#if brandList}} class="foot-list-3"{{/if}}>
<li data-bp-id="shop_footnav_one_1" class="buriedpoint">
{{#if shopCategory.url}}
... ...
{{#showFooterTab}}
<div class="footer-tab">
<div class="footer-tab iphonex-bottom-tab">
<a class="tab-item {{#if grilsHomePage}}current{{/if}}{{#if boysHomePage}}current{{/if}}{{#if kidsHomePage}}current{{/if}}{{#if lifestyleHomePage}}current{{/if}}" href="{{indexUrl}}">
<p class="iconfont tab-icon">&#xe62a;</p>
<p class="tab-name">首页</p>
... ...
<div class="chose-panel" data-skn="{{productSkn}}">
<div class="main">
<div class="main iphonex-bottom-tab">
<div class="close iconfont">&#xe626;</div>
<div class="infos">
<div class="basic-info">
... ...
{{# cartInfo}}
<div class="chose-panel" data-skn="{{productSkn}}">
<div class="main">
<div class="main iphonex-bottom-tab">
<div class="close iconfont">&#xe626;</div>
<div class="infos {{#if @root.tickets}} tickets-info {{/if}}">
<div class="basic-info">
... ...
{{# cartInfo}}
<div class="chose-panel" data-skn="{{productSkn}}">
<div class="main">
<div class="main iphonex-bottom-tab">
<div class="close iconfont">&#xe626;</div>
<div class="infos {{#if @root.tickets}} tickets-info {{/if}}">
<div class="basic-info">
... ...
{{# cartInfo}}
<div class="cart-bar{{#if storeGood}} store-good{{/if}}">
<div class="cart-bar{{#if storeGood}} store-good{{/if}} iphonex-bottom-tab">
{{#unless @root.wap.common.removeCartCount}}
<input type="hidden" id="remove-cart-count" value="1">
{{/unless}}
... ...
... ... @@ -11,6 +11,8 @@ let $footer = $('#yoho-footer'),
$header = $('.yoho-header');
let cleanHtml = require('../../utils/cleanHtml');
const yoho = require('./yoho-app');
const _ = require('lodash');
// 为您优选-40位随机数指纹请求id
let RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
... ... @@ -25,6 +27,44 @@ let _ChannelVary = {
require('./common/share');
function iPhoneXHandler(innerHeight) {
if (!yoho.isiPhoneXSeries) {
return false;
}
let currentInnerHeight = window.innerHeight;
let $yohoBody = $('body');
if (yoho.isWechat && window.history.length === 1) {
$yohoBody.addClass('iphonex-series');
} else {
if (innerHeight < currentInnerHeight) {
$yohoBody.addClass('iphonex-series');
} else {
$yohoBody.removeClass('iphonex-series');
}
}
}
// 根据机型的全局操作
(function() {
let innerHeight = window.innerHeight;
if (yoho.isWechat) { // 底部tab显示后获取高度
setTimeout(function() {
innerHeight = window.innerHeight;
iPhoneXHandler(innerHeight);
});
} else {
iPhoneXHandler(innerHeight);
}
$(window).scroll(_.throttle(() => {
iPhoneXHandler(innerHeight);
}, 100));
window.onresize = () => {
iPhoneXHandler(innerHeight);
};
}());
function cookie(name) {
// var re = new RegExp(name + '=([^;$]*)', 'i'),
... ... @@ -570,4 +610,5 @@ window.downLoadApp = downLoadApp;
window.mapSort = mapSort;
require('js/common/weixin-report');
... ...
... ... @@ -33,6 +33,40 @@ if (!$appLink.length) {
$('body').append('<a id="yoho-app-link" href="javascript:;" style="display:none !important;"></a>');
$appLink = $('#yoho-app-link');
}
const isiPhoneXSeries = () => {
console.log(navigator.userAgent);
let isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || '');
if (!window || !isiOS) {
return false;
}
const xSeriesConfig = [{ // iPhone Xs(Max,Pro Max)
devicePixelRatio: 3,
width: 414,
height: 896,
},
{ // iPhone XR(11)
devicePixelRatio: 2,
width: 414,
height: 896,
},
{ // iPhone X(Xs,Pro)
devicePixelRatio: 3,
width: 375,
height: 812,
},
];
const {
devicePixelRatio,
screen: {
width,
height
}
} = window;
// eslint-disable-next-line max-len
return xSeriesConfig.some(item => item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height);
};
yoho = {
/**
... ... @@ -49,6 +83,7 @@ yoho = {
isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
isAndroid: /Android/i.test(navigator.userAgent || ''),
isWechat: /micromessenger/i.test(navigator.userAgent || ''),
isiPhoneXSeries: isiPhoneXSeries() || false,
/**
* JS 与 APP 共享的对象
... ...
... ... @@ -631,7 +631,7 @@
}
.btn-wrap {
position: fixed;
position: absolute;
bottom: 0;
width: 100%;
... ...
... ... @@ -718,7 +718,7 @@
}
.btn-wrap {
position: fixed;
position: absolute;
bottom: 0;
width: 100%;
... ...
.action-bar-comp {
.action-bar {
display: flex;
... ...
... ... @@ -369,7 +369,7 @@
}
.btn-wrap {
position: fixed;
position: absolute;
bottom: 0;
width: 100%;
... ...
... ... @@ -31,6 +31,30 @@ body {
}
}
.iphonex-bottom-tab {
&:after {
content: "";
display: block;
height: 35PX;
position: absolute;
right: 0;
left: 0;
bottom: -35PX;
background-color: #fff;
z-index: 999;
}
}
.iphonex-series {
.yoho-footer {
margin-bottom: 93PX;
}
.iphonex-bottom-tab {
bottom: 34PX !important;
}
}
button,
input,
select,
... ...