guang-new.js
956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const mRoot = '../models';
const newGuangModel = require(`${mRoot}/guang-new`);
const headerModel = require('../../../doraemon/models/header'); // 头部model
const typeLib = require('../../../config/type-lib');
const channels = {
boys: 1,
girl: 2,
kids: 3,
lifestyle: 4
};
exports.index = (req, res, next) => {
let responseData = {
pageHeader: headerModel.setNav({
navTitle: '逛'
}),
title: '逛',
module: 'guang',
page: 'guang-new',
width750: true,
localCss: true
};
let params = {
gender: req.query.gender ||
req.query.channel && typeLib.channels[req.query.channel] ||
req.cookies._Channel && channels[req.cookies._Channel] ||
'1,3',
};
req.ctx(newGuangModel).index(params).then(result => {
res.render('guang-new', Object.assign(responseData, result));
}).catch(next);
};