Showing
10 changed files
with
48 additions
and
8 deletions
@@ -2,15 +2,26 @@ | @@ -2,15 +2,26 @@ | ||
2 | * 404 错误 | 2 | * 404 错误 |
3 | * @return {[type]} | 3 | * @return {[type]} |
4 | */ | 4 | */ |
5 | +const headerModel = require('../models/header'); | ||
6 | + | ||
5 | exports.notFound = () => { | 7 | exports.notFound = () => { |
6 | return (req, res) => { | 8 | return (req, res) => { |
7 | if (req.xhr) { | 9 | if (req.xhr) { |
8 | return res.status(404).json({ | 10 | return res.status(404).json({ |
9 | code: 404, | 11 | code: 404, |
10 | - message: '页面不存在' | 12 | + message: '抱歉,页面不存在!' |
11 | }); | 13 | }); |
12 | } | 14 | } |
13 | - return res.render('error/404'); | 15 | + return res.render('error/404', { |
16 | + module: 'common', | ||
17 | + page: 'error', | ||
18 | + title: '页面不存在 | Yoho!Buy有货 | 潮流购物逛不停', | ||
19 | + pageHeader: headerModel.setNav({ | ||
20 | + navTitle: '抱歉,页面不存在!' | ||
21 | + }), | ||
22 | + pageFooter: true, | ||
23 | + isErr: true | ||
24 | + }); | ||
14 | }; | 25 | }; |
15 | }; | 26 | }; |
16 | 27 | ||
@@ -24,11 +35,21 @@ exports.serverError = () => { | @@ -24,11 +35,21 @@ exports.serverError = () => { | ||
24 | if (req.xhr) { | 35 | if (req.xhr) { |
25 | return res.status(500).json({ | 36 | return res.status(500).json({ |
26 | code: 500, | 37 | code: 500, |
27 | - message: '服务器错误' | 38 | + message: '服务器错误!' |
28 | }); | 39 | }); |
29 | } | 40 | } |
30 | 41 | ||
31 | - return res.render('error/500', err); | 42 | + return res.render('error/500', { |
43 | + err: err, | ||
44 | + module: 'common', | ||
45 | + page: 'error', | ||
46 | + title: '服务器错误 | Yoho!Buy有货 | 潮流购物逛不停', | ||
47 | + pageHeader: headerModel.setNav({ | ||
48 | + navTitle: '服务器错误!' | ||
49 | + }), | ||
50 | + pageFooter: true, | ||
51 | + isErr: true | ||
52 | + }); | ||
32 | } | 53 | } |
33 | next(err); | 54 | next(err); |
34 | }; | 55 | }; |
@@ -17,7 +17,6 @@ | @@ -17,7 +17,6 @@ | ||
17 | <script type="text/javascript"> | 17 | <script type="text/javascript"> |
18 | (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); | 18 | (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); |
19 | </script> | 19 | </script> |
20 | - <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script> | ||
21 | {{#if devEnv}} | 20 | {{#if devEnv}} |
22 | <link rel="stylesheet" href="//localhost:5001/css/index.css"> | 21 | <link rel="stylesheet" href="//localhost:5001/css/index.css"> |
23 | {{^}} | 22 | {{^}} |
@@ -38,6 +37,7 @@ | @@ -38,6 +37,7 @@ | ||
38 | {{> footer}} | 37 | {{> footer}} |
39 | </div> | 38 | </div> |
40 | 39 | ||
40 | + <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script> | ||
41 | {{#if devEnv}} | 41 | {{#if devEnv}} |
42 | <script src="//localhost:5001/libs.js"></script> | 42 | <script src="//localhost:5001/libs.js"></script> |
43 | <script src="//localhost:5001/{{module}}.{{page}}.js"></script> | 43 | <script src="//localhost:5001/{{module}}.{{page}}.js"></script> |
public/img/common/404.png
0 → 100644
46.6 KB
public/img/sprite.common.png
0 → 100644
51.7 KB
public/js/common/error.page.js
0 → 100644
1 | +require('../common'); |
public/scss/common/_error.css
0 → 100644
-
Please register or login to post a comment