Authored by 王水玲

error 页面

... ... @@ -2,15 +2,26 @@
* 404 错误
* @return {[type]}
*/
const headerModel = require('../models/header');
exports.notFound = () => {
return (req, res) => {
if (req.xhr) {
return res.status(404).json({
code: 404,
message: '页面不存在'
message: '抱歉,页面不存在!'
});
}
return res.render('error/404');
return res.render('error/404', {
module: 'common',
page: 'error',
title: '页面不存在 | Yoho!Buy有货 | 潮流购物逛不停',
pageHeader: headerModel.setNav({
navTitle: '抱歉,页面不存在!'
}),
pageFooter: true,
isErr: true
});
};
};
... ... @@ -24,11 +35,21 @@ exports.serverError = () => {
if (req.xhr) {
return res.status(500).json({
code: 500,
message: '服务器错误'
message: '服务器错误'
});
}
return res.render('error/500', err);
return res.render('error/500', {
err: err,
module: 'common',
page: 'error',
title: '服务器错误 | Yoho!Buy有货 | 潮流购物逛不停',
pageHeader: headerModel.setNav({
navTitle: '服务器错误!'
}),
pageFooter: true,
isErr: true
});
}
next(err);
};
... ...
404
<div class="err-page yoho-page">
<div class="err-bg"></div>
</div>
\ No newline at end of file
... ...
500
<div class="err-page yoho-page">
<div class="err-bg"></div>
</div>
\ No newline at end of file
... ...
... ... @@ -17,7 +17,6 @@
<script type="text/javascript">
(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);
</script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
{{#if devEnv}}
<link rel="stylesheet" href="//localhost:5001/css/index.css">
{{^}}
... ... @@ -37,7 +36,8 @@
{{{body}}}
{{> footer}}
</div>
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
{{#if devEnv}}
<script src="//localhost:5001/libs.js"></script>
<script src="//localhost:5001/{{module}}.{{page}}.js"></script>
... ...
{{#pageFooter}}
<footer id="yoho-footer" class="yoho-footer">
<footer id="yoho-footer" class="yoho-footer {{#isErr}}bottom{{/isErr}}">
<p class="op-row">
<span class="back-to-top">
Back to top
... ...
require('../common');
... ...
.err-page {
.err-bg {
position: fixed;
height: 5rem;
width: 5rem;
top: 50%;
left: 50%;
margin-left: -2.5rem;
margin-top: -2.5rem;
background: url('/common/404.png') no-repeat;
background-size: 100% 100%;
}
}
... ...
@import "good";
@import "filter";
@import "suspend-cart";
@import "error";
... ...