Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
24457a16eafe40380371c50de6fb7cc7747e4277
1 parent
9d249d3c
产品大全
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
118 additions
and
10 deletions
apps/about/controllers/about.js
apps/about/models/about.js
apps/about/router.js
apps/about/views/action/chanpin.hbs
public/scss/about/_chanpin.css
public/scss/about/_index.css
apps/about/controllers/about.js
View file @
24457a1
...
...
@@ -77,15 +77,12 @@ const link = (req, res, next) => {
*/
const
category
=
(
req
,
res
,
next
)
=>
{
let
channel
=
req
.
yoho
.
channel
||
'boys'
;
let
resData
=
{};
return
Promise
.
all
([
headerModel
.
requestHeaderData
(
channel
),
req
.
ctx
(
aboutModel
).
getCategoryDataWithCache
(
channel
)
]).
then
(
result
=>
{
Object
.
assign
(
resData
,
responseData
,
result
[
0
],
result
[
1
]);
res
.
render
(
'category'
,
resData
);
res
.
render
(
'category'
,
Object
.
assign
(
result
[
1
],
responseData
,
result
[
0
]));
}).
catch
(
next
);
};
...
...
@@ -95,10 +92,11 @@ const category = (req, res, next) => {
const
chanpin
=
(
req
,
res
,
next
)
=>
{
let
channel
=
req
.
yoho
.
channel
||
'boys'
;
headerModel
.
requestHeaderData
(
channel
).
then
(
result
=>
{
responseData
.
headerData
=
result
.
headerData
;
res
.
render
(
'chanpin'
,
responseData
);
return
Promise
.
all
([
headerModel
.
requestHeaderData
(
channel
),
req
.
ctx
(
aboutModel
).
getChanpinData
(
channel
)
]).
then
(
result
=>
{
res
.
render
(
'chanpin'
,
Object
.
assign
(
result
[
1
],
responseData
,
result
[
0
]));
}).
catch
(
next
);
};
...
...
apps/about/models/about.js
View file @
24457a1
...
...
@@ -3,6 +3,7 @@ const _ = require('lodash');
const
cache
=
global
.
yoho
.
cache
;
const
logger
=
global
.
yoho
.
logger
;
const
helpers
=
global
.
yoho
.
helpers
;
const
redis
=
global
.
yoho
.
redis
;
const
hotBrandsModel
=
require
(
'../../../doraemon/models/hot-brands'
);
...
...
@@ -118,7 +119,30 @@ module.exports = class extends global.yoho.BaseModel {
});
}
getChanpinData
()
{
getChanpinData
(
channel
)
{
return
Promise
.
all
([
redis
.
all
([[
'get'
,
'global:yoho:seo:goodsAll'
]]),
hotBrandsModel
.
hotBrands
()
]).
then
(
result
=>
{
let
upChannel
=
_
.
toUpper
(
channel
);
let
chanpinList
=
[];
try
{
chanpinList
=
JSON
.
parse
(
_
.
get
(
result
,
'[0][0]'
));
}
catch
(
e
)
{
logger
.
debug
(
'chanpin all goods data parse fail.'
);
}
return
{
pathNav
:
[
{
pathTitle
:
`
$
{
upChannel
}
首页`
,
name
:
`
$
{
upChannel
}
首页`
,
href
:
indexUrl
[
channel
]},
{
pathTitle
:
'全部分类'
,
name
:
'全部分类'
}
],
hotBrands
:
result
[
1
],
chanpinList
};
});
}
};
...
...
apps/about/router.js
View file @
24457a1
...
...
@@ -14,7 +14,7 @@ router.get('/contact.html', aboutCtrl.contact);
router
.
get
(
'/privacy.html'
,
aboutCtrl
.
privacy
);
router
.
get
(
'/link.html'
,
aboutCtrl
.
link
);
router
.
get
(
'/categorymap.html'
,
aboutCtrl
.
category
);
router
.
get
(
'/chanpinmap.html'
,
aboutCtrl
.
link
);
router
.
get
(
'/chanpinmap.html'
,
aboutCtrl
.
chanpin
);
module
.
exports
=
router
;
...
...
apps/about/views/action/chanpin.hbs
View file @
24457a1
<div
class=
"chanpin-map-page center-content yoho-page"
>
{{>
common
/
path-nav
}}
<div
class=
"chanpin-block"
>
<h1
class=
"main-title"
>
商品大全
</h1>
<ul
class=
"list-block clearfix"
>
{{#
chanpinList
}}
<li><a
href=
"/chanpin/
{{
id
}}
.html"
>
{{
keyword
}}
</a></li>
{{/
chanpinList
}}
</ul>
</div>
{{#if
hotBrands
}}
<div
class=
"hot-brands clearfix"
>
{{#
hotBrands
}}
<a
href=
"
{{
url
}}
"
alt=
"
{{
title
}}
"
>
<img
src=
"
{{
image
image
}}
"
title=
"
{{
title
}}
"
>
</a>
{{/
hotBrands
}}
</div>
{{/if}}
</div>
...
...
public/scss/about/_chanpin.css
0 → 100644
View file @
24457a1
.chanpin-map-page
{
.path-nav
{
padding
:
22px
0
;
}
.chanpin-block
{
font-size
:
12px
;
border
:
1px
solid
#dfdfdf
;
margin-bottom
:
30px
;
overflow
:
hidden
;
.main-title
{
line-height
:
50px
;
background-color
:
#eaeceb
;
padding-left
:
20px
;
font-weight
:
bold
;
}
}
.list-block
{
width
:
100.5%
;
margin-bottom
:
-1px
;
li
{
width
:
25%
;
height
:
50px
;
line-height
:
50px
;
border
:
1px
solid
#dfdfdf
;
margin-left
:
-1px
;
margin-top
:
-1px
;
text-align
:
center
;
float
:
left
;
box-sizing
:
border-box
;
}
a
{
color
:
#666
;
}
}
.hot-brands
{
width
:
101%
;
margin-bottom
:
70px
;
>
a
{
width
:
116px
;
height
:
70px
;
display
:
block
;
padding
:
10px
8px
;
float
:
left
;
box-sizing
:
border-box
;
border
:
1px
solid
#dfdfdf
;
margin-left
:
-1px
;
margin-top
:
-1px
;
}
img
{
width
:
100%
;
height
:
100%
;
display
:
block
;
}
}
}
...
...
public/scss/about/_index.css
View file @
24457a1
...
...
@@ -5,3 +5,4 @@
@import
"link"
;
@import
"privacy"
;
@import
"category"
;
@import
"chanpin"
;
...
...
Please
register
or
login
to post a comment