Authored by 王水玲

error 页面

@@ -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 };
1 -404 1 +<div class="err-page yoho-page">
  2 + <div class="err-bg"></div>
  3 +</div>
1 -500 1 +<div class="err-page yoho-page">
  2 + <div class="err-bg"></div>
  3 +</div>
@@ -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>
1 {{#pageFooter}} 1 {{#pageFooter}}
2 -<footer id="yoho-footer" class="yoho-footer"> 2 +<footer id="yoho-footer" class="yoho-footer {{#isErr}}bottom{{/isErr}}">
3 <p class="op-row"> 3 <p class="op-row">
4 <span class="back-to-top"> 4 <span class="back-to-top">
5 Back to top 5 Back to top
  1 +require('../common');
  1 +.err-page {
  2 + .err-bg {
  3 + position: fixed;
  4 + height: 5rem;
  5 + width: 5rem;
  6 + top: 50%;
  7 + left: 50%;
  8 + margin-left: -2.5rem;
  9 + margin-top: -2.5rem;
  10 + background: url('/common/404.png') no-repeat;
  11 + background-size: 100% 100%;
  12 + }
  13 +}
1 @import "good"; 1 @import "good";
2 @import "filter"; 2 @import "filter";
3 @import "suspend-cart"; 3 @import "suspend-cart";
  4 +@import "error";