Authored by 陈轩

秒杀简单错误提示

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 const co = require('bluebird').coroutine; 5 const co = require('bluebird').coroutine;
6 const seckillModel = require('../models/seckill'); 6 const seckillModel = require('../models/seckill');
7 const buyNowModel = require('../models/buynow'); 7 const buyNowModel = require('../models/buynow');
  8 +const headerModel = require('../../../doraemon/models/header'); // 头部model
8 9
9 const BAD_REQUEST = '非法请求'; 10 const BAD_REQUEST = '非法请求';
10 11
@@ -61,10 +62,13 @@ exports.ensure = (req, res, next) => { @@ -61,10 +62,13 @@ exports.ensure = (req, res, next) => {
61 }, paymentInfo.data); 62 }, paymentInfo.data);
62 } 63 }
63 64
64 -  
65 // console.log(view); 65 // console.log(view);
66 res.locals.title = '确认订单'; 66 res.locals.title = '确认订单';
67 - res.render('order-ensure', view); 67 + res.render('order-ensure', Object.assign({
  68 + pageHeader: headerModel.setNav({
  69 + navTitle: '确认订单'
  70 + })
  71 + }, view));
68 })().catch(next); 72 })().catch(next);
69 }; 73 };
70 74
@@ -194,6 +194,8 @@ @@ -194,6 +194,8 @@
194 <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}"> 194 <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">
195 {{/with}} 195 {{/with}}
196 {{else}} 196 {{else}}
  197 + <div class="order-ensure-error">
197 {{message}} 198 {{message}}
  199 + </div>
198 {{/if}} 200 {{/if}}
199 </div> 201 </div>
@@ -88,7 +88,11 @@ const index = (req, res, next) => { @@ -88,7 +88,11 @@ const index = (req, res, next) => {
88 resultActivity.data.secKillProductVoList.length 88 resultActivity.data.secKillProductVoList.length
89 ) 89 )
90 ) { 90 ) {
91 - return res.send('来晚啦~秒杀已结束_(:з」∠)_'); 91 + return res.render('seckill', {
  92 + title: '秒杀活动',
  93 + pageHeader: headerData,
  94 + error: '来晚啦~秒杀已结束_(:з」∠)_'
  95 + });
92 } 96 }
93 97
94 result.activitys = resultActivity.data.secKillProductVoList.sort((a, b) => a.startTime > b.startTime); 98 result.activitys = resultActivity.data.secKillProductVoList.sort((a, b) => a.startTime > b.startTime);
1 <div class="seckill-list yoho-page"> 1 <div class="seckill-list yoho-page">
2 - {{> seckill/nav}}  
3 - <div class="product-list">  
4 - {{# products}}  
5 - {{> seckill/product}}  
6 - {{/products}}  
7 - </div> 2 + {{#unless error}}
  3 + {{> seckill/nav}}
  4 + <div class="product-list">
  5 + {{# products}}
  6 + {{> seckill/product}}
  7 + {{/products}}
  8 + </div>
  9 + {{else}}
  10 + <div class="seckill-error">{{error}}</div>
  11 + {{/unless}}
8 <section class="tips"> 12 <section class="tips">
9 <h5>秒杀活动说明</h5> 13 <h5>秒杀活动说明</h5>
10 <ol> 14 <ol>
1 .order-ensure-page { 1 .order-ensure-page {
2 background: #f0f0f0; 2 background: #f0f0f0;
3 3
  4 + .order-ensure-error {
  5 + margin-top: 100px;
  6 + text-align: center;
  7 + background-color: #fff;
  8 + }
  9 +
4 .block { 10 .block {
5 background: #fff; 11 background: #fff;
6 margin: 20px 0; 12 margin: 20px 0;
@@ -15,4 +15,9 @@ @@ -15,4 +15,9 @@
15 list-style: decimal inside; 15 list-style: decimal inside;
16 } 16 }
17 } 17 }
  18 +}
  19 +
  20 +.seckill-error {
  21 + text-align: center;
  22 + margin-top: 150px;
18 } 23 }