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
郭成尧
9 years ago
Commit
97837b222638a40899523e257400645612664f1c
1 parent
deaab503
'shop-category'
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
302 additions
and
4 deletions
apps/product/controllers/list.js
apps/product/models/list.js
apps/product/router.js
apps/product/views/action/shop/category.hbs
apps/product/views/partial/detail/banner-swiper-arrow.hbs
public/img/sprite.product.png
public/js/product/category.page.js
public/scss/product/shop/_index.css
public/scss/product/shop/_product-category.css
apps/product/controllers/list.js
View file @
97837b2
...
...
@@ -351,6 +351,30 @@ const favoriteBrand = (req, res, next) => {
}
};
/**
* 店铺品类页面
* @param req
* @param res
* @param next
*/
const
shopCategory
=
(
req
,
res
,
next
)
=>
{
listModel
.
getShopCategory
({
shopId
:
req
.
query
.
shop_id
,
channel
:
req
.
yoho
.
channel
,
gender
:
req
.
query
.
gender
||
'1,3'
}).
then
(
result
=>
{
res
.
render
(
'shop/category'
,
{
content
:
result
,
module
:
'product'
,
page
:
'category'
,
pageHeader
:
headerModel
.
setNav
({
navTitle
:
'品类'
}),
});
}).
catch
(
next
);
};
module
.
exports
=
{
category
,
brand
,
...
...
@@ -362,4 +386,5 @@ module.exports = {
shopAppCookie
,
shopFav
,
baseShopFav
,
shopCategory
};
...
...
apps/product/models/list.js
View file @
97837b2
...
...
@@ -119,12 +119,13 @@ const _getShopInfo = (shopId, uid) => {
* @param {string} channel 频道
* @return array
*/
const
_getShopCategory
=
(
shopId
,
channel
)
=>
{
const
_getShopCategory
=
(
shopId
,
channel
,
gender
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.shop.getSortInfo'
,
yh_channel
:
channel
,
gender
:
gender
||
'1,3'
,
shop_id
:
shopId
}).
then
(
(
result
)
=>
{
}).
then
(
result
=>
{
if
(
result
&&
result
.
code
===
200
)
{
return
camelCase
(
result
.
data
);
}
else
{
...
...
@@ -652,6 +653,47 @@ const getShopIntro = (shopId) => {
});
};
/**
* 处理店铺品类
* @param params
*/
const
getShopCategory
=
(
params
)
=>
{
let
finalResult
=
{
class
:
[],
category
:
[]
};
return
_getShopCategory
(
params
.
shopId
,
params
.
channel
,
params
.
gender
).
then
(
result
=>
{
let
resultCopy
=
_
.
cloneDeep
(
result
);
_
.
forEach
(
resultCopy
,
value
=>
{
finalResult
.
class
.
push
({
name
:
value
.
categoryName
});
_
.
forEach
(
value
.
sub
,
(
subValue
,
subKey
)
=>
{
value
.
sub
[
subKey
].
url
=
helpers
.
urlFormat
({
shop
:
params
.
shopId
,
categoryId
:
value
.
categoryId
,
subCategoryId
:
subValue
.
categoryId
,
title
:
subValue
.
categoryName
,
query
:
subValue
.
categoryName
});
});
finalResult
.
category
.
push
({
subcategory
:
value
.
sub
});
});
finalResult
.
allproduct
=
helpers
.
urlFormat
(
'/search/list'
,
{
shop_id
:
params
.
shopId
});
return
finalResult
;
});
};
module
.
exports
=
{
getBaseShopData
,
getShopData
,
...
...
@@ -662,5 +704,6 @@ module.exports = {
setFavorite
,
setFavoriteCancel
,
getShopIntro
,
getShopBrands
getShopBrands
,
getShopCategory
};
...
...
apps/product/router.js
View file @
97837b2
...
...
@@ -100,6 +100,7 @@ router.get('/index/brandFav', list.brandFav);
router
.
get
(
'/index/shopAppCookie'
,
list
.
shopAppCookie
);
router
.
get
(
'/index/shopFav'
,
list
.
shopFav
);
router
.
get
(
'/index/baseShopFav'
,
list
.
baseShopFav
);
router
.
get
(
'/index/category'
,
list
.
shopCategory
);
// 店铺介绍
router
.
get
(
'/index/intro'
,
list
.
shopIntro
);
...
...
apps/product/views/action/shop/category.hbs
0 → 100644
View file @
97837b2
<div
class=
"product-category yoho-page"
>
<div
id=
"allproduct"
class=
"allproduct"
>
<a
href=
{{
allproduct
}}
>
<p
class=
"allproductParagaraph buriedpoint"
data-bp-id =
"shop_category_all_1"
>
全部商品
</p>
<i
class=
"arrow-icon iconfont"
>

</i>
</a>
</div>
<div
class=
"margin-under-allproduct"
>
</div>
<div
class=
"category-container clearfix"
>
<div
class=
"content"
>
{{#
content
}}
<ul
class=
"primary-level"
>
{{#
class
}}
<li
class=
"p-level-item buriedpoint"
data-bp-id=
"shop_primarylevel_
{{
name
}}
_1"
>
{{
name
}}
<div
class=
"primary-level-trilangle trilanglefont hide"
>

</div>
</li>
{{/
class
}}
</ul>
<div
class=
"sub-level-container hide"
>
{{#
category
}}
<ul
class=
"sub-level"
>
{{#
subcategory
}}
<li
class=
"buriedpoint"
data-bp-id=
"shop_sublevel_
{{
categoryName
}}
_1"
>
<a
href=
{{
url
}}
>
{{
categoryName
}}
</a
>
</li>
{{/
subcategory
}}
</ul>
{{/
category
}}
</div>
{{/
content
}}
</div>
</div>
</div>
\ No newline at end of file
...
...
apps/product/views/partial/detail/banner-swiper-arrow.hbs
View file @
97837b2
...
...
@@ -22,7 +22,7 @@
{{^}}
<div
class=
"banner-top-single"
>
<a
href=
{{
url
}}
>
<img
class=
"img"
src=
"
{{
image
src
450
600
}}
"
>
<img
class=
"img"
src=
"
{{
image
img
450
600
}}
"
>
</a>
</div>
{{/if}}
...
...
public/img/sprite.product.png
View file @
97837b2
7.97 KB
|
W:
|
H:
8.86 KB
|
W:
|
H:
2-up
Swipe
Onion skin
public/js/product/category.page.js
0 → 100644
View file @
97837b2
/**
* 分类
* @author: berry<lixia.zhang@yoho.cn>
* @date: 2016/4/25
*/
var
$
=
require
(
'yoho-jquery'
);
var
$allProductCell
=
$
(
'.allproduct'
),
$categoryContainer
=
$
(
'.category-container'
),
$contents
=
$categoryContainer
.
children
(
'.content'
),
$subLevelItem
=
$categoryContainer
.
find
(
'.sub-level li'
),
$trilangle
=
$categoryContainer
.
find
(
'.primary-level-trilangle'
);
//初始化container高度
(
function
()
{
var
$header
=
$
(
'.yoho-header'
);
var
h
=
$
(
window
).
height
()
-
$header
.
outerHeight
()
-
$allProductCell
.
outerHeight
();
var
trilangleRightMargin
=
$
(
window
).
width
()
*
0.55
;
$categoryContainer
.
css
(
'min-height'
,
h
);
$trilangle
.
css
(
'margin-right'
,
trilangleRightMargin
);
$contents
.
height
(
h
);
}());
$categoryContainer
.
on
(
'touchend'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
),
$subLevel
,
$cur
,
index
,
$subLevelContainer
,
$trilangleItem
;
$cur
=
$this
.
closest
(
'.p-level-item'
);
$subLevelContainer
=
$this
.
closest
(
'.content'
).
find
(
'.sub-level-container'
);
$subLevelContainer
.
removeClass
(
'hide'
);
if
(
$cur
.
length
>
0
)
{
index
=
$cur
.
index
();
$subLevel
=
$this
.
closest
(
'.content'
).
find
(
'.sub-level'
);
$trilangleItem
=
$this
.
closest
(
'.content'
).
find
(
'.primary-level-trilangle'
);
if
(
$this
.
hasClass
(
'focus'
))
{
return
;
}
$subLevel
.
not
(
'.hide'
).
addClass
(
'hide'
);
$subLevel
.
eq
(
index
).
removeClass
(
'hide'
);
$trilangleItem
.
not
(
'.hide'
).
addClass
(
'hide'
);
$trilangleItem
.
eq
(
index
).
removeClass
(
'hide'
);
}
});
$categoryContainer
.
find
(
'.sub-level'
).
on
(
'touchstart'
,
'li'
,
function
()
{
$subLevelItem
.
removeClass
(
'highlight'
);
$
(
this
).
addClass
(
'highlight'
);
}).
on
(
'touchend touchcancel'
,
'li'
,
function
()
{
$
(
this
).
removeClass
(
'highlight'
);
});
$allProductCell
.
on
(
'touchstart'
,
function
()
{
$
(
this
).
addClass
(
'highlight'
);
}).
on
(
'touchend touchcancel'
,
function
()
{
$
(
this
).
removeClass
(
'highlight'
);
});
\ No newline at end of file
...
...
public/scss/product/shop/_index.css
View file @
97837b2
@import
"shop-index"
;
@import
"shop-prodfile"
;
@import
"product-category"
;
\ No newline at end of file
...
...
public/scss/product/shop/_product-category.css
0 → 100644
View file @
97837b2
.product-category
{
font-size
:
30px
;
background-color
:
#fff
;
.allproduct
{
padding
:
0px
30px
;
display
:
block
;
height
:
89px
;
line-height
:
89px
;
&.highlight
{
background
:
#dbdbdb
;
}
}
.margin-under-allproduct
{
width
:
100%
;
height
:
30px
;
background-color
:
#f0f0f0
;
}
.category-container
{
border-top
:
1px
solid
#e6e6e6
;
}
.arrow-icon
{
position
:
relative
;
float
:
right
;
font-size
:
30px
;
top
:
0px
;
color
:
#e1e1e1
;
padding
:
0px
10px
;
}
.allproductParagaraph
{
font-size
:
18px
;
left
:
20px
;
}
.content
{
background
:
#fff
;
&.hide
{
display
:
none
;
}
}
.primary-level
{
float
:
left
;
box-sizing
:
border-box
;
width
:
100%
;
position
:
absolute
;
>
li
{
position
:
relative
;
height
:
89px
;
line-height
:
89px
;
box-sizing
:
border-box
;
border-bottom
:
1px
solid
#e6e6e6
;
background-color
:
#fff
;
margin-left
:
30px
;
}
}
.primary-level-trilangle
{
float
:
right
;
background
:
url(/product/arrow.png)
no-repeat
;
margin-top
:
22px
;
width
:
20px
;
height
:
46px
;
}
.trilanglefont
{
font-family
:
"iconfont"
!important
;
font-size
:
30px
;
font-style
:
normal
;
text-decoration
:
none
;
-webkit-font-smoothing
:
antialiased
;
-webkit-text-stroke-width
:
0.2px
;
-moz-osx-font-smoothing
:
grayscale
;
color
:
#f4f4f4
;
}
.sub-level-container
{
float
:
right
;
box-sizing
:
border-box
;
background
:
#f4f4f4
;
width
:
55%
;
height
:
100%
;
position
:
relative
;
}
.sub-level
{
width
:
100%
;
&.hide
{
display
:
none
;
}
>
li
{
box-sizing
:
border-box
;
height
:
89px
;
line-height
:
89px
;
border-bottom
:
1px
solid
#e6e6e6
;
margin-left
:
30px
;
padding-left
:
0
;
&.highlight
{
background
:
#dbdbdb
;
margin-left
:
0
;
padding-left
:
30px
;
}
&
:last-child
{
border-bottom
:
none
;
}
}
a
{
display
:
block
;
height
:
100%
;
width
:
100%
;
color
:
#afafaf
;
}
}
}
...
...
Please
register
or
login
to post a comment