Authored by 徐炜

Merge remote-tracking branch 'origin/release/wap-optim' into release/wap-optim

... ... @@ -300,7 +300,8 @@ exports.indexSkn = (req, res, next) => {
result: result,
page: 'detail',
title: result.goodsName,
pageFooter: true
pageFooter: true,
localCss: true
});
}).catch(next);
};
... ...
'use strict';
const mRoot = '../models';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const mayLikeModel = require('../models/recom');
/**
... ... @@ -41,7 +39,7 @@ const mayLike = (req, res, next) => {
* 你可能喜欢的潮童的商品列表
*/
const mayLikeKids = (req, res, next) => {
let page = req.body.page || 1;
let page = req.query.page || 1;
let limit = 50;
let channel = req.query.channel || 3;
... ...
... ... @@ -247,7 +247,7 @@ exports.consultsubmit = (req, res, next) => {
data: ''
};
// 判断参数是否存在
// 判断参数是否存在
if (!req.body.product_id || !req.body.content) {
return res.json(data);
}
... ... @@ -294,7 +294,8 @@ exports.indexSkn = (req, res, next) => {
result: result,
page: 'seckill-detail',
title: result.goodsName,
pageFooter: true
pageFooter: true,
localCss: true
});
}).catch(next);
};
... ... @@ -333,7 +334,8 @@ exports.index = (req, res, next) => {
result: result,
page: 'seckill-detail',
title: result.goodsName,
pageFooter: true
pageFooter: true,
localCss: true
});
}).catch(next);
};
... ... @@ -344,7 +346,7 @@ exports.index = (req, res, next) => {
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.indexData = (req, res, next)=> {
exports.indexData = (req, res, next) => {
if (!req.xhr) {
return next();
}
... ... @@ -361,7 +363,10 @@ exports.indexData = (req, res, next)=> {
ua: req.get('user-agent') || ''
}, req.__User__)).then((result) => {
if (_.isEmpty(result)) {
return res.json({code: 400, message: '数据错误'});
return res.json({
code: 400,
message: '数据错误'
});
}
result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
return res.json(result);
... ...
... ... @@ -14,7 +14,7 @@ exports.queryProdPageCoupons = (uid, skn, brandId) => {
brandId
};
return api.get('', param, {cache: true});
return api.get('', param);
};
/**
... ...
{{# shopIndex}}
<div class="shop-index yoho-page scroll-wrapper" id="wrapper">
<div class="shop-index yoho-page scroll-wrapper new-shop" id="wrapper">
<div id="scroller">
<div id="nav-top">
... ... @@ -54,9 +54,7 @@
<div id="home-page" class="main">
<div id="nav-main" class="nav-main">
<!-- 优惠卷 -->
{{#if shopCoupons}}
{{> shop/shop-coupon}}
{{/if}}
<div class="coupon-group"></div>
<!-- 大导航 -->
{{#if brandList}}
... ...
... ... @@ -5,7 +5,11 @@
{{# list}}
<li class="swiper-slide">
<a href="javascript:;">
<img src="{{image img 450 600}}" alt="">
{{#if @first}}
<img src="{{image img 450 600}}" alt="">
{{else}}
<img class="swiper-lazy" data-src="{{image img 450 600}}" alt="">
{{/if}}
</a>
</li>
{{/ list}}
... ...
... ... @@ -16,48 +16,6 @@
</a>
</li>
{{/list}}
<!--<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">22人</p>
<p class="view-status">已加入收藏</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<img src="" alt="little-head-icon" class="head-icon">
<p class="view-num view-margin">大大王</p>
<p class="view-status view-margin">10分钟前购买</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">12人</p>
<p class="view-status">正在浏览</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">22人</p>
<p class="view-status">已加入收藏</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<img src="" alt="little-head-icon" class="head-icon">
<p class="view-num view-margin">大大王</p>
<p class="view-status view-margin">10分钟前购买</p>
</div>
</li>-->
</ul>
</div>
</div>
... ...
{{#appIconList}}
<div class="icons-wrapper" style="background-image:url({{image back_image 640 360}})">
<div class="icons-wrapper" {{#if back_image}} style="background-image:url({{image back_image 640 360}})" {{/if}}>
<ul class="icons-list clearfix">
{{#data}}
<li class="icons-item item-{{../number}}"><a href="{{url}}" class="imagebar"><img src="{{image src 98 98}}" alt=""></a><a href="{{url}}" class="linkbar">{{title}}</a></li>
... ...
... ... @@ -3,7 +3,7 @@
{{#data}}
<div class="banner-list">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}" alt="">
<img src="{{image src 640 200}}" alt="">
</a>
</div>
{{/data}}
... ... @@ -12,7 +12,7 @@
{{#data}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}" alt="">
<img src="{{image src 640 200}}" alt="">
</a>
</li>
{{/data}}
... ...
... ... @@ -14,7 +14,7 @@
<li class="swiper-slide">
<div class="img-box">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image default_images 235 314}}" alt="">
<img src="{{image default_images 235 314}}" alt="">
</a>
<div class="swiper-lazy-preloader"></div>
</div>
... ...
... ... @@ -8,7 +8,7 @@
{{# bigList}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 403}}" alt="{{title}}">
<img class="swiper-lazy" data-src="{{image src 640 403}}" alt="{{title}}">
</a>
</li>
{{/ bigList}}
... ... @@ -21,7 +21,7 @@
{{^}}
<div class="category-swiper">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 403}}" alt="{{title}}">
<img src="{{image src 640 403}}" alt="{{title}}">
</a>
</div>
{{/if}}
... ...
... ... @@ -16,48 +16,6 @@
</a>
</li>
{{/list}}
<!--<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">22人</p>
<p class="view-status">已加入收藏</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<img src="" alt="little-head-icon" class="head-icon">
<p class="view-num view-margin">大大王</p>
<p class="view-status view-margin">10分钟前购买</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">12人</p>
<p class="view-status">正在浏览</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">22人</p>
<p class="view-status">已加入收藏</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<img src="" alt="little-head-icon" class="head-icon">
<p class="view-num view-margin">大大王</p>
<p class="view-status view-margin">10分钟前购买</p>
</div>
</li>-->
</ul>
</div>
</div>
... ...
{{#appIconList}}
<div class="icons-wrapper" style="background-image:url({{back_image}})">
<div class="icons-wrapper" {{#if back_image}} style="background-image:url({{back_image}})" {{/if}}>
<ul class="icons-list clearfix">
{{#data}}
<li class="icons-item item-{{../number}}"><a href="{{url}}" class="imagebar"><img src="{{image src 98 98}}" alt=""></a><a href="{{url}}" class="linkbar">{{title}}</a></li>
... ...
... ... @@ -4,19 +4,19 @@
{{#banner_image}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}" alt="">
<img class="swiper-lazy" data-src="{{image src 640 200}}" alt="">
</a>
</li>
{{/banner_image}}
</ul>
{{else}}
{{#banner_image}}
<div class="banner-list">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}" alt="">
</a>
</div>
{{/banner_image}}
{{#banner_image}}
<div class="banner-list">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}" alt="">
</a>
</div>
{{/banner_image}}
{{/if}}
<div class="swiper-pagination" {{#if banner_image.[1]}}style="display:block"{{/if}}>
<div class="pagination-inner">
... ...
... ... @@ -16,19 +16,19 @@
</div>
<span class="faved-num"></span>
<a href="{{url}}">
<img src="{{image src 362 174}}" alt="banner" class="top">
<img class="swiper-lazy" data-src="{{image src 362 174}}" alt="banner" class="top">
</a>
{{#goods0}}
<a href="{{url}}">
<div class="bottom left">
<img src="{{image src 138 183}}" alt="left">
<img class="swiper-lazy" data-src="{{image src 138 183}}" alt="left">
</div>
</a>
{{/goods0}}
{{#goods1}}
<a href="{{url}}">
<div class="bottom right">
<img src="{{image src 138 183}}" alt="right">
<img class="swiper-lazy" data-src="{{image src 138 183}}" alt="right">
</div>
</a>
{{/goods1}}
... ...
... ... @@ -8,7 +8,7 @@
<li class="swiper-slide">
<a href="{{url}}">
<div class="img-box">
<img class="lazy" data-original="{{image src 580 360}}" src="{{image src 580 360}}" alt="">
<img src="{{image src 580 360}}" alt="">
</div>
<div class="item-content">
<p class="title">{{title}}</p>
... ...
... ... @@ -165,10 +165,6 @@ $('.coupon-message-op-rel').on('click', function() {
location.reload();
});
$('.nav-home').on('touchstart', function() {
$('.homebuttom').toggleClass('hide');
});
if ($('#noData').length > 0) {
if (location.href.indexOf('?openby:yohobuy=') <= 0) {
tip.show('网络异常!');
... ...
... ... @@ -114,25 +114,6 @@ if ($('.banner-swiper').find('li').size() > 1) {
});
}
// single_image的轮播
$('.banner-center-swiper').each(function() {
if ($(this).find('li').size() > 1) {
new Swiper('.banner-center-swiper', {
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-center .pagination-inner',
});
} else {
$(this).unbind();
}
});
// 店铺推荐人数和收藏初始查询
var checkShop = function() {
var shopIds = [];
... ... @@ -189,6 +170,24 @@ var saleTime = function(elem, offsetTime) {
};
function ajaxResource() {
$('.banner-center-swiper').each(function() {
if ($(this).find('li').length > 1) {
new Swiper(this, {
preloadImages: false,
lazyLoading: true,
lazyLoadingInPrevNext: true,
lazyLoadingOnTransitionStart: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-center .pagination-inner',
});
}
});
// 热门品牌滑动
if ($('.brands-swiper').find('li').length > 1) {
new Swiper('.brands-swiper', {
... ... @@ -239,6 +238,10 @@ function ajaxResource() {
$(this).addClass(swiperClass);
if ($('.' + swiperClass).find('.swiper-slide').size() > 1) {
new Swiper('.' + swiperClass, {
preloadImages: false,
lazyLoading: true,
lazyLoadingInPrevNext: true,
lazyLoadingOnTransitionStart: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
... ... @@ -252,6 +255,10 @@ function ajaxResource() {
// 店铺推荐滑动效果
if ($('.shop-recom-swiper-container').find('li').length > 1) {
new Swiper('.shop-recom-swiper-container', {
preloadImages: false,
lazyLoading: true,
lazyLoadingInPrevNext: true,
lazyLoadingOnTransitionStart: true,
centeredSlides: true,
slidesPerView: 'auto',
paginationClickable: true,
... ...
... ... @@ -30,6 +30,7 @@ var $goodsContainer = $('#goods-container'),
$newList = $('.new-list');
var winH = $(window).height();
window.$ = $;
var $input = $('#search-input input'),
$clear = $('#search-input .clear-input'),
... ... @@ -519,7 +520,7 @@ function search(opt) {
});
}
if (data === '' || data.list) {
if (data === '' || (data.list && data.list.length <= 0)) {
nav.end = true;
if (nav.reload) {
... ...
... ... @@ -3,6 +3,7 @@
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/20
*/
require('../../scss/product/detail/_index.css');
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
Hammer = require('yoho-hammer'),
... ... @@ -25,7 +26,7 @@ require('./detail/page-render')(function() {
require('../common');
require('./tick');// 调用秒杀js
require('./tick'); // 调用秒杀js
// add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
... ... @@ -154,6 +155,3 @@ require('./detail/page-render')(function() {
$('#yoho-footer').css('border-top', '1px solid #e0e0e0');
}
});
... ...
... ... @@ -115,7 +115,7 @@ var defaultOpt = require('../common/query-param');
channel: defaultOpt.channel
},
success: function(data) {
$goodsContainer.append(data);
$('.shop-index').after(data);
// 初始化filter&注册filter回调
filter.initFilter({
... ... @@ -344,10 +344,13 @@ function tabChange(dom, index) {
// 首页导航
(function(nav, posNav, main) {
var scrollToNav1 = function() {
window.scrollTo(0, $('#nav').offset().top + 5);
setTimeout(function() {
window.scrollTo(0, $('#nav').offset().top + 5);
}, 100);
};
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
var isPos = $(this).parent().attr('id') === 'pos-nav';
var index = $(this).index(),
activeTab = $(this).attr('tab');
... ... @@ -362,17 +365,17 @@ function tabChange(dom, index) {
$('#' + activeTab).fadeIn();
if (activeTab === 'new-arrival') {
toTop = true;
newData(scrollToNav1);
newData(isPos ? scrollToNav1 : function() {});
viewType = 2;
} else if (activeTab === 'popularity') {
toTop = true;
hotData(scrollToNav1);
hotData(isPos ? scrollToNav1 : function() {});
viewType = 3;
} else if (activeTab === 'home-page') {
$nav1.removeClass('fixed-top absolute');
$nav2.removeClass('fixed-top absolute');
viewType = 1;
scrollToNav1();
isPos && scrollToNav1();
}
scH = $('#scroller').outerHeight();
});
... ... @@ -620,7 +623,7 @@ function search(opt, callback) {
break;
}
if (data === '') {
if (data === '' || (data.list && data.list.length <= 0)) {
nav.end = true;
if (nav.reload) {
... ... @@ -742,6 +745,7 @@ $newList.on('touchstart', 'li', function(e) {
}, function() {
});
}
e.stopPropagation();
});
... ... @@ -753,7 +757,9 @@ $(document).on('touchstart', function(e) {
}
});
function subNavScrollTo() {
window.scrollTo(0, $('#list-nav').offset().top + 5);
setTimeout(function() {
window.scrollTo(0, $('#list-nav').offset().top + 5);
}, 100);
}
$subNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
... ... @@ -910,7 +916,6 @@ $subNav.on('touchend touchcancel', function(e) {
url: '/product/search/search',
nextPage: false
}, function() {
subNavScrollTo();
});
}
}
... ...
... ... @@ -10,7 +10,7 @@ shopCoupon = {
common: {
appVersion: window.queryString.app_version || window.queryString.appVersion,
uid: window.queryString.uid,
shopId: parseInt($('.shop-id').val(), 10) || null,
shopId: parseInt($('.shop-id').val() || $('.shopId').val(), 10) || null,
brandId: parseInt($('.brand-header').data('id'), 10) || null,
couponTemplate: require('product/shop/coupon.hbs')
},
... ...
... ... @@ -399,7 +399,7 @@ function search(opt) {
break;
}
if (data === '') {
if (data === '' || (data.list && data.list.length <= 0)) {
nav.end = true;
if (nav.reload) {
... ...
... ... @@ -213,7 +213,7 @@ function getPageGoods(info) {
url: info.url,
data: info.data,
success: function(data) {
if (data === '') {
if (data === '' || (data.list && data.list.length <= 0)) {
nav.end = true;
}
... ... @@ -707,7 +707,7 @@ function search(opt) {
break;
}
if (data === '') {
if (data === '' || (data.list && data.list.length <= 0)) {
nav.end = true;
if (nav.reload) {
... ...
.shop-index {
/*position: absolute;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: hidden;*/
#pos-nav, #pos-list {
position: fixed;
left: 0;
top: 0;
overflow: hidden;
&.new-shop {
position: initial;
overflow: initial;
#pos-nav, #pos-list {
position: fixed;
left: 0;
top: 0;
}
.nav {
li {
height: 100%;
line-height: 100%;
margin-top: 0px;
border-left: none;
.text {
display: block;
width: 100%;
border-left: 1px solid #e0e0e0;
margin-top: 30px;
height: 28px;
}
&:first-child {
.text {
border-left: none;
}
}
}
}
.shop-foot-wrapper {
position: fixed;
left: 0;
}
}
.nav-main {
margin-bottom: 30px;
}
... ... @@ -90,25 +120,18 @@
li{
display: block;
height: 100%;
line-height: 100%;
height: 28px;
float: left;
line-height: 28px;
width: 24.7%;
text-align: center;
border-left: 1px solid #e0e0e0;
margin-top: 30px;
border-sizing: border-box;
color: #b0b0b0;
.text {
display: block;
width: 100%;
border-left: 1px solid #e0e0e0;
margin-top: 30px;
height: 28px;
}
&:first-child {
border-left: none;
.text {
border-left: none;
}
}
a {
... ... @@ -417,9 +440,8 @@
}
.shop-foot-wrapper {
position: fixed;
position: absolute;
bottom: 0;
left: 0;
display: table;
width: 100%;
height: 88px;
... ... @@ -623,9 +645,9 @@
}
.shop-index + .filter-mask {
margin-top: 1px;
.filter-body {
top: 1px;
overflow: auto;
}
... ... @@ -634,8 +656,17 @@
}
&.call-by-fix {
top: 78px;
}
}
.new-shop + .filter-mask {
margin-top: initial;
position: fixed;
top: 46px;
&.call-by-fix {
top: 80px;
position: fixed;
left: 0;
}
}
}
\ No newline at end of file
... ...
... ... @@ -22,4 +22,7 @@
@import "product/search/list";
@import "product/sale/sale";
@import "product/shop/shop-index";
@import "product/shop/shop-prodfile";
@import "product/shop/product-category";
@import "product/shop/shop-index-coupon";
@import "home/hot-category";
... ...