Authored by htoooth

add focus

... ... @@ -334,7 +334,7 @@ const _getSkuDataByProductBaseInfo = (data) => {
}
// 商品的尺码列表
_.get(cur, 'size_list', []).forEach((size) => {
_.get(cur, 'size_list', []).forEach((size, index) => {
if (data.attribute === 3) {
// 虚拟商品,门票默认最大为4,
size.storage_number = size.storage_number > 4 ? 4 : size.storage_number;
... ... @@ -368,6 +368,16 @@ const _getSkuDataByProductBaseInfo = (data) => {
});
if (goodsGroup.focus) {
_.some(goodsGroup.size, function(value) {
if (value.num !== 0) {
value.focus = true;
return true;
}
return false;
});
}
acc.push(goodsGroup);
return acc;
}, []);
... ... @@ -575,7 +585,7 @@ const _getBasicDescription = (productDescBo) => {
},
{
key: '颜色',
value: productDescBo.colorName,
value: productDescBo.factoryGoodsName,
dColor: true
},
{
... ...
... ... @@ -306,9 +306,12 @@
<div class="comments cc-content">
<div class="comment-tabs clearfix">
<h2 class="active" data-comment-type="7"> 全部(<em
class="comment-num all-comment-num">0</em></h2>
<h2 data-comment-type="6"> 有图(<em class="comment-num img-comment-num">0</em></h2>
<h2 class="active" data-comment-type="7">
全部( <em class="comment-num all-comment-num">0</em>
</h2>
<h2 data-comment-type="6">
有图(<em class="comment-num img-comment-num">0</em>
</h2>
</div>
<div class="judge-content">
<div data-comment-list="7">
... ... @@ -331,6 +334,14 @@
</div>
</div>
</div>
<div class="lazy-load-object">
<textarea class="datalazyload" style="visibility: hidden;">
<script>
fetchComment();
</script>
</textarea>
</div>
{{/if}}
{{#if consult}}
... ... @@ -432,8 +443,8 @@
<li><a href="#goodsMessage" class="fixed option">&nbsp;&nbsp;商品信息</a></li>
<li><a href="#sizeMessage" class="option">&nbsp;&nbsp;尺码信息</a></li>
<li><a href="#goodsInside" class="option">&nbsp;&nbsp;商品详情</a></li>
<li><a href="#judge" class="option">&nbsp;&nbsp;商品评价</a></li>
<li><a href="#goodsAsk" class="option">&nbsp;&nbsp;常见咨询</a></li>
<li><a href="#judge" class="option comment">&nbsp;&nbsp;商品评价</a></li>
<li><a href="#goodsAsk" class="option consult">&nbsp;&nbsp;常见咨询</a></li>
</ul>
</div>
</div>
... ...
... ... @@ -916,7 +916,7 @@ $('.after-service-switch').click(function() {
});
// 商品详情区的热点
function fetchHotArea() {
function loadHotArea() {
$.ajax({
type: 'GET',
url: '/product/detail/hotarea',
... ... @@ -940,13 +940,13 @@ function fetchHotArea() {
});
}
window.fetchHotArea = fetchHotArea;
window.fetchHotArea = window.once(loadHotArea);
// 商品详情图片懒加载
lazyLoad($('#details-html img'));
// 咨询和评价
function fetchComment() {
function loadComment() {
var commentPage = {}, // 每个类型的分页页码
currentType = '7', // 当前评论展示的类型
cNumReady = false; // 只第一次请求后更新数量
... ... @@ -954,8 +954,6 @@ function fetchComment() {
var commentsTpl = require('hbs/product/comment-item.hbs'),
loadingComments;
function loadComments(type, nowPage) {
if (loadingComments) {
return;
... ... @@ -1111,9 +1109,9 @@ $('.comments').on('click', '.img-preview [data-role="preview-right"]', function(
$img.css('transform', 'rotate(' + rotate + 'deg)');
});
window.fetchComment = fetchComment;
window.fetchComment = window.once(loadComment);
function fetchConsult() {
function loadConsult() {
var consultsTpl = require('hbs/product/consult-item.hbs'),
$consultsUl = $('#consults-ul'),
$consultNum = $('.consult-num'),
... ... @@ -1292,7 +1290,7 @@ function fetchConsult() {
loadConsults(1);
}
window.fetchConsult = fetchConsult;
window.fetchConsult = window.once(loadConsult);
function randomString(len) {
var $chars = 'ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-';
... ... @@ -1327,7 +1325,7 @@ function initPageYas() {
}
// 店铺推荐
function fetchRecommend() {
function loadRecommend() {
$.ajax({
type: 'GET',
url: '/product/detail/recommend',
... ... @@ -1387,7 +1385,7 @@ $('.recommend-slider').on('click', '.img-item', function() {
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
window.fetchRecommend = fetchRecommend;
window.fetchRecommend = window.once(loadRecommend);
// 加载套餐默认信息
$(function() {
... ... @@ -1545,7 +1543,7 @@ $('.recommend-content').find('.iconfont').mouseenter(function() {
});
// 特殊商品退换货
function fetchReturn() {
function loadReturn() {
return $.ajax({
type: 'GET',
url: '/product/detail/return',
... ... @@ -1561,7 +1559,7 @@ function fetchReturn() {
});
}
window.fetchReturn = fetchReturn;
window.fetchReturn = window.once(loadReturn);
// 首屏加载后,对比数据是否变化,如果变化,重新渲染,重新绑定事件
bindEvent.fire();
... ... @@ -1627,7 +1625,6 @@ $(window).scroll(function() {
});
$('.shoppingCar').on('click', '.option', function(e) {
e.stopPropagation();
var $this = $(this);
if ($this.hasClass('fixed')) {
... ... @@ -1636,6 +1633,14 @@ $('.shoppingCar').on('click', '.option', function(e) {
$this.closest('li').siblings().find('.option').removeClass('fixed');
$this.addClass('fixed');
if ($this.hasClass('comment')) {
window.fetchComment();
} else if ($this.hasClass('consult')) {
window.fetchConsult();
}
e.stopPropagation();
});
$('.shoppingCar-btn').on('click', function() {
... ... @@ -1666,7 +1671,6 @@ $(function() {
});
font.each(function(i, ele) {
if ((i + 1) % 4 === 0) {
$(this).find('.justpostion').css({display: 'inline-block', float: 'right'});
} else if ((i + 1) % 4 === 1) {
... ... @@ -1674,8 +1678,6 @@ $(function() {
} else {
$(this).css('text-align', 'center');
}
});
});
... ...