outlet.js 1.51 KB
/**
 * 频道页面
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */
'use strict';

const outletModel = require('../models/outlet');
const headerModel = require('../../../doraemon/models/header');

const renderData = {
    module: 'product',
    page: 'outlet'
};

exports.index = (req, res) => {
    let channel = req.query.yh_channel || req.cookies._Channel || 'boys';
    let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null);
    let categoryId = req.query.category_id;

    outletModel.getContent(categoryId, channel).then(result => {
        res.render('outlet', Object.assign({
            pageHeader: headerData,
            pageFooter: true
        }, renderData, result));
    });
};

exports.activity = (req, res) => {
    let channel = req.query.channel || req.cookies._Channel || 'boys';
    let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null);

    outletModel.getActivity(req.query.id).then(result => {
        renderData.page = 'outlet-detail';

        res.render('outlet/activity', Object.assign({
            pageHeader: headerData,
            pageFooter: true
        }, renderData, result));
    });
};

exports.willBeEnd = (req, res) => {
    outletModel.willBeEnd().then(result => {
        console.log(result);
        res.render('outlet/will-end', Object.assign(renderData, result));
    });
};

exports.willBeCome = (req, res) => {
    outletModel.willBeCome().then(result => {
        res.render('outlet/will-start', Object.assign(renderData, result));
    });
};