header.js 930 Bytes
/**
 * router of sub app guang
 * @author: biao<bill.zhao@yoho.cn>
 * @date: 2016/05/12
 */

'use strict';

const _ = require('lodash');

// const getChannle = () => ('kids');

/**
 * 设置头部
 * @param {String} title 标题
 * @param {Boolen} channel 频道
 * @param {Boolen} backUrl 返回的url
 * @param {Boolen} navBtn 是否显示导航
 * @param {Boolen} navBack 是否显示返回箭头
 */
exports.setNavHeader = (title, channel, navBack, backUrl, navBtn) => {
    let header = {
        navTitle: title,
        backUrl: backUrl,
        navBack: navBack,
        navBtn: navBtn
    };

    header[channel] = true;

    return _.merge({
        navTitle: '',
        backUrl: true,
        navBack: '',
        navBtn: {
            indexUrl: '/?go=1',
            categoryUrl: '/cate',
            shoppingCartUrl: '/cart/index/index',
            mineUrl: '/home'
        },
        boys: true
    }, header);
};