Authored by 毕凯

Merge remote-tracking branch 'origin/master' into release/5.8.1

... ... @@ -196,6 +196,7 @@ try {
const layoutTools = require('./doraemon/middleware/layout-tools');
const seo = require('./doraemon/middleware/seo');
const pageCache = require('./doraemon/middleware/page-cache');
const downloadBar = require('./doraemon/middleware/download-bar');
// YOHO 前置中间件
app.use(tdkUrl());
... ... @@ -213,8 +214,9 @@ try {
}
app.use(layoutTools());
app.use(pageCache());
app.use(downloadBar());
require('./dispatch')(app);
app.all('*', errorHanlder.notFound()); // 404
... ...
... ... @@ -162,6 +162,13 @@ const getShopIntro = (shopId, uid) => {
}
return api.get('', params, {code: 200}).then(result => {
if (result && result.data) {
const imgReg = /<img [^>]*src=['"]([^'"]+)[^>]*>/gi;
result.data.shop_intro = (result.data.shop_intro || '').replace(imgReg, function(match, url) {
return match.replace(url, url.replace('http:', ''));
});
}
return result && result.data;
});
};
... ...
'use strict';
module.exports = () => {
return (req, res, next) => {
if (req.query.nodownload) {
res.cookie('nodownload', 'true', {
domain: 'm.yohobuy.com',
expires: new Date(Date.now() + 24 * 3600 * 1000)
});
}
if (req.query.nogoback) {
res.cookie('nogoback', 'true', {
domain: 'm.yohobuy.com',
expires: new Date(Date.now() + 24 * 3600 * 1000)
});
}
if (req.query.nodownload || req.cookies.nodownload) {
res.locals.nodownload = true;
}
if (req.query.nogoback || req.cookies.nogoback) {
res.locals.nogoback = true;
}
next();
};
};
... ...
... ... @@ -79,6 +79,9 @@
</div>
{{> download-app}}
{{#if nodownload}}
<input type="hidden" id="no-download" value="no-download">
{{/if}}
{{#ifand isProduction wap.open.bughd}}
<script type="text/javascript" src="//cdn.yoho.cn/tool/bj-report-tryjs.min.js?t={{startTime}}" crossOrigin="anonymous"></script>
<script type="text/javascript">
... ...
... ... @@ -4,9 +4,11 @@
{{^}}
<header id="yoho-header" class="yoho-header">
{{/ @root.pageChannel}}
{{#unless @root.nogoback}}
{{#navBack}}
<a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a>
{{/navBack}}
{{/unless}}
{{#navBtn}}
<span class="iconfont nav-home">&#xe638;</span>
{{/navBtn}}
... ...
... ... @@ -4,7 +4,6 @@ Disallow: /passport
Disallow: /cart
Disallow: /home/
Disallow: /service/
Disallow: /passport
Disallow: /3party
Disallow: /api
Disallow: /hf
... ...