Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -22,14 +22,21 @@ var navHammer,
freebieHammer,
switchChose = false;
require('./good');
if ($('.cart-zero').length > 0) {
function needLoadRecommandForYou() {
return window.isCookiesEnabled() ?
$('.cart-goods').length <= 0 && window.cookie('_yoho-cart-refreshByDelete') !== 'true' :
$('.cart-goods').length <= 0;
}
if (needLoadRecommandForYou()) {
require('../product/recommend-for-you');
} else {
require('./good');
}
window.setCookie('_yoho-cart-refreshByDelete', false);
ellipsis.init();
function cartContentShow() {
... ...
... ... @@ -108,6 +108,7 @@ $('.icon-del').on('touchstart', function(e) {
});
orderInfo('couponCode', null);
orderInfo('couponName', null);
window.setCookie('_yoho-cart-refreshByDelete', true);
window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
} else {
tip.show(data.message);
... ...
... ... @@ -58,6 +58,17 @@ function setCookie(name, value, options) {
}
}
function isCookiesEnabled() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled === 'undefined' && !cookieEnabled) {
document.cookie = 'testcookie';
cookieEnabled = (document.cookie.indexOf('testcookie') !== -1) ? true : false;
}
return (cookieEnabled);
}
function getUser() {
var c = cookie('_UID'),
user;
... ... @@ -276,6 +287,8 @@ window.cookie = cookie;
window.setCookie = setCookie;
window.isCookiesEnabled = isCookiesEnabled;
window.getUser = getUser;
window.getUid = getUid;
... ...
... ... @@ -119,7 +119,11 @@ $submit.on('touchend', function() {
});
// 省市区列表异步加载
$.get('/home/locationList').then(function(html) {
$.ajax({
method: 'GET',
url: '/home/locationList',
timeout: 60000
}).then(function(html) {
$addressListPage.html(html);
// 省市区
... ... @@ -141,7 +145,7 @@ $.get('/home/locationList').then(function(html) {
if (e.target.tagName.toLowerCase() !== 'li') {
$this = $this.parent('li');
}
newArea.push($this.children('.caption').text());
newArea.push($this.children('.caption').text().trim());
$this.siblings().hide();
$this.children('ul').show().children('li').show();
... ... @@ -157,7 +161,7 @@ $.get('/home/locationList').then(function(html) {
var $this = $(e.target);
// 填结果到 html
newArea.push($this.children('.caption').text());
newArea.push($this.text().trim());
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($this.data('id'));
... ...
... ... @@ -12,30 +12,35 @@ var $dialogWrapper,
dialogTpl,
dialogTemplate;
dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
'<div class="dialog-box">' +
'{{# hasHeader}}' +
'{{/ hasHeader}}' +
'<div class="dialog-content">{{dialogText}}</div>' +
'{{# hasFooter}}' +
'<div class="dialog-footer">' +
'{{# leftBtnText}}' +
'<span class="dialog-left-btn">{{.}}</span>' +
'{{/ leftBtnText}}' +
'{{# rightBtnText}}' +
'<span class="dialog-right-btn">{{.}}</span>' +
'{{/ rightBtnText}}' +
'</div>' +
'{{/ hasFooter}}' +
'</div>' +
function getInstance() {
if (dialogTpl === undefined) {
dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
'<div class="dialog-box">' +
'{{# hasHeader}}' +
'{{/ hasHeader}}' +
'<div class="dialog-content">{{dialogText}}</div>' +
'{{# hasFooter}}' +
'<div class="dialog-footer">' +
'{{# leftBtnText}}' +
'<span class="dialog-left-btn">{{.}}</span>' +
'{{/ leftBtnText}}' +
'{{# rightBtnText}}' +
'<span class="dialog-right-btn">{{.}}</span>' +
'{{/ rightBtnText}}' +
'</div>' +
'{{/ hasFooter}}' +
'</div>' +
'</div>';
dialogTemplate = Handlebars.compile(dialogTpl);
dialogTemplate = Handlebars.compile(dialogTpl);
}
return dialogTemplate;
}
exports.showDialog = function(data, callback, callbackForLeft) {
var dialogStr = dialogTemplate(data),
var dialogTemplate = getInstance(),
dialogStr = dialogTemplate(data),
$dialogBox,
defaultHideDuraton,
dialogWrapperHammer;
... ... @@ -73,6 +78,11 @@ exports.showDialog = function(data, callback, callbackForLeft) {
}, defaultHideDuraton);
}
//禁止在dialog上可以上下滚动
$dialogWrapper.on('touchmove', function() {
return false;
});
dialogWrapperHammer.on('tap', function(event) {
if ($(event.target).hasClass('dialog-left-btn')) {
... ... @@ -83,5 +93,9 @@ exports.showDialog = function(data, callback, callbackForLeft) {
} else if ($(event.target).hasClass('dialog-right-btn')) {
callback();
}
// 防止出现点透问题
event.preventDefault();
event.srcEvent.stopPropagation();
});
};
... ...
... ... @@ -123,10 +123,10 @@
}
.count {
font-size: 28rem / $pxConvertRem;
font-size: 20rem / $pxConvertRem;
color: #999;
display: inline-block;
width: 19%;
width: 22%;
position: absolute;
text-align: center;
}
... ...
... ... @@ -77,7 +77,7 @@
padding: 10px;
background: #000;
color: #fff;
font-size: 20px;
font-size: 12px;
@include border-radius(5px);
text-align: center;
width: 7rem;
... ...