Authored by 郝肖肖

Merge branch 'master' into feature/backDown

... ... @@ -37,3 +37,11 @@ exports.index = (req, res, next) => {
}, goodsList));
})().catch(next);
};
// 301到新路由
exports.redirect = (req, res) => {
let redirectUrl = '/mip/chanpin/';
redirectUrl += `${req.params.id}.html`;
res.redirect(301, redirectUrl);
};
... ...
... ... @@ -302,7 +302,7 @@
}
.mip-footer .mip-gototop {
display: inline;
display: inline !important;
}
.list-too-little {
... ...
... ... @@ -60,7 +60,7 @@ class List extends global.yoho.BaseModel {
_.forEach(_.slice(redisData.data, 0, 12), value => {
build.push({
name: value.keyword,
link: helpers.urlFormat(`/mip/list/${value.id}.html`, null)
link: helpers.urlFormat(`/mip/chanpin/${value.id}.html`, null)
});
});
resu.name = redisData.name;
... ...
... ... @@ -20,5 +20,6 @@ router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get('/chanpin/:id.html', chanpin.index);
router.get('/list/:id.html', chanpin.redirect);
module.exports = router;
... ...
... ... @@ -294,20 +294,6 @@ const category = (req, res, next) => {
*/
const listNew = (req, res, next) => {
let params = _.assign({}, req.query);
/* 勿修改,唤起 APP 使用 */
let appParams = _.assign({}, req.query, {
title: req.query.title || req.query.sort_name || '',
productPool: req.query.filter_poolId,
actiontype: req.query.actiontype || '1'
});
delete appParams.filter_poolId;
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' +
JSON.stringify(appParams) +
'}';
let uid = req.user.uid;
// 获取第一页数据做服务端渲染
... ... @@ -372,7 +358,6 @@ const listNew = (req, res, next) => {
firstPageGoods: responseResult || [],
pageFooter: true,
localCss: true,
appPath: appPath,
categoryIntro: categoryIntro
}, seoRenderData));
})().catch(next);
... ...
... ... @@ -583,13 +583,15 @@ const shop = {
params.limit = 24;
req.ctx(searchModel).getShopGoods(params).then((result) => {
if (result.data.product_list && result.data.product_list.length > 0) {
let product_list = productProcess.processProductList(result.data.product_list || [], {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
});
let productList = _.get(result, 'data.product_list', []);
if (productList.length > 0) {
let product_list =
productProcess.processProductList(productList, {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
});
res.render('search/page', {
layout: false,
... ...
... ... @@ -93,7 +93,7 @@ let index = (req, res, next) => {
// 扩展头部频道选择数据
Object.assign(params.renderData.pageHeader, {
saleNav: saleModel.saleNav(params.channel, req.params[0] || !req.query.channel)
saleNav: saleModel.saleNav(params.channel)
});
// 此处 channel 需要读取 cookies 的 channel
... ...
... ... @@ -14,7 +14,6 @@ const processTime = require(`${utils}/time-process`);
const _ = require('lodash');
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
/**
* 排序转换
... ... @@ -46,32 +45,28 @@ const channelType = {
* 产品要求,SALE的导航显示 Boy,Girl 单数形式
*/
const channelHash = {
boys: 'Boy',
girls: 'Girl',
kids: 'Kid',
boys: 'Boys',
girls: 'Girls',
kids: 'Kids',
lifestyle: 'Lifestyle'
};
const saleNav = (channel, shortUrl) => {
const saleNav = (channel) => {
return {
channel: channelHash[channel],
list: [
{
title: 'Boy',
url: shortUrl ? helpers.urlFormat('/product/boys-sale/') :
helpers.urlFormat('/product/sale', {channel: 'boys'})
title: 'Boys',
url: '/boys-sale'
}, {
title: 'Girl',
url: shortUrl ? helpers.urlFormat('/product/girls-sale/') :
helpers.urlFormat('/product/sale', {channel: 'girls'})
title: 'Girls',
url: '/girls-sale'
}, {
title: 'Kid',
url: shortUrl ? helpers.urlFormat('/product/kids-sale/') :
helpers.urlFormat('/product/sale', {channel: 'kids'})
title: 'Kids',
url: '/kids-sale'
}, {
title: 'Lifestyle',
url: shortUrl ? helpers.urlFormat('/product/lifestyle-sale/') :
helpers.urlFormat('/product/sale', {channel: 'lifestyle'})
url: '/lifestyle-sale'
}
]
};
... ...
... ... @@ -22,8 +22,6 @@
<link rel="dns-prefetch" href="{{this}}">
{{/dnsPrefetch.hosts}}
{{> ld-json}}
<script>
{{#ifand isProduction wap.open.bughd}}
window._timeStart = new Date().getTime();
... ... @@ -87,6 +85,8 @@
<link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-x.png" media="screen and (min-device-width: 751px) and (max-device-width: 1125px)">
<link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)">
<link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)">
{{> ld-json}}
</head>
<body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}} installment-body{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}">
<div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}}>
... ... @@ -130,5 +130,8 @@
{{#unless devEnv}}
{{> analysis}}
{{/unless}}
{{# showAnaJson}}
{{#if addBaiduSite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
{{/showAnaJson}}
</body>
</html>
... ...
{{# showAnaJson}}
{{#if addBaiduSite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
... ...
... ... @@ -72,7 +72,7 @@
"xml2js": "^0.4.19",
"yoho-express-session": "^2.0.0",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.6.0",
"yoho-node-lib": "=0.6.1",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
... ...