Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
6cc83aefcdba378d7bb817f82242c897257994f3
2 parents
9b48d399
7f704891
Merge branch 'feature/me-navigation' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
45 deletions
apps/me/controllers/order.js
apps/me/models/menu-crumb-handler.js
apps/me/controllers/order.js
View file @
6cc83ae
...
...
@@ -6,6 +6,8 @@
'use strict'
;
const
mcHandler
=
require
(
'../models/menu-crumb-handler'
);
/**
* 订单
*/
...
...
@@ -15,51 +17,8 @@ const index = (req, res) => {
page
:
'order'
,
isMe
:
true
,
content
:
{
nav
:
[
{
link
:
'//www.yohoblk.com'
,
name
:
'YOHO!BLK首页'
},
{
link
:
'//www.yohoblk.com/me'
,
name
:
'个人中心'
},
{
link
:
'//www.yohoblk.com/me'
,
name
:
'我的订单'
}
],
navigation
:
[
{
focus
:
true
,
link
:
'/me/order'
,
name
:
'我的订单'
},
{
link
:
'/me/return'
,
name
:
'我的退/换货'
},
{
link
:
'/me/collection'
,
name
:
'我的收藏'
},
{
link
:
'/me/message'
,
name
:
'我的消息'
},
{
link
:
'/me/currency'
,
name
:
'我的YOHO币'
},
{
link
:
'/me/setting'
,
name
:
'个人设置'
},
{
link
:
'/me/address'
,
name
:
'收货地址'
}
],
nav
:
mcHandler
.
getMeCrumb
(),
navigation
:
mcHandler
.
getSideMenu
(
'我的订单'
),
banner
:
'http://placehold.it/150x120'
}
});
...
...
apps/me/models/menu-crumb-handler.js
0 → 100644
View file @
6cc83ae
/**
* 个人中心布局(顶部面包屑和左侧导航)
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/7/5
*/
'use strict'
;
const
_
=
require
(
'lodash'
);
const
blk
=
global
.
yoho
;
const
url
=
blk
.
helpers
.
urlFormat
;
// 左侧菜单
const
navigation
=
[
{
link
:
url
(
'/me/order'
),
name
:
'我的订单'
},
{
link
:
url
(
'/me/return'
),
name
:
'我的退/换货'
},
{
link
:
url
(
'/me/collection'
),
name
:
'我的收藏'
},
{
link
:
url
(
'/me/message'
),
name
:
'我的消息'
},
{
link
:
url
(
'/me/currency'
),
name
:
'我的YOHO币'
},
{
link
:
url
(
'/me/setting'
),
name
:
'个人设置'
},
{
link
:
url
(
'/me/address'
),
name
:
'收货地址'
}
];
// 头部导航面包屑
const
getMeCrumb
=
name
=>
{
return
[
{
link
:
blk
.
config
.
sitUrl
,
name
:
'YOHO!BLK首页'
},
{
link
:
url
(
'/me'
),
name
:
'个人中心'
},
{
name
:
name
?
name
:
'我的订单'
}
];
};
// 侧栏菜单
const
getSideMenu
=
focus
=>
{
let
copiedNav
=
_
.
cloneDeep
(
navigation
);
if
(
focus
&&
_
.
some
(
copiedNav
,
{
name
:
focus
}))
{
Object
.
assign
(
_
.
find
(
copiedNav
,
{
name
:
focus
}),
{
focus
:
true
});
}
else
{
// 若没有传focus || focus不在navigation中,则默认focus第1个菜单
copiedNav
[
0
].
focus
=
true
;
}
return
copiedNav
;
};
module
.
exports
=
{
getMeCrumb
,
getSideMenu
};
...
...
Please
register
or
login
to post a comment