Authored by htoooth

Merge remote-tracking branch 'origin/feature/qps' into feature/qps

... ... @@ -70,15 +70,11 @@ const link = (req, res, next) => {
res.render('link', responseData);
}).catch(next);
};
const test = (req, res) => {
res.send('hi');
};
module.exports = {
yohobuy,
newpower,
contact,
privacy,
link,
test
link
};
... ...
... ... @@ -13,6 +13,5 @@ router.get('/newpower.html', aboutCtrl.newpower);
router.get('/contact.html', aboutCtrl.contact);
router.get('/privacy.html', aboutCtrl.privacy);
router.get('/link.html', aboutCtrl.link);
router.get('/test.html', aboutCtrl.test);
module.exports = router;
... ...
... ... @@ -182,7 +182,7 @@ module.exports = class extends global.yoho.BaseModel {
return {
path: bread,
homeNav: navs.homeNav,
userThumb: ''
userThumb: defaultAvatar
};
}
... ...
... ... @@ -67,8 +67,6 @@ router.get(['/index', '/'], tabsMiddleware.getCommonHeaderNew, indexController.i
router.get('/index/newsAvatar', checkLogin, indexController.newsAvatar);
router.get('/index/async', checkLogin, indexController.asyncData);
// router.get(['/index', '/'], tabsMiddleware.getCommonHeader, indexController.index);
// 查看二维码
router.get('/QRcode', tabsMiddleware.getCommonHeader, personalController.QRcode);
... ...
... ... @@ -2,7 +2,7 @@
<p class="title ucenter"></p>
<div class="user-thumb">
<div class="thumb-bg">
<img id="user-thumb">
<img id="user-thumb" src="{{image2 userThumb w=100 h=100}}">
</div>
</div>
{{# homeNav}}
... ...
... ... @@ -8,6 +8,7 @@
const mRoot = '../models';
const sale = require(`${mRoot}/sale`); // sale model
const detailHelper = require(`${mRoot}/detail-helper`);
const channelList = ['boys', 'girls', 'kids', 'lifestyle'];
... ... @@ -170,10 +171,13 @@ exports.special = (req, res, next) => {
*/
exports.getGoodsList = (req, res, next) => {
let params = req.query;
let vipLevel = detailHelper.vipLevel(req.user.vip);
params.uid = req.user.uid || 0;
if (params.refresh && !vipLevel) {
return res.send('');
}
req.ctx(sale).getSaleGoodsData(params).then(result => {
req.ctx(sale).getSaleGoodsData(params, vipLevel).then(result => {
let responseData = {};
responseData.footerTop = false;
... ...
... ... @@ -115,7 +115,7 @@ function getListData(params, channel) {
_.get(finalResult, 'list.leftContent.sort', {}));
filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
finalResult.list.leftContent.checked);
_.get(finalResult, 'list.leftContent.checked', []));
Object.assign(finalResult.list, {
filters: filters,
... ... @@ -240,7 +240,7 @@ function getListNewData(params, channel) {
finalResult.list.leftContent.sort);
filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
finalResult.list.leftContent.checked);
_.get(finalResult, 'list.leftContent.checked', []));
Object.assign(finalResult.list, {
filters: filters,
... ... @@ -414,7 +414,7 @@ function getBrandData(params, extra, channel) {
finalResult.brand.leftContent.sort);
filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
finalResult.brand.leftContent.checked);
_.get(finalResult, 'brand.leftContent.checked', []));
Object.assign(finalResult.brand, {
filters: filters,
... ...
... ... @@ -8,6 +8,7 @@
'use strict';
const api = global.yoho.API;
const Promise = require('bluebird');
const querystring = require('querystring');
const SaleApiModel = require('./sale-api');
const SearchApiModel = require('./search-api');
... ... @@ -61,16 +62,12 @@ const contentCode = {
* 获取Sale首页商品列表数据 仅 Ajax 调用 Controller 调用
* @return {[type]} [description]
*/
function getSaleGoodsData(params) {
return api.all([
this.saleApi.getSaleGoodsList(params),
this.saleApi.getUserProfile(params.uid)
]).then(result => {
function getSaleGoodsData(params, vipLevel) {
return this.saleApi.getSaleGoodsList(params).then(result => {
let finalResult = {};
if (result[0].code === 200) {
finalResult.goods = productProcess.processProductList(result[0].data.product_list);
if (result.code === 200) {
finalResult.goods = productProcess.processProductList(result.data.product_list);
_.forEach(finalResult.goods, (value, key) => {
delete finalResult.goods[key].tags.isNew; // 屏蔽 new 标签
delete finalResult.goods[key].tags.isSale;// 屏蔽 sale 标签
... ... @@ -79,33 +76,28 @@ function getSaleGoodsData(params) {
}
// 处理 VIP 商品数据
if (result[1].code === 200) {
let vipInfo = _.get(result, '[1].data.vip_info', {});
if (params.saleType === '2') {
_.forEach(finalResult.goods, (value, key) => {
switch (vipInfo.cur_level) {
case '1':
finalResult.goods[key].sales_price = value.vip1_price;
finalResult.goods[key].vip1 = true;
break;
case '2':
finalResult.goods[key].sales_price = value.vip2_price;
finalResult.goods[key].vip2 = true;
break;
case '3':
finalResult.goods[key].sales_price = value.vip3_price;
finalResult.goods[key].vip3 = true;
break;
default:
finalResult.goods[key].vip = true;
delete finalResult.goods[key].sales_price;
break;
}
if (params.saleType === '2') {
_.forEach(finalResult.goods, (value, key) => {
});
}
switch (_.toString(vipLevel)) {
case '1':
finalResult.goods[key].sales_price = value.vip1_price;
finalResult.goods[key].vip1 = true;
break;
case '2':
finalResult.goods[key].sales_price = value.vip2_price;
finalResult.goods[key].vip2 = true;
break;
case '3':
finalResult.goods[key].sales_price = value.vip3_price;
finalResult.goods[key].vip3 = true;
break;
default:
finalResult.goods[key].vip = true;
delete finalResult.goods[key].sales_price;
break;
}
});
}
// 需要判断是否为今日推荐,今日推荐需要添加最后的全部商品图片
... ... @@ -147,7 +139,6 @@ function getSaleGoodsData(params) {
* @return {[type]} [description]
*/
function getSaleIndexData(channel) {
return api.all([
headerModel.requestHeaderData(channel),
this.saleApi.getSaleActivityList('', channel),
... ... @@ -155,7 +146,7 @@ function getSaleIndexData(channel) {
this.saleApi.getSaleGoodsList({channel: channel, saleType: '2', limit: '1'}), // 会员专享分类
this.saleApi.getSalebreakingYardsSortList({channel: channel}), // 断码区尺码数据
this.saleApi.getSaleGoodsList({channel: channel, limit: '1'}) // 最新降价分类
]).then(result => {
]).then(async result => {
var finalResult = result[0];
// 折扣专场活动处理
... ... @@ -176,7 +167,6 @@ function getSaleIndexData(channel) {
// 会员专享分类处理
if (result[3].code === 200) {
finalResult.saleCategory.push(
Object.assign(
saleHandler.handleSaleCategoryData(result[3].data.filter.group_sort, '2', channel),
... ... @@ -189,37 +179,42 @@ function getSaleIndexData(channel) {
if (result[4].code === 200) {
let breakingSizeSort = saleHandler.handleSaleBreakingSizeData(result[4].data);
return api.all([
this.saleApi.getSaleGoodsList({
channel: channel,
saleType: '5', // app 与 pc 有冲突,为 PC 加一个 5 的选项
limit: '1',
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
})
]).then(subResult => {
if (subResult[0].code === 200) {
finalResult.saleCategory.push(
saleHandler.handleSaleCategoryData(
subResult[0].data.filter.group_sort,
'5',
channel,
breakingSizeSort
)
);
}
// 最新降价分类处理
if (result[5].code === 200) {
finalResult.saleCategory.push(
saleHandler.handleSaleCategoryData(result[5].data.filter.group_sort, '3', channel)
);
}
return finalResult;
let subResult = await this.saleApi.getSaleGoodsList({
channel: channel,
saleType: '5', // app 与 pc 有冲突,为 PC 加一个 5 的选项
limit: '1',
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
});
if (subResult.code === 200) {
finalResult.saleCategory.push(
saleHandler.handleSaleCategoryData(
subResult.data.filter.group_sort,
'5',
channel,
breakingSizeSort
)
);
}
}
// 最新降价分类处理
if (result[5].code === 200) {
finalResult.saleCategory.push(
saleHandler.handleSaleCategoryData(result[5].data.filter.group_sort, '3', channel)
);
}
let saleGoods = await Promise.all(_.cloneDeep(finalResult.saleCategory).map(value => {
return this.getSaleGoodsData(querystring.parse(_.trim(value.urlLocation, '?')));
}));
_.zipWith(finalResult.saleCategory, saleGoods, function(category, goods) {
category.defaultGoods = goods.goods || [];
return category;
});
return finalResult;
});
}
... ...
... ... @@ -440,7 +440,7 @@ exports.handleOptsData = (params, total, extra) => {
// 上下翻页数据处理
dest.pageCounts = [{
href: handleFilterUrl(params, {limit: 60}, {page: true}),
href: handleFilterUrl(params, {limit: 40}, {page: true}),
count: 60
}, {
href: handleFilterUrl(params, {limit: 100}, {page: true}),
... ... @@ -453,7 +453,7 @@ exports.handleOptsData = (params, total, extra) => {
dest.curPage = _.isEmpty(params.page) ? 1 : params.page; // 当前页码数
// 每页商品数量
dest.countPerPage = _.isEmpty(params.limit) ? 60 : params.limit;
dest.countPerPage = _.isEmpty(params.limit) ? 40 : params.limit;
// 全部页码数量
dest.pageCount = _.ceil(total / (dest.countPerPage - 1));
... ... @@ -1132,7 +1132,7 @@ exports.handlePagerData = (total, params, noNextBtn) => {
};
let currentPage = parseInt(_.get(params, 'page', 1), 10); // 当前页
let perPageCount = parseInt(_.get(params, 'limit', noNextBtn === true ? 60 : 59), 10); // 每页商品数
let perPageCount = parseInt(_.get(params, 'limit', noNextBtn === true ? 40 : 39), 10); // 每页商品数
let totalPage = Math.ceil(total / perPageCount); // 总页数
if (noNextBtn !== true) {
... ... @@ -1144,7 +1144,7 @@ exports.handlePagerData = (total, params, noNextBtn) => {
perPageCount = 99;
break;
default :
perPageCount = 59;
perPageCount = 39;
break;
}
}
... ... @@ -1654,7 +1654,7 @@ exports.getCriteo = (glist) => {
// handlePagerData
exports.getSearchParams = params => {
let mlimit = 59;
let mlimit = 39;
if (params && params.limit) {
... ... @@ -1668,7 +1668,7 @@ exports.getSearchParams = params => {
mlimit = 199;
break;
default:
mlimit = 59;
mlimit = 39;
}
}
... ...
... ... @@ -279,7 +279,7 @@ function _getBaseShopData(channel, params, shopInfo) {
_.get(resData, 'brand.leftContent.sort', {}));
filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
resData.brand.leftContent.checked);
_.get(resData, 'brand.leftContent.checked', []));
Object.assign(resData.brand, {
filters: filters,
... ...
... ... @@ -12,9 +12,11 @@
<i class="iconfont">&#xe62a;</i>
品牌介绍
</a>
{{#unless @root.pc.cart.removeFavStatus}}
<span id="brand-favor" class="brand-favor" data-id="{{dataId}}">
<i class="iconfont{{#if coled}} coled{{/if}}">&#xe611;</i>
</span>
{{/unless}}
</p>
</div>
</div>
... ... @@ -36,9 +38,11 @@
<i class="iconfont">&#xe62a;</i>
店铺介绍
</a>
{{#unless @root.pc.cart.removeFavStatus}}
<span id="shop-favor" class="brand-favor shop-favor" data-id="{{shopId}}">
<i class="iconfont{{#if coled}} coled{{/if}}">&#xe611;</i>
</span>
{{/unless}}
<div class="qrcode-hover-box" data-id="{{shopId}}">
<span class="qrcode-shop">
<i class="qrcode-icon"></i>
... ...
... ... @@ -13,6 +13,7 @@
<i class="shop-intro-ico"></i>
店铺介绍
</div>
{{#unless @root.pc.cart.removeFavStatus}}
<div class="shop-collect" data-id="{{brandIntro.shopId}}">
<i class="shop-collect-ico {{#if brandIntro.isFavorite}}on{{/if}}"></i>
<span class="shop-collect-text">
... ... @@ -23,6 +24,7 @@
{{/if}}
</span>
</div>
{{/unless}}
<div class="qrcode-hover-box qrcode-decoration" data-id="{{brandIntro.shopId}}">
<i class="qrcode-icon"></i>
<div class="qrcode-box">
... ...
... ... @@ -11,6 +11,9 @@
</ul>
<div class="commodity-list">
<ul class="clearfix goods">
{{# defaultGoods}}
{{> product/good}}
{{/ defaultGoods}}
</ul>
</div>
</div>
... ...
... ... @@ -110,7 +110,7 @@ module.exports = {
port: '4444' // influxdb port
},
console: {
level: 'info',
level: 'error',
colorize: 'all',
prettyPrint: true
}
... ...
... ... @@ -11,9 +11,11 @@ const _ = require('lodash');
const api = global.yoho.API;
const serviceApi = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
const keyPrefix = 'COMMON_HEADER_';
const cache = global.yoho.cache;
const logger = global.yoho.logger;
const Handlebars = require('handlebars');
const path = require('path');
const headerHtml = require('fs').readFileSync(path.resolve(__dirname, '../views/partial/headerNew.hbs')).toString();
const template = Handlebars.compile(headerHtml);
/**
* 获取菜单
* @param undefined
... ... @@ -216,18 +218,12 @@ const getHeaderNavAsync = () => {
* @param {String} 频道类型
* @return {promise}
*/
let cacheHeaderHtml = {};
async function requestHeaderData(type) {
let resData = {};
type = type || 'boys';
let headerKey = `${keyPrefix}${type}`;
let header = await cache.get(headerKey).catch(() => {
logger.error(`header data get cache error`);
return {};
});
if (_.isEmpty(header)) {
if (_.isEmpty(cacheHeaderHtml[type])) {
let channelNum = (function() {
switch (type) {
case 'boys':
... ... @@ -268,16 +264,23 @@ async function requestHeaderData(type) {
});
}
resData = template(resData);
if (res[0] && res[0].data && res[1] && res[1].data) {
cache.set(headerKey, resData, 300);
cacheHeaderHtml[type] = resData;
}
} else {
resData = JSON.parse(header);
resData = cacheHeaderHtml[type];
}
return resData;
};
return Promise.resolve({headerData: resData});
}
setInterval(function() {
cacheHeaderHtml = {};
}, 60 * 10 * 1000);
module.exports = {
requestHeaderData
}
};
... ...
{{# headerData}}
<div id="yoho-header" class="yoho-header" data-type="{{headType}}">
<div class="tool-wrapper clearfix" data-role="tool-wrapper">
<div class="center-content">
<!--<div class="yoho-group-map left">
<span class="icon-hamburger"></span>
<a href="//www.yohobuy.com"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>YOHO!BUY 有货</a>
{{#if yohoGroup}}
<ul class="yoho-group-list">
{{# yohoGroup}}
<li>
<a href="{{link}}" class="yoho-group"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} data-en="{{en}}" data-cn="{{cn}}">{{en}}</a>
</li>
{{/ yohoGroup}}
</ul>
{{/if}}
</div>-->
<div class="left swindle-info">
<span class="icon-note"></span>
<a href="//www.yohobuy.com/help/detail?id=103&contId=147"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} target="_blank">
关于防诈骗的重要提醒
</a>
</div>
{{#unless @root.pc.common.removeCertTip}}
<div class="left yoho-cert-tip"></div>
{{/unless}}
<div class="yoho-buy-tools right">
<ul>
<li id="loginBox">
<span class="hi">Hi~</span>
[ <a id="signin-url" href="//www.yohobuy.com/signin.html" class="loginbar" rel="nofollow">请登录</a> ]
[ <a id="reg-url" href="//www.yohobuy.com/reg.html" class="registbar" rel="nofollow">免费注册</a> ]
</li>
<li class="myyoho" id="myYohoBox">
<span class="tag-seprate"></span>
<a href="//www.yohobuy.com/home?t=1453340799.4986" rel="nofollow">MY有货</a>
<span class="icon-bottomarrow"></span>
{{#unless @root.pc.common.disMyYohoHover}}
<div class="simple-user-center"></div>
{{/unless}}
</li>
<li class="myorder">
<span class="tag-seprate"></span>
<span class="icon-papers"></span>
<a href="//www.yohobuy.com/home/orders?t=1453168898.0176" rel="nofollow">我的订单</a>
</li>
<li class="mycollect">
<span class="tag-seprate"></span>
<span class="icon-heart"></span>
<a href="//www.yohobuy.com/home/favorite?t=1453168898.0176" rel="nofollow">我的收藏</a>
</li>
<li class="message">
<span class="tag-seprate"></span>
<span class="icon-mail"></span>
<a href="//www.yohobuy.com/home/message?t=1453168898.0176" rel="nofollow">消息</a>
</li>
<li class="help nav-drop-down-container">
<span class="tag-seprate"></span>
<span class="iconfont">&#xe702;</span>
<a href="#">客户服务</a>
<ul class="nav-drop-down">
<li>
<a href="{{#if @root.pc.clientService.new}}http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409{{else}}//www.yohobuy.com/service/client{{/if}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} target="_blank">在线客服</a>
</li>
<li>
<a href="//www.yohobuy.com/help"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>帮助中心</a>
</li>
</ul>
</li>
<li class="we-chat download-code">
<span class="tag-seprate"></span>
<span class="iconfont">&#xe704;</span>
<a href="">关注有货</a>
<div class="download-app-box">
<div class="we-chat-img code-img"></div>
<h5 class="qr-words">微信扫一扫</h5>
<h5 class="qr-words">关注公众号,赢免单</h5>
</div>
</li>
<li class="phoneapp download-code" id="phoneApp">
<span class="tag-seprate"></span>
<span class="icon-phone"></span>
<a href="//www.yohobuy.com/download/app"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>手机版</a>
<div class="download-app-box">
<div class="qr-img code-img"></div>
<h5 class="qr-words">下载手机客户端</h5>
<h5 class="qr-more">
<a href="javascript:void(0);">更多客户端</a>
</h5>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="head-wrapper clearfix">
<div class="center-content">
<div class="outlets-logo"></div>
<div class="main-logo"><a href="//www.yohobuy.com/" class="main-link"></a></div>
<ul class="main-nav-list">
{{# navbars}}
<li class="{{type}}"{{#if ico}}
style="background: url({{image2 ico w=54 h=32}}) no-repeat center center"{{/if}}>
{{#if ico}}
<a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}} class="menu-ico"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}></a>
{{^}}
<h5 class="name-cn">
<a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}}{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{cn}}</a>
</h5>
<h5 class="name-en">
<a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}}{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{en}}</a>
</h5>
{{/if}}
</li>
{{/ navbars}}
</ul>
<div class="func-area hide">
{{#unless @root.pc.common.disSearchAssociation}}
<ul class="search-suggest"></ul>
{{/unless}}
<ul class="search-suggest-history"></ul>
<div class="search-2016">
<form action="//search.yohobuy.com" method="get" id="search-form">
<input type="hidden" id="defaultsearch" value="{{defaultSearch}}">
<input class="search-key" type="text" name="query" id="query-key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" maxlength="30">
<a class="search-btn" href="javascript:submitSearch();"></a>
</form>
<ul class="search-hot">
{{#hotTerms}}
<li>
<a style="display: block;" href="{{href}}" title="{{content}}"
act="{{href}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} target="_blank">
<span class="searchvalue">{{content}}</span>
</a>
</li>
{{/hotTerms}}
</ul>
</div>
<div class="go-cart">
<a href="//www.yohobuy.com/cart/cart">
<span class="iconfont ">&#xe600;</span>
{{#unless @root.pc.common.removeCartCount}}
<span class="goods-num-tip hide">0</span>
{{/unless}}
</a>
{{#unless @root.pc.common.disCartHover}}
<div class="mini-cart-wrapper">
<div class="loading-cart">
<h3>加载中,请稍后</h3>
</div>
<div class="empty-cart">
<h3>您的购物车暂无商品</h3>
</div>
</div>
{{/unless}}
</div>
</div>
</div>
</div>
<div class="nav-wrapper clearfix">
<div class="center-content">
{{# subNavGroup}}
<ul class="sub-nav-list {{subType}}">
{{# subNav}}
<li {{#if thirdNav}}class="contain-third"{{/if}}>
<a href="{{link}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{name}}
{{#if isNew}}
<span class="newlogo"></span>
{{/if}}
</a>
{{#if thirdNav}}
<div class="third-nav-wrapper">
<div class="center-content">
<dl class="hide-list hide">
{{# thirdNav}}
<dt>
<h3 class=""><a href="{{link}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{title}}</a></h3>
</dt>
{{#brandItems}}
<dd>
<a href="{{link}}"{{#if hot}}
class="hot"{{/if}}{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{brandName}}</a>
</dd>
{{/brandItems}}
{{/thirdNav}}
</dl>
<div class="show-detail" data-code="{{imgCode}}">
<a{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}><img src="data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=="></a>
<a class="title">热门小物优选</a>
</div>
</div>
</div>
{{/if}}
</li>
{{/ subNav}}
</ul>
{{/ subNavGroup}}
</div>
</div>
</div>
<div id="hide-template">
<script type="text/html" id="header-login-info-tpl">
<span>Hi~ <a href="\{{usercenter}}" class="nick-name">\{{nickname}}</a></span>
&nbsp;[ <a href="\{{signout}}">退出</a> ]
</script>
<script type="text/html" id="simple-account-info-tpl">
<div class="account-info-header">
<div class="user-img">
\{{#if headIco}}
<img src="\{{headIco}}">
\{{/if}}
</div>
<div class="user-name">
<a href="//www.yohobuy.com/home?t=\{{random}}">\{{profileName}}</a>
</div>
<h4 class="user-level">
VIP: <span>\{{curTitle}}</span>
</h4>
\{{#unless vip3}}
<div class="level-detail">
<div class="level-view-bar">
<div class="text-span">
\{{curYearCost}}/\{{nextVipNeedCost}}
</div>
<p class="\{{#if curYearCostPer}}integrate\{{/if}}" style="width: \{{curYearCostPer}}%;"></p>
</div>
<span>\{{nextVipTitle}}</span>
</div>
\{{/unless}}
</div>
<ul class="account-info-content">
<li>
<a href="//www.yohobuy.com/home/orders?t=\{{timestamp}}">待处理的订单</a>
<span class="right">\{{order}}</span>
</li>
<li>
<a href="//www.yohobuy.com/home/favorite?t=\{{timestamp}}">我的收藏</a>
<span class="right"></span>
</li>
<li>
<a href="//www.yohobuy.com/home/coupons?t=\{{timestamp}}">我的优惠券</a>
<span class="right">\{{coupon}}</span>
</li>
<li>
<a href="//www.yohobuy.com/home/currency?t=\{{timestamp}}">我的有货币</a>
<span class="right">\{{coin}}</span>
</li>
<li>
<a href="//www.yohobuy.com/home/returns?t=\{{timestamp}}">我的退货换货</a>
<span class="right">\{{return}}</span>
</li>
</ul>
<div class="account-info-footer">
<a href="//www.yohobuy.com/home/user?t=\{{timestamp}}">完善资料
{{#unless @root.pc.user.removeStudentIdentification}}
<span>(学生认证)</span>
{{/unless}}
</a>
</div>
</script>
<script type="text/html" id="search-suggest-tml">
\{{#data}}
<li>
<a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"
act="\{{href}}">
<span class="searchvalue">\{{keyword}}</span>
<span class="valuenum">约\{{count}}个商品</span>
</a>
</li>
\{{/data}}
</script>
<script type="text/html" id="search-suggest-history">
\{{#if data}}<p class="search-suggest-title">最近搜过<a class="search-del" href="#">清空</a></p>
\{{#data}}
<li>
<a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"
act="\{{href}}">
<span class="searchvalue">\{{keyword}}</span>
</a>
</li>
\{{/data}}
\{{/if}}
</script>
</div>
<input id="api-domain" type="hidden" value="{{apiDomain}}">
<div class="code-down-box">
<div class="code-img"></div>
<h5 class="code-title">下载手机客户端</h5>
<i class="iconfont icon-del"></i>
</div>
{{/ headerData}}
{{{headerData}}}
... ...
{{# headerData}}
<div id="yoho-header" class="yoho-header" data-type="{{headType}}">
<div class="tool-wrapper clearfix" data-role="tool-wrapper">
<div class="center-content">
<!--<div class="yoho-group-map left">
<span class="icon-hamburger"></span>
<a href="//www.yohobuy.com"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>YOHO!BUY 有货</a>
{{#if yohoGroup}}
<ul class="yoho-group-list">
{{# yohoGroup}}
<li>
<a href="{{link}}" class="yoho-group"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} data-en="{{en}}" data-cn="{{cn}}">{{en}}</a>
</li>
{{/ yohoGroup}}
</ul>
{{/if}}
</div>-->
<div class="left swindle-info">
<span class="icon-note"></span>
<a href="//www.yohobuy.com/help/detail?id=103&contId=147"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} target="_blank">
关于防诈骗的重要提醒
</a>
</div>
{{#unless @root.pc.common.removeCertTip}}
<div class="left yoho-cert-tip"></div>
{{/unless}}
<div class="yoho-buy-tools right">
<ul>
<li id="loginBox">
<span class="hi">Hi~</span>
[ <a id="signin-url" href="//www.yohobuy.com/signin.html" class="loginbar" rel="nofollow">请登录</a> ]
[ <a id="reg-url" href="//www.yohobuy.com/reg.html" class="registbar" rel="nofollow">免费注册</a> ]
</li>
<li class="myyoho" id="myYohoBox">
<span class="tag-seprate"></span>
<a href="//www.yohobuy.com/home?t=1453340799.4986" rel="nofollow">MY有货</a>
<span class="icon-bottomarrow"></span>
{{#unless @root.pc.common.disMyYohoHover}}
<div class="simple-user-center"></div>
{{/unless}}
</li>
<li class="myorder">
<span class="tag-seprate"></span>
<span class="icon-papers"></span>
<a href="//www.yohobuy.com/home/orders?t=1453168898.0176" rel="nofollow">我的订单</a>
</li>
<li class="mycollect">
<span class="tag-seprate"></span>
<span class="icon-heart"></span>
<a href="//www.yohobuy.com/home/favorite?t=1453168898.0176" rel="nofollow">我的收藏</a>
</li>
<li class="message">
<span class="tag-seprate"></span>
<span class="icon-mail"></span>
<a href="//www.yohobuy.com/home/message?t=1453168898.0176" rel="nofollow">消息</a>
</li>
<li class="help nav-drop-down-container">
<span class="tag-seprate"></span>
<span class="iconfont">&#xe702;</span>
<a href="#">客户服务</a>
<ul class="nav-drop-down">
<li>
<a href="{{#if @root.pc.clientService.new}}http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409{{else}}//www.yohobuy.com/service/client{{/if}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} target="_blank">在线客服</a>
</li>
<li>
<a href="//www.yohobuy.com/help"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>帮助中心</a>
</li>
</ul>
</li>
<li class="we-chat download-code">
<span class="tag-seprate"></span>
<span class="iconfont">&#xe704;</span>
<a href="">关注有货</a>
<div class="download-app-box">
<div class="we-chat-img code-img"></div>
<h5 class="qr-words">微信扫一扫</h5>
<h5 class="qr-words">关注公众号,赢免单</h5>
</div>
</li>
<li class="phoneapp download-code" id="phoneApp">
<span class="tag-seprate"></span>
<span class="icon-phone"></span>
<a href="//www.yohobuy.com/download/app"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>手机版</a>
<div class="download-app-box">
<div class="qr-img code-img"></div>
<h5 class="qr-words">下载手机客户端</h5>
<h5 class="qr-more">
<a href="javascript:void(0);">更多客户端</a>
</h5>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="head-wrapper clearfix">
<div class="center-content">
<div class="outlets-logo"></div>
<div class="main-logo"><a href="//www.yohobuy.com/" class="main-link"></a></div>
<ul class="main-nav-list">
{{# navbars}}
<li class="{{type}}">
{{#if ico}}
<a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}} class="menu-ico"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}></a>
{{^}}
<h5 class="name-cn">
<a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}}{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{cn}}</a>
</h5>
<h5 class="name-en">
<a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}}{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{en}}</a>
</h5>
{{/if}}
</li>
{{/ navbars}}
</ul>
<div class="func-area hide">
{{#unless @root.pc.common.disSearchAssociation}}
<ul class="search-suggest"></ul>
{{/unless}}
<ul class="search-suggest-history"></ul>
<div class="search-2016">
<form action="//search.yohobuy.com" method="get" id="search-form">
<input type="hidden" id="defaultsearch" value="{{defaultSearch}}">
<input class="search-key" type="text" name="query" id="query-key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" maxlength="30">
<a class="search-btn" href="javascript:submitSearch();"></a>
</form>
<ul class="search-hot">
{{#hotTerms}}
<li>
<a style="display: block;" href="{{href}}" title="{{content}}"
act="{{href}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}} target="_blank">
<span class="searchvalue">{{content}}</span>
</a>
</li>
{{/hotTerms}}
</ul>
</div>
<div class="go-cart">
<a href="//www.yohobuy.com/cart/cart">
<span class="iconfont ">&#xe600;</span>
{{#unless @root.pc.common.removeCartCount}}
<span class="goods-num-tip hide">0</span>
{{/unless}}
</a>
{{#unless @root.pc.common.disCartHover}}
<div class="mini-cart-wrapper">
<div class="loading-cart">
<h3>加载中,请稍后</h3>
</div>
<div class="empty-cart">
<h3>您的购物车暂无商品</h3>
</div>
</div>
{{/unless}}
</div>
</div>
</div>
</div>
<div class="nav-wrapper clearfix">
<div class="center-content">
{{# subNavGroup}}
<ul class="sub-nav-list {{subType}}">
{{# subNav}}
<li {{#if thirdNav}}class="contain-third"{{/if}}>
<a href="{{link}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{name}}
{{#if isNew}}
<span class="newlogo"></span>
{{/if}}
</a>
{{#if thirdNav}}
<div class="third-nav-wrapper">
<div class="center-content">
<dl class="hide-list hide">
{{# thirdNav}}
<dt>
<h3 class=""><a href="{{link}}"{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{title}}</a></h3>
</dt>
{{#brandItems}}
<dd>
<a href="{{link}}"{{#if hot}}
class="hot"{{/if}}{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}>{{brandName}}</a>
</dd>
{{/brandItems}}
{{/thirdNav}}
</dl>
<div class="show-detail" data-code="{{imgCode}}">
<a{{#if @root.pageNoFollow}} rel="nofollow"{{/if}}><img src="data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=="></a>
<a class="title">热门小物优选</a>
</div>
</div>
</div>
{{/if}}
</li>
{{/ subNav}}
</ul>
{{/ subNavGroup}}
</div>
</div>
</div>
<div id="hide-template">
<script type="text/html" id="header-login-info-tpl">
<span>Hi~ <a href="\{{usercenter}}" class="nick-name">\{{nickname}}</a></span>
&nbsp;[ <a href="\{{signout}}">退出</a> ]
</script>
<script type="text/html" id="simple-account-info-tpl">
<div class="account-info-header">
<div class="user-img">
\{{#if headIco}}
<img src="\{{headIco}}">
\{{/if}}
</div>
<div class="user-name">
<a href="//www.yohobuy.com/home?t=\{{random}}">\{{profileName}}</a>
</div>
<h4 class="user-level">
VIP: <span>\{{curTitle}}</span>
</h4>
\{{#unless vip3}}
<div class="level-detail">
<div class="level-view-bar">
<div class="text-span">
\{{curYearCost}}/\{{nextVipNeedCost}}
</div>
<p class="\{{#if curYearCostPer}}integrate\{{/if}}" style="width: \{{curYearCostPer}}%;"></p>
</div>
<span>\{{nextVipTitle}}</span>
</div>
\{{/unless}}
</div>
<ul class="account-info-content">
<li>
<a href="//www.yohobuy.com/home/orders?t=\{{timestamp}}">待处理的订单</a>
<span class="right">\{{order}}</span>
</li>
<li>
<a href="//www.yohobuy.com/home/favorite?t=\{{timestamp}}">我的收藏</a>
<span class="right"></span>
</li>
<li>
<a href="//www.yohobuy.com/home/coupons?t=\{{timestamp}}">我的优惠券</a>
<span class="right">\{{coupon}}</span>
</li>
<li>
<a href="//www.yohobuy.com/home/currency?t=\{{timestamp}}">我的有货币</a>
<span class="right">\{{coin}}</span>
</li>
<li>
<a href="//www.yohobuy.com/home/returns?t=\{{timestamp}}">我的退货换货</a>
<span class="right">\{{return}}</span>
</li>
</ul>
<div class="account-info-footer">
<a href="//www.yohobuy.com/home/user?t=\{{timestamp}}">完善资料
{{#unless @root.pc.user.removeStudentIdentification}}
<span>(学生认证)</span>
{{/unless}}
</a>
</div>
</script>
<script type="text/html" id="search-suggest-tml">
\{{#data}}
<li>
<a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"
act="\{{href}}">
<span class="searchvalue">\{{keyword}}</span>
<span class="valuenum">约\{{count}}个商品</span>
</a>
</li>
\{{/data}}
</script>
<script type="text/html" id="search-suggest-history">
\{{#if data}}<p class="search-suggest-title">最近搜过<a class="search-del" href="#">清空</a></p>
\{{#data}}
<li>
<a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"
act="\{{href}}">
<span class="searchvalue">\{{keyword}}</span>
</a>
</li>
\{{/data}}
\{{/if}}
</script>
</div>
<input id="api-domain" type="hidden" value="{{apiDomain}}">
<div class="code-down-box">
<div class="code-img"></div>
<h5 class="code-title">下载手机客户端</h5>
<i class="iconfont icon-del"></i>
</div>
{{/ headerData}}
\ No newline at end of file
... ...
{
"name": "yohobuy-node",
"version": "5.9.94",
"version": "5.9.92",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -55,8 +55,9 @@
"urlencode": "^1.1.0",
"uuid": "^2.0.2",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "=0.5.14",
"yoho-zookeeper": "^1.0.8"
"yoho-node-lib": "=0.5.16",
"yoho-zookeeper": "^1.0.8",
"handlebars": "4.0.5"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
... ...
... ... @@ -1075,7 +1075,9 @@ giftCard.init();
refund.init();
// 获取用户是否新客(品众统计)写cookie
$.ajax({type: 'GET', url: '/home/newuser'});
if (!window.cookie('__NEW_USER').length) {
$.ajax({type: 'GET', url: '/home/newuser'});
}
// 订单确认页默认埋点
yas.givePoint('YB_SC_ORDER_ENSURE');
... ...
... ... @@ -85,20 +85,6 @@ if (window.cookie('__NEW_USER')) {
});
}
// if (window.cookie('_UID')) {
// // 判断是否有新人专享
// $.ajax({
// type: 'GET',
// url: '/channel/isNewUserAjax',
// data: {},
// success: function(res) {
// if (!res.isNewUser) {
// $('.new-user').addClass('hide');
// }
// }
// });
// }
if (mChannel !== '') {
/** ***** 埋点 *******/
// banner埋点
... ...
... ... @@ -9,8 +9,9 @@ var $ = require('yoho-jquery'),
var limitTime = [];
var $saleBox = $('.sale-box'),
$navItem = $('.sale-nav li');
var $navItem = $('.sale-nav li');
var htmlCache = {};
require('../common');
require('./sale/banner');
... ... @@ -25,7 +26,7 @@ lazyLoad($('img.lazy'));
$('.slide-container').slider();
// 请求带导航的列表数据
function getNaviData(items) {
function getNaviData(items, refresh) {
var location, url, goodItems, navTitle;
navTitle = items.attr('urlLocation');
... ... @@ -35,15 +36,28 @@ function getNaviData(items) {
goodItems = items.parent().parent('.sale-box').find('.goods');
url = location + navTitle;
if (refresh) {
url += '&refresh=' + true;
}
// 本地有缓存数据,则取本地数据
if (htmlCache[url]) {
goodItems.html(htmlCache[url]);
lazyLoad(items.closest('.sale-box').find('.lazy'));
return;
}
$.ajax({
type: 'GET',
url: url,
data: ''
}).then(function(res) {
goodItems.html('');
goodItems.append(res);
lazyLoad(items.closest('.sale-box').find('.lazy'));
if (res) {
htmlCache[url] = res;
goodItems.html(res);
lazyLoad(items.closest('.sale-box').find('.lazy'));
}
});
}
... ... @@ -52,21 +66,15 @@ $navItem.on('click', function() {
$(this).addClass('active');
getNaviData($(this));
});
// 初始化页面数据
(function() {
$saleBox.each(function() {
var item = $(this).find($navItem).eq(0);
getNaviData(item);
});
if (window.cookie('_UID')) {
getNaviData($('.sale-vip-box .sale-nav li').eq(0), true);
}
}());
function convertTime(time) {
var anHour = 3600000,
aMinute = 60000,
... ...