Authored by ccbikai

Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuywap-node into release/4.6

... ... @@ -21,7 +21,7 @@ exports.index = (req, res) => {
});
let categoryId = req.query.category_id;
let yhChannel = req.query.yh_channel || 1;
let yhChannel = req.query.yh_channel || 0;
let contentcode = req.query.content_code;
outletModel.getContent(categoryId, yhChannel, contentcode).then(result => {
... ...
... ... @@ -70,7 +70,7 @@ const contentCode = {
};
/**
* 折扣专场列表数据处理
* 折扣专场列表页及详情页公共方法
* @param {[array]} list
* @return {[array]}
*/
... ... @@ -81,6 +81,7 @@ const _processDiscount = (list, channel) => {
list = list || [];
list = camelCase(list);
// list为1条数据是表示详情页,flag 设为false,不需要拼接跳转链接
if (list.length === 1) {
flag = false;
}
... ... @@ -88,7 +89,7 @@ const _processDiscount = (list, channel) => {
_.forEach(list, (data) => {
if (flag === true) {
data.specialUrl = `/product/sale/discount/detail?id=${data.id}&channel=${channel}`;
_.merge(data, processTime(data.leftTime));
Object.assign(data, processTime(data.leftTime));
}
formatData.push(data);
... ... @@ -356,11 +357,11 @@ const getDiscountDetailData = (id, yhChannel) => {
res = _processDiscount(result.data);
return {
title: res[0].title,
productPool: res[0].productPool,
title: res[0] && res[0].title,
productPool: res[0] && res[0].productPool,
activity: {
coverUrl: res[0].coverUrl,
leftTime: res[0].leftTime
coverUrl: res[0] && res[0].coverUrl,
leftTime: res[0] && res[0].leftTime
}
};
} else {
... ...
... ... @@ -26,6 +26,12 @@
{{# isSoonSoldOut}}
<p class="few-tag">即将售罄</p>
{{/ isSoonSoldOut}}
{{#if noStorage}}
<div class="no-storage">
<div class="no-storage-img"></div>
</div>
{{/if}}
</div>
<div class="good-detail-text">
<div class="name">
... ...
... ... @@ -14,14 +14,10 @@ var $ = require('yoho-jquery'),
var $window = $(window),
$starArticle = $('.star-article'),
// $headTab = $('.head-tab'),
stopLoading = false,
avatarSwiper,
avatarSwiperClone,
getIndexHtml;
stopLoading = false;
/*
$headTab = $('.head-tab'),
$swiperView = $('.swiper-view'),
$viewImg = $('.view-img'),
$body = $('body'),
... ... @@ -31,7 +27,7 @@ var $window = $(window),
var mySwiper;
*/
var avatarKey, bannerLen, res;
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $avatar;
require('../common');
... ... @@ -124,7 +120,7 @@ function setIndexAction() {
starIScroll.iScroll.on('scroll', function() {
if ($avatarWrap.offset().top <= 0) {
$('.avatar-clone').show();
$avatarClone.show();
if (!avatarSwiperClone) {
avatarSwiperClone = new Swiper('.avatar-0', {
... ... @@ -151,7 +147,7 @@ function setIndexAction() {
}
if ($avatarWrap.offset().top > $('.avatar-1')[0].scrollHeight) {
$('.avatar-clone').hide();
$avatarClone.hide();
}
});
... ... @@ -164,63 +160,6 @@ function setIndexAction() {
$loadingTip.slideUp();
});
// 明星动态文章图片相关操作
/*
function articleImgAction(dom, key) {
var $articeImgs = dom.find('.artice-imgs'),
$li = $articeImgs.find('li'),
imgLen = $articeImgs.find('img').length,
addFlagDom = $li.eq(2);
var i;
imgs = [];
$li.each(function() {
imgs.push($(this).find('img').attr('src'));
});
allImgs[key] = imgs;
$li.on('click', function() {
for (i = 0; i < imgLen; i++) {
$swiperView.find('ul').append('<li class="swiper-slide">' +
'<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
'<div class="swiper-lazy-preloader"></div></li>');
}
setTimeout(function() {
mySwiper = new Swiper('.swiper-view', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
slideElement: 'li'
});
$('.swiper-view li').on('click', function(e) {
if (e.target.nodeName === 'IMG') {
return;
}
$viewImg.hide();
$body.css({
overflow: 'auto'
});
$viewImg.find('li').remove();
mySwiper.destroy(false);
});
}, 100);
$viewImg.show();
$body.css({
overflow: 'hidden'
});
});
if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
}
}
*/
$('.avatar').each(function(key, item) {
$(item).addClass('avatar-' + key);
});
... ... @@ -307,10 +246,11 @@ getIndexHtml = function() {
}
$starMain.html(data);
bannerLen = $('.avatar .swiper-slide').length;
$avatar = $('.avatar');
bannerLen = $avatar.find('.swiper-slide').length;
if ($('.avatar-clone').length) {
$('.avatar-clone').remove();
if ($avatarClone) {
$avatarClone.remove();
}
$('.avatar li').each(function() {
... ... @@ -319,6 +259,8 @@ getIndexHtml = function() {
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
$avatarClone = $('.avatar-clone');
// 限制标题字数
$('.cont-area').each(function() {
txtLimit($(this), '.title', '.cont-txt');
... ... @@ -339,3 +281,60 @@ getIndexHtml = function() {
};
getIndexHtml();
// 明星动态文章图片相关操作
/*
function articleImgAction(dom, key) {
var $articeImgs = dom.find('.artice-imgs'),
$li = $articeImgs.find('li'),
imgLen = $articeImgs.find('img').length,
addFlagDom = $li.eq(2);
var i;
imgs = [];
$li.each(function() {
imgs.push($(this).find('img').attr('src'));
});
allImgs[key] = imgs;
$li.on('click', function() {
for (i = 0; i < imgLen; i++) {
$swiperView.find('ul').append('<li class="swiper-slide">' +
'<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
'<div class="swiper-lazy-preloader"></div></li>');
}
setTimeout(function() {
mySwiper = new Swiper('.swiper-view', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
slideElement: 'li'
});
$('.swiper-view li').on('click', function(e) {
if (e.target.nodeName === 'IMG') {
return;
}
$viewImg.hide();
$body.css({
overflow: 'auto'
});
$viewImg.find('li').remove();
mySwiper.destroy(false);
});
}, 100);
$viewImg.show();
$body.css({
overflow: 'hidden'
});
});
if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
}
}
*/
... ...
... ... @@ -77,6 +77,7 @@ if ($('.outlet-category-nav').length > 0) {
}).goto(0);
}
//更多活动按钮
if ($('.back-ground-white').length > 10) {
$('.more-activity').show();
$('.back-ground-white').each(function(index, e) {
... ...
... ... @@ -94,6 +94,28 @@
font-size: 18px;
line-height: 28px;
}
.no-storage {
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
opacity: 0.4;
z-index: 10;
position: absolute;
top: 0;
.no-storage-img {
display: block;
width: 90px;
height: 90px;
margin-left: 93px;
margin-top: 139px;
background-image: resolve("product/bag_moren.png");
background-repeat: no-repeat;
background-size: contain;
}
}
}
.good-detail-text {
... ...
... ... @@ -43,6 +43,11 @@ exports.processProductList = (list, options) => {
return;
}
//如果库存为0,显示已抢完
if (product.storageNum === 0){
product.noStorage = true;
}
// 市场价和售价一样,则不显示市场价
if (product.marketPrice === product.salesPrice) {
product.marketPrice = false;
... ... @@ -103,7 +108,7 @@ exports.processProductList = (list, options) => {
pruductList.push(product);
});
console.log(pruductList);
return pruductList;
};
... ...