Merge remote-tracking branch 'origin/master' into release/5.8.1
Showing
6 changed files
with
44 additions
and
2 deletions
@@ -196,6 +196,7 @@ try { | @@ -196,6 +196,7 @@ try { | ||
196 | const layoutTools = require('./doraemon/middleware/layout-tools'); | 196 | const layoutTools = require('./doraemon/middleware/layout-tools'); |
197 | const seo = require('./doraemon/middleware/seo'); | 197 | const seo = require('./doraemon/middleware/seo'); |
198 | const pageCache = require('./doraemon/middleware/page-cache'); | 198 | const pageCache = require('./doraemon/middleware/page-cache'); |
199 | + const downloadBar = require('./doraemon/middleware/download-bar'); | ||
199 | 200 | ||
200 | // YOHO 前置中间件 | 201 | // YOHO 前置中间件 |
201 | app.use(tdkUrl()); | 202 | app.use(tdkUrl()); |
@@ -213,8 +214,9 @@ try { | @@ -213,8 +214,9 @@ try { | ||
213 | } | 214 | } |
214 | 215 | ||
215 | app.use(layoutTools()); | 216 | app.use(layoutTools()); |
216 | - | ||
217 | app.use(pageCache()); | 217 | app.use(pageCache()); |
218 | + app.use(downloadBar()); | ||
219 | + | ||
218 | require('./dispatch')(app); | 220 | require('./dispatch')(app); |
219 | app.all('*', errorHanlder.notFound()); // 404 | 221 | app.all('*', errorHanlder.notFound()); // 404 |
220 | 222 |
@@ -162,6 +162,13 @@ const getShopIntro = (shopId, uid) => { | @@ -162,6 +162,13 @@ const getShopIntro = (shopId, uid) => { | ||
162 | } | 162 | } |
163 | 163 | ||
164 | return api.get('', params, {code: 200}).then(result => { | 164 | return api.get('', params, {code: 200}).then(result => { |
165 | + if (result && result.data) { | ||
166 | + const imgReg = /<img [^>]*src=['"]([^'"]+)[^>]*>/gi; | ||
167 | + | ||
168 | + result.data.shop_intro = (result.data.shop_intro || '').replace(imgReg, function(match, url) { | ||
169 | + return match.replace(url, url.replace('http:', '')); | ||
170 | + }); | ||
171 | + } | ||
165 | return result && result.data; | 172 | return result && result.data; |
166 | }); | 173 | }); |
167 | }; | 174 | }; |
doraemon/middleware/download-bar.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +module.exports = () => { | ||
4 | + return (req, res, next) => { | ||
5 | + if (req.query.nodownload) { | ||
6 | + res.cookie('nodownload', 'true', { | ||
7 | + domain: 'm.yohobuy.com', | ||
8 | + expires: new Date(Date.now() + 24 * 3600 * 1000) | ||
9 | + }); | ||
10 | + } | ||
11 | + | ||
12 | + if (req.query.nogoback) { | ||
13 | + res.cookie('nogoback', 'true', { | ||
14 | + domain: 'm.yohobuy.com', | ||
15 | + expires: new Date(Date.now() + 24 * 3600 * 1000) | ||
16 | + }); | ||
17 | + } | ||
18 | + | ||
19 | + if (req.query.nodownload || req.cookies.nodownload) { | ||
20 | + res.locals.nodownload = true; | ||
21 | + } | ||
22 | + | ||
23 | + if (req.query.nogoback || req.cookies.nogoback) { | ||
24 | + res.locals.nogoback = true; | ||
25 | + } | ||
26 | + | ||
27 | + next(); | ||
28 | + }; | ||
29 | +}; |
@@ -79,6 +79,9 @@ | @@ -79,6 +79,9 @@ | ||
79 | </div> | 79 | </div> |
80 | 80 | ||
81 | {{> download-app}} | 81 | {{> download-app}} |
82 | + {{#if nodownload}} | ||
83 | + <input type="hidden" id="no-download" value="no-download"> | ||
84 | + {{/if}} | ||
82 | {{#ifand isProduction wap.open.bughd}} | 85 | {{#ifand isProduction wap.open.bughd}} |
83 | <script type="text/javascript" src="//cdn.yoho.cn/tool/bj-report-tryjs.min.js?t={{startTime}}" crossOrigin="anonymous"></script> | 86 | <script type="text/javascript" src="//cdn.yoho.cn/tool/bj-report-tryjs.min.js?t={{startTime}}" crossOrigin="anonymous"></script> |
84 | <script type="text/javascript"> | 87 | <script type="text/javascript"> |
@@ -4,9 +4,11 @@ | @@ -4,9 +4,11 @@ | ||
4 | {{^}} | 4 | {{^}} |
5 | <header id="yoho-header" class="yoho-header"> | 5 | <header id="yoho-header" class="yoho-header"> |
6 | {{/ @root.pageChannel}} | 6 | {{/ @root.pageChannel}} |
7 | + {{#unless @root.nogoback}} | ||
7 | {{#navBack}} | 8 | {{#navBack}} |
8 | <a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back"></a> | 9 | <a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back"></a> |
9 | {{/navBack}} | 10 | {{/navBack}} |
11 | + {{/unless}} | ||
10 | {{#navBtn}} | 12 | {{#navBtn}} |
11 | <span class="iconfont nav-home"></span> | 13 | <span class="iconfont nav-home"></span> |
12 | {{/navBtn}} | 14 | {{/navBtn}} |
@@ -4,7 +4,6 @@ Disallow: /passport | @@ -4,7 +4,6 @@ Disallow: /passport | ||
4 | Disallow: /cart | 4 | Disallow: /cart |
5 | Disallow: /home/ | 5 | Disallow: /home/ |
6 | Disallow: /service/ | 6 | Disallow: /service/ |
7 | -Disallow: /passport | ||
8 | Disallow: /3party | 7 | Disallow: /3party |
9 | Disallow: /api | 8 | Disallow: /api |
10 | Disallow: /hf | 9 | Disallow: /hf |
-
Please register or login to post a comment