simple-header.js
1.29 KB
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
39
40
41
42
43
44
45
46
/**
* simple-header model
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/07/06
*/
'use strict';
let helpers = global.yoho.helpers;
/**
* 获取简单头部数据
*/
const setSimpleHeaderData = (user) => {
let time = Date.now();
let simpleHeader = {
logo: {
img: '//static.yohobuy.com/newheader/img/logo_e.png',
url: '//www.yohobuy.com'
},
tool: {
favoriteHref: helpers.urlFormat('/home/favorite', {t: time}), // 我的收藏链接
couponHref: helpers.urlFormat('/home/coupons', {t: time}), // 我的优惠券链接
orderHref: helpers.urlFormat('/home/orders', {t: time}), // 订单中心连接
userCenter: helpers.urlFormat('/home', {t: time}), // 用户中心链接
helpHref: helpers.urlFormat('/help'),
loginHref: helpers.urlFormat('/signin.html'), // 登录链接,已登录不传
registerHref: helpers.urlFormat('/reg.html') // 注册链接,已登录不传
}
};
if (user && user.uid) {
Object.assign(simpleHeader.tool, {
loginHref: false,
registerHref: false,
user: user.name,
isLogin: true
});
}
return simpleHeader;
};
module.exports = {
setSimpleHeaderData
};