...
|
...
|
@@ -4721,7 +4721,7 @@ define("js/product/detail/detail", ["jquery","swiper","hammer","lazyload","index |
|
|
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
|
|
|
* @date: 2015/10/20
|
|
|
*/
|
|
|
var $ = require("jquery"),
|
|
|
var $ = require("jquery"),
|
|
|
Swiper = require("swiper"),
|
|
|
Hammer = require("hammer"),
|
|
|
lazyLoad = require("lazyload");
|
...
|
...
|
@@ -4733,6 +4733,8 @@ var goodsSwiper, |
|
|
var goodsDiscountEl = document.getElementById('goodsDiscount'),
|
|
|
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
|
|
|
|
|
|
var $cart = $('.cart-bar');
|
|
|
|
|
|
require("js/product/detail/desc");
|
|
|
require("js/product/detail/comments-consults");
|
|
|
require("js/product/recommend-for-you-product-desc");
|
...
|
...
|
@@ -4787,6 +4789,16 @@ if (goodsDiscountHammer) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//购物车商品数量
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/cart/index/count',
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
require("js/product/detail/like");
|
|
|
|
...
|
...
|
@@ -4887,19 +4899,24 @@ $(window).scroll(function() { |
|
|
|
|
|
|
|
|
});
|
|
|
define("js/product/detail/comments-consults", ["jquery"], function(require, exports, module){
|
|
|
define("js/product/detail/comments-consults", ["jquery","hammer"], function(require, exports, module){
|
|
|
/**
|
|
|
* 商品详情 --评论和咨询tab
|
|
|
* @author: Lynnic
|
|
|
* @date: 2015/11/18
|
|
|
*/
|
|
|
var $ = require("jquery"),
|
|
|
tip = require("js/plugin/tip");
|
|
|
var commentsNum;
|
|
|
tip = require("js/plugin/tip"),
|
|
|
Hammer = require("hammer");
|
|
|
|
|
|
var commentsNum,consultsNum;
|
|
|
|
|
|
var consultFooterEle = document.getElementById('consult-content-footer'),
|
|
|
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle);
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
var consultsNum = $('#nav-tab .consults-num').html() - 0;
|
|
|
consultsNum = $('#nav-tab .consults-num').html() - 0;
|
|
|
|
|
|
commentsNum = $('#nav-tab .comments-num').html() - 0;
|
|
|
|
...
|
...
|
@@ -4941,6 +4958,12 @@ $('#nav-tab li').on('touchend', function() { |
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (consultFooterHammer) {
|
|
|
consultFooterHammer.on('tap', function() {
|
|
|
location.href = $(consultFooterEle).find('a').attr('href');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
define("js/product/recommend-for-you-product-desc", ["swiper","jquery","index"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -4987,70 +5010,77 @@ var $ = require("jquery"), |
|
|
Hammer = require("hammer"),
|
|
|
tip = require("js/plugin/tip");
|
|
|
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn')),
|
|
|
addToCartHammer = new Hammer(document.getElementById('addtoCart')),
|
|
|
var likeEle = document.getElementById('likeBtn'),
|
|
|
likeHammer = likeEle && new Hammer(likeEle);
|
|
|
|
|
|
var addToCartEle = document.getElementById('addtoCart'),
|
|
|
addToCartHammer = addToCartEle && new Hammer(addToCartEle),
|
|
|
productId = $('#productId').val();
|
|
|
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var opt,
|
|
|
favorite;
|
|
|
if (likeHammer) {
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var opt,
|
|
|
favorite;
|
|
|
|
|
|
var $this = $(e.target);
|
|
|
var $this = $(e.target);
|
|
|
|
|
|
if ($this.hasClass('liked')) {
|
|
|
opt = 'cancel';
|
|
|
favorite = 0;
|
|
|
} else {
|
|
|
opt = 'ok';
|
|
|
favorite = 1;
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/product/opt/favoriteProduct',
|
|
|
data: {
|
|
|
id: productId,
|
|
|
opt: opt
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$this.toggleClass('liked');
|
|
|
if ($this.hasClass('liked')) {
|
|
|
opt = 'cancel';
|
|
|
favorite = 0;
|
|
|
} else {
|
|
|
opt = 'ok';
|
|
|
favorite = 1;
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/product/opt/favoriteProduct',
|
|
|
data: {
|
|
|
id: productId,
|
|
|
opt: opt
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$this.toggleClass('liked');
|
|
|
|
|
|
if ('cancel' === opt) {
|
|
|
tip.show('取消收藏成功');
|
|
|
} else if ('ok' === opt) {
|
|
|
tip.show('收藏成功');
|
|
|
if ('cancel' === opt) {
|
|
|
tip.show('取消收藏成功');
|
|
|
} else if ('ok' === opt) {
|
|
|
tip.show('收藏成功');
|
|
|
}
|
|
|
} else if (data.code === 400) {
|
|
|
location.href = data.data;//未登录跳转登录页
|
|
|
} else {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
} else if (data.code === 400) {
|
|
|
location.href = data.data;//未登录跳转登录页
|
|
|
} else {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
|
|
|
// 统计代码:用于统计用户加入或取消商品收藏的动作
|
|
|
if (window._yas) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
fa: favorite
|
|
|
});
|
|
|
// 统计代码:用于统计用户加入或取消商品收藏的动作
|
|
|
if (window._yas) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
fa: favorite
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
if (addToCartHammer) {
|
|
|
addToCartHammer.on('tap', function(e) {
|
|
|
|
|
|
addToCartHammer.on('tap', function(e) {
|
|
|
// 统计代码:用于统计用户加入购物车的动作
|
|
|
if (window._yas) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
by: 1
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 统计代码:用于统计用户加入购物车的动作
|
|
|
if (window._yas) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
by: 1
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -5134,16 +5164,14 @@ $consultForm.on('submit', function() { |
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/product/newsale/hot-rank", ["jquery","hammer","swiper","lazyload","index"], function(require, exports, module){
|
|
|
define("js/product/newsale/hot-rank", ["jquery","swiper","lazyload","index"], function(require, exports, module){
|
|
|
var $ = require("jquery"),
|
|
|
Hammer = require("hammer"),
|
|
|
Swiper = require("swiper"),
|
|
|
lazyLoad = require("lazyload"),
|
|
|
loading = require("js/plugin/loading");
|
|
|
|
|
|
var page = 1,
|
|
|
winH,
|
|
|
hotnav,
|
|
|
listTop,
|
|
|
navSwiper,
|
|
|
notab = 0,
|
...
|
...
|
@@ -5152,42 +5180,6 @@ var page = 1, |
|
|
hotrankNav,
|
|
|
noResult = '<p class="no-result">未找到相关搜索结果</p>';
|
|
|
|
|
|
// var renderRank = {
|
|
|
// errMsg: '<p class="no-result">未找到相关搜索结果</p>',
|
|
|
// navSelector: '.goods-nav',
|
|
|
// rankSelector: '#hotRank',
|
|
|
// navHTML: null,
|
|
|
// data: null,
|
|
|
// inited: 0,
|
|
|
// setData: function(data) {
|
|
|
// this.data = data;
|
|
|
// },
|
|
|
// showDataEmptyMsg: function() {
|
|
|
// $(this.rankSelector).append(this.errMsg);
|
|
|
// },
|
|
|
// isDataEmpty: function() {
|
|
|
// if (this.data.indexOf('>') === -1) {
|
|
|
// return true;
|
|
|
// } else {
|
|
|
// return false;
|
|
|
// }
|
|
|
// },
|
|
|
// appendData: function() {
|
|
|
// if (!this.inited) {
|
|
|
// this.inited = 1;
|
|
|
// }
|
|
|
// $(this.rankSelector).append(this.data);
|
|
|
// },
|
|
|
// render: function(data) {
|
|
|
// this.setData(data);
|
|
|
// if (!this.isDataEmpty()) {
|
|
|
// this.appendData();
|
|
|
// } else {
|
|
|
// this.showDataEmptyMsg();
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// };
|
|
|
|
|
|
function hotrank(page, sort, tabId, notab) {
|
|
|
loading.showLoadingMask();
|
...
|
...
|
@@ -5201,27 +5193,6 @@ function hotrank(page, sort, tabId, notab) { |
|
|
notab: notab
|
|
|
},
|
|
|
success: function(data) {
|
|
|
|
|
|
// if (page === 1) {
|
|
|
// $('.no-result').remove();
|
|
|
// $('.rank-main').remove();
|
|
|
// }
|
|
|
|
|
|
// if (notab === 1) {
|
|
|
// if (data === ' ' && $('.rank-main').length < 1) {
|
|
|
// var hotrankNav = $('.goods-nav').prop("outerHTML");
|
|
|
|
|
|
// $('#hotRank').html(hotrankNav + noResult);
|
|
|
// } else {
|
|
|
// $('#hotRank').append(data);
|
|
|
// }
|
|
|
// } else {
|
|
|
// if (data === ' ') {
|
|
|
// $('#hotRank').html(noResult);
|
|
|
// } else {
|
|
|
// $('#hotRank').append(data);
|
|
|
// }
|
|
|
// }
|
|
|
if (data === ' ') {
|
|
|
if ($('.rank-main').length < 1 && $('.goods-nav').length < 1) {
|
|
|
$('#hotRank').html(noResult);
|
...
|
...
|
@@ -5237,11 +5208,6 @@ function hotrank(page, sort, tabId, notab) { |
|
|
$('.rank-main').remove();
|
|
|
$('#hotRank').append(data);
|
|
|
}
|
|
|
|
|
|
// renderRank.render(data);
|
|
|
|
|
|
|
|
|
|
|
|
lazyLoad($('img.lazy'));
|
|
|
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
|
|
|
winH = $(window).height();
|
...
|
...
|
@@ -5273,14 +5239,12 @@ function scrollHandler() { |
|
|
hotrank(page, sort, id, notab);
|
|
|
}
|
|
|
|
|
|
//srcoll to load more
|
|
|
$(window).scroll(function() {
|
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
});
|
|
|
|
|
|
hotrank(page, sort, id, notab);
|
|
|
hotnav = new Hammer(document.getElementById('hotRank'));
|
|
|
hotnav.on('tap', function(e) {
|
|
|
$('#hotRank').on('touchend touchcancel', function(e) {
|
|
|
var ev = ev || window.event;
|
|
|
var target = ev.target || ev.srcElement;
|
|
|
|
...
|
...
|
@@ -5290,14 +5254,24 @@ hotnav.on('tap', function(e) { |
|
|
id = target.getAttribute('data-id') ? target.getAttribute('data-id') : '';
|
|
|
sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : '';
|
|
|
page = 1;
|
|
|
|
|
|
// notab = renderRank.inited;
|
|
|
notab = 1;
|
|
|
|
|
|
|
|
|
hotrank(page, sort, id, notab);
|
|
|
}
|
|
|
});
|
|
|
$('#hotRank').bind('contextmenu', function(e) {
|
|
|
return false;
|
|
|
});
|
|
|
$('#hotRank').on('touchstart', function(e) {
|
|
|
var ev = ev || window.event;
|
|
|
var target = ev.target || ev.srcElement;
|
|
|
|
|
|
if (target.nodeName.toLowerCase() === 'span') {
|
|
|
target.parentNode.className = 'bgActive ' + target.parentNode.className;
|
|
|
}
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
$('.s-goods-nav .nav-item').removeClass('bgActive');
|
|
|
});
|
|
|
|
|
|
|
|
|
});
|
|
|
define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
|
...
|
...
|
@@ -7310,7 +7284,7 @@ $page.on('touchstart', '.del-icon', function() { |
|
|
});
|
|
|
setTimeout(function() {
|
|
|
window.history.go(0);
|
|
|
}, 1000);
|
|
|
}, 2500);
|
|
|
}
|
|
|
},
|
|
|
complete: function() {
|
...
|
...
|
|