Authored by 沈志敏

blk新品到着 fix bug

@@ -10,15 +10,31 @@ const utils = '../../../utils'; @@ -10,15 +10,31 @@ const utils = '../../../utils';
10 const headerModel = require('../../../doraemon/models/header'); 10 const headerModel = require('../../../doraemon/models/header');
11 const searchProcess = require(`${utils}/search-process`); 11 const searchProcess = require(`${utils}/search-process`);
12 const newModel = require(`${mRoot}/new`); 12 const newModel = require(`${mRoot}/new`);
  13 +const searchModel = require(`${mRoot}/search`);
13 const _ = require('lodash'); 14 const _ = require('lodash');
14 const helpers = global.yoho.helpers; 15 const helpers = global.yoho.helpers;
15 16
16 // 新品到着(blk) 17 // 新品到着(blk)
17 -const blkNewGoods = (req, res) => { 18 +const blkNewGoods = (req, res, next) => {
18 let params = Object.assign({ 19 let params = Object.assign({
19 isblknew: true 20 isblknew: true
20 }, req.query); 21 }, req.query);
21 22
  23 + // 获取第一页数据做服务端渲染
  24 + let uid = req.user.uid || 0;
  25 + let initialData = _.assign({
  26 + gender: req.query.gender || '1,3',
  27 + type: 'default',
  28 + order: '0',
  29 + page: 1,
  30 + limit: 12
  31 + }, params);
  32 +
  33 + if (uid) {
  34 + initialData.uid = uid;
  35 + }
  36 +
  37 + searchModel.getSearchData(initialData).then(firstScreenGoodsList => {
22 res.render('search/goods-list', { 38 res.render('search/goods-list', {
23 module: 'product', 39 module: 'product',
24 page: 'search-list', 40 page: 'search-list',
@@ -26,9 +42,11 @@ const blkNewGoods = (req, res) => { @@ -26,9 +42,11 @@ const blkNewGoods = (req, res) => {
26 navTitle: req.query.title || req.query.sort_name || '新品抢先看' 42 navTitle: req.query.title || req.query.sort_name || '新品抢先看'
27 }), 43 }),
28 goodList: params, 44 goodList: params,
  45 + firstPageGoodsList: firstScreenGoodsList.list,
29 showDownloadApp: true, 46 showDownloadApp: true,
30 pageFooter: true 47 pageFooter: true
31 }); 48 });
  49 + }).catch(next);
32 }; 50 };
33 51
34 // 新品到着 52 // 新品到着