Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
徐炜
8 years ago
Commit
dd1cf6e87920da4984ee91f81128758d4dd648cd
1 parent
609787f8
商品列表页优化
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
13 deletions
apps/product/controllers/list.js
apps/product/controllers/search.js
apps/product/views/action/search/goods-list.hbs
doraemon/views/partial/common/goods.hbs
apps/product/controllers/list.js
View file @
dd1cf6e
...
...
@@ -13,6 +13,7 @@ const _ = require('lodash');
const
crypto
=
global
.
yoho
.
crypto
;
const
helpers
=
global
.
yoho
.
helpers
;
const
productProcess
=
require
(
`
$
{
utils
}
/product-process`
)
;
const
searchModel
=
require
(
`
$
{
mRoot
}
/search`
)
;
/**
* 从 useragent 获取 uid
...
...
@@ -211,19 +212,24 @@ const shopFav = (req, res) => {
};
// 品类落地页
const
category
=
(
req
,
res
)
=>
{
const
category
=
(
req
,
res
,
next
)
=>
{
let
params
=
Object
.
assign
({},
req
.
query
);
res
.
render
(
'search/goods-list'
,
{
module
:
'product'
,
page
:
'search-list'
,
pageHeader
:
headerModel
.
setNav
({
navTitle
:
req
.
query
.
title
||
req
.
query
.
sort_name
}),
goodList
:
params
,
showDownloadApp
:
true
,
pageFooter
:
true
});
// 获取第一页数据
searchModel
.
getSearchData
(
Object
.
assign
({
page
:
1
,
limit
:
6
},
params
)).
then
((
firstPageGoodsList
)
=>
{
res
.
render
(
'search/goods-list'
,
{
_noLazy
:
true
,
// 首屏不使用lazyload
module
:
'product'
,
page
:
'search-list'
,
pageHeader
:
headerModel
.
setNav
({
navTitle
:
req
.
query
.
title
||
req
.
query
.
sort_name
}),
goodList
:
params
,
firstPageGoodsList
:
firstPageGoodsList
,
showDownloadApp
:
true
,
pageFooter
:
true
});
}).
catch
(
next
);
};
/**
...
...
apps/product/controllers/search.js
View file @
dd1cf6e
...
...
@@ -132,6 +132,7 @@ const list = (req, res, next) => {
*/
const
index
=
(
req
,
res
,
next
)
=>
{
let
title
=
'搜索'
;
((
render
)
=>
{
if
(
_
.
get
(
req
,
'app.locals.wap.search.removeHotSearch'
,
false
))
{
render
([]);
...
...
apps/product/views/action/search/goods-list.hbs
View file @
dd1cf6e
<div
class=
"good-list-page yoho-page"
>
{{#
firstPageGoodsList
}}
{{>
common
/
goods
}}
{{/
firstPageGoodsList
}}
{{>
search
/
list
}}
</div>
...
...
doraemon/views/partial/common/goods.hbs
View file @
dd1cf6e
{{#if
this
}}
{{!-- 剔除值为false的项 --}}
<div
class=
"good-info
{{#if
@root
.
sale_vip_login
}}
sale-vip
{{/if}}
"
data-good-id=
"
{{
product_id
}}
"
data-id=
"
{{
product_skn
}}
"
data-bp-id=
"guang_goodList_
{{
product_name
}}
_false"
>
<div
class=
"good-info
{{#if
@root
.
sale_vip_login
}}
sale-vip
{{/if}}
"
data-good-id=
"
{{
product_id
}}
"
data-id=
"
{{
product_skn
}}
"
data-bp-id=
"guang_goodList_
{{
product_name
}}
_false"
>
<div
class=
"tag-container clearfix"
>
{{#
tags
}}
{{#
is_new
}}
...
...
@@ -27,7 +28,11 @@
</div>
<div
class=
"good-detail-img"
>
<a
class=
"good-thumb"
href=
"
{{
url
}}
"
>
<img
class=
"lazy"
data-original=
"
{{
image
default_images
235
314
}}
"
>
{{#if
@root
.
_noLazy
}}
<img
src=
"
{{
image
default_images
235
314
}}
"
width=
"470"
height=
"628"
/>
{{else}}
<img
class=
"lazy"
data-original=
"
{{
image
default_images
235
314
}}
"
/>
{{/if}}
</a>
{{#
is_soon_sold_out
}}
<p
class=
"few-tag"
>
即将售罄
</p>
...
...
Please
register
or
login
to post a comment