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
biao
9 years ago
Commit
58e1f8267a329349d58faebeec78d9e1d0effc49
2 parents
eea93566
3540f99d
Merge branch 'release/1.0' of
http://git.yoho.cn/fe/yoho-blk
into release/1.0
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
156 additions
and
69 deletions
apps/brand/views/partial/list.hbs
apps/editorial/models/editorial.js
apps/editorial/views/action/detail.hbs
apps/product/controllers/item.js
apps/product/controllers/list.js
apps/product/models/item-handler.js
apps/product/models/resouces.js
apps/product/views/action/newList.hbs
doraemon/views/partial/nav-menu.hbs
public/js/brand/index.page.js
public/js/editorial/detail.page.js
public/scss/editorial/_article-related.css
public/scss/editorial/_detail.css
apps/brand/views/partial/list.hbs
View file @
58e1f82
{{#
each
category
}}
<dl
class=
"clearfix"
name=
"
{{
key
}}
"
>
<dt>
{{
key
}}
</dt>
<dt
class=
"brand-key"
>
{{
key
}}
</dt>
<dd
class=
"brand-tabs"
>
<ul
class=
"clearfix"
>
{{#
each
brands
}}
...
...
apps/editorial/models/editorial.js
View file @
58e1f82
...
...
@@ -245,6 +245,7 @@ const _getRelatedData = (idList) => {
const
_processContentData
=
(
list
)
=>
{
list
=
list
||
[];
list
=
camelCase
(
list
);
//console.log(list)
let
contentData
=
{
contents
:
[]
...
...
@@ -268,7 +269,7 @@ const _processContentData = (list) => {
let
idList
=
''
;
//
let recoLength = '';
let
recoLength
=
''
;
let
related
=
{
relatedReco
:
[],
relatedGroup
:
[]
...
...
@@ -283,11 +284,11 @@ const _processContentData = (list) => {
idList
+=
data
.
id
+
','
;
related
.
relatedReco
.
push
(
data
);
recoLength
=
recoLength
+
1
;
});
}
// recoLength = idList.length / 9;
if
(
value
.
goodsGroup
)
{
_
.
forEach
(
value
.
goodsGroup
.
data
,
function
(
data
)
{
...
...
@@ -308,8 +309,8 @@ const _processContentData = (list) => {
_
.
forEach
(
related
.
relatedReco
,
function
(
data
,
index
)
{
data
=
_
.
assign
(
data
,
result
[
index
]);
});
result
.
splice
(
0
,
recoLength
.
length
);
}
if
(
related
.
relatedGroup
)
{
...
...
@@ -329,7 +330,7 @@ const _processContentData = (list) => {
return
contentData
;
});
//console.log(contentData)
return
contentData
;
};
...
...
@@ -414,7 +415,7 @@ const _getRelateBrand = (id) => {
return
serviceAPI
.
get
(
'guang/service/v2/article/getBrand'
,
{
article_id
:
id
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
if
(
result
&&
result
.
code
===
200
)
{
_
.
forEach
(
result
.
data
,
function
(
data
)
{
let
domain
=
data
.
url
;
...
...
@@ -435,7 +436,7 @@ const _getArticlePre = (id) => {
id
:
id
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
console
.
log
(
result
);
//
console.log(result);
return
result
;
}
else
{
logger
.
error
(
'上一篇不是200'
);
...
...
@@ -566,7 +567,7 @@ const getDetailData = (id) => {
tags
:
res
.
tags
,
content
:
result
[
2
],
comment
:
result
[
3
],
brands
:
result
[
4
]
brands
:
result
[
5
]
};
})();
};
...
...
apps/editorial/views/action/detail.hbs
View file @
58e1f82
...
...
@@ -60,9 +60,6 @@
</div>
</div>
{{!-- {{#if relatedGroup}} --}}
<div
class=
"related-reco related-group"
>
<div
class=
"article-title"
>
<div
class=
"title-line"
></div>
...
...
@@ -77,6 +74,8 @@
{{#
relatedGroup
}}
{{>
related-goods
}}
{{/
relatedGroup
}}
<span
class=
"left iconfont"
>

</span>
<span
class=
"right iconfont"
>

</span>
</div>
</div>
{{/
related
}}
...
...
@@ -101,7 +100,7 @@
</a>
<p
class=
"brand-name"
>
{{
name
}}
</p>
</div>
{{/
brands
}}
{{/
brands
}}
</div>
</div>
{{/if}}
...
...
apps/product/controllers/item.js
View file @
58e1f82
...
...
@@ -19,6 +19,7 @@ const index = (req, res, next) => {
return
next
();
}
result
.
page
=
'item'
;
result
.
title
+=
`
|
$
{
res
.
locals
.
title
}
`
;
res
.
display
(
'item'
,
result
);
}).
catch
(
next
);
};
...
...
apps/product/controllers/list.js
View file @
58e1f82
...
...
@@ -17,7 +17,7 @@ const list = {
// 列表页
index
:
(
req
,
res
,
next
)
=>
{
let
q
=
req
.
query
;
let
channel
=
req
.
cookies
.
_Channel
||
'men'
;
let
channel
=
req
.
cookies
.
_Channel
||
req
.
query
.
_Channel
||
'men'
;
q
.
page
=
parseInt
(
q
.
page
||
1
,
10
);
q
.
order
=
q
.
order
||
's_n_desc'
;
...
...
@@ -69,9 +69,11 @@ const list = {
// 新品到着
newPage
:
(
req
,
res
,
next
)
=>
{
let
q
=
req
.
query
;
let
channel
=
req
.
cookies
.
_Channel
||
req
.
query
.
_Channel
||
'men'
;
q
.
page
=
parseInt
(
q
.
page
||
1
,
10
);
q
.
order
=
q
.
order
||
's_n_desc'
;
q
.
channel
=
channel
;
let
retData
=
{
module
:
'product'
,
...
...
@@ -79,44 +81,45 @@ const list = {
title
:
'新品'
};
Promise
.
all
([
Resouces
.
newProductBanner
(),
Search
.
queryAllSort
(),
Search
.
queryNewProduct
(
q
)]).
then
(
result
=>
{
let
banner
=
result
[
0
];
let
sortData
=
camelCase
(
result
[
1
]);
let
listData
=
result
[
2
];
let
nav
=
[
DataHelper
.
getChannelNav
(),
{
name
:
'新品'
}];
retData
.
banner
=
banner
;
if
(
listData
&&
listData
.
code
===
200
&&
listData
.
data
)
{
let
data
=
camelCase
(
listData
.
data
);
if
(
data
.
filter
)
{
data
.
filter
.
groupSort
=
DataHelper
.
sortConvert
(
sortData
.
data
.
sort
);
retData
.
filter
=
DataHelper
.
filterHandle
(
data
.
filter
,
q
);
retData
.
filter
.
showPrice
=
data
.
total
>
10
;
Promise
.
all
([
Resouces
.
newProductBanner
(
channel
),
Search
.
queryAllSort
(),
Search
.
queryNewProduct
(
q
)]).
then
(
result
=>
{
let
banner
=
result
[
0
];
let
sortData
=
camelCase
(
result
[
1
]);
let
listData
=
result
[
2
];
let
nav
=
[
DataHelper
.
getChannelNav
(),
{
name
:
'新品'
}];
retData
.
banner
=
banner
;
if
(
listData
&&
listData
.
code
===
200
&&
listData
.
data
)
{
let
data
=
camelCase
(
listData
.
data
);
if
(
data
.
filter
)
{
data
.
filter
.
groupSort
=
DataHelper
.
sortConvert
(
sortData
.
data
.
sort
);
retData
.
filter
=
DataHelper
.
filterHandle
(
data
.
filter
,
q
);
retData
.
filter
.
showPrice
=
data
.
total
>
10
;
}
retData
.
navPath
=
{
nav
:
nav
};
retData
.
paginationData
=
{
page
:
q
.
page
,
limit
:
data
.
limit
||
45
,
total
:
data
.
total
,
pageTotal
:
data
.
pageTotal
,
queryParams
:
q
};
res
.
display
(
'newList'
,
_
.
assign
(
retData
,
{
products
:
DataHelper
.
handleProductList
(
data
.
productList
,
q
),
order
:
q
.
order
}));
}
else
{
return
Promise
.
reject
(
'query product error'
);
}
retData
.
navPath
=
{
nav
:
nav
};
retData
.
paginationData
=
{
page
:
q
.
page
,
limit
:
data
.
limit
||
45
,
total
:
data
.
total
,
pageTotal
:
data
.
pageTotal
,
queryParams
:
q
};
res
.
display
(
'newList'
,
_
.
assign
(
retData
,
{
products
:
DataHelper
.
handleProductList
(
data
.
productList
,
q
),
order
:
q
.
order
}));
}
else
{
return
Promise
.
reject
(
'query product error'
);
}
}).
catch
(
next
);
}).
catch
(
next
);
}
};
...
...
apps/product/models/item-handler.js
View file @
58e1f82
...
...
@@ -169,7 +169,7 @@ const setSeoInfo = (goodInfo, nav) => {
sortName
=
_
.
get
(
nav
,
'[1].name'
,
''
);
return
{
title
:
`
$
{
brandName
}
$
{
sortName
}
|
$
{
goodInfo
.
name
}
正品`
,
title
:
`
$
{
brandName
}
$
{
sortName
}
|
$
{
goodInfo
.
name
}
正品`
,
keywords
:
`
$
{
brandName
}
$
{
sortName
},
$
{
brandName
}
正品官网专卖店
,
$
{
brandName
}
官方授权店
,
$
{
brandName
}
正品
,
`
+
`
$
{
brandName
}
打折
,
$
{
brandName
}
折扣店
,
$
{
brandName
}
真品
,
$
{
brandName
}
代购`
,
description
:
_
.
get
(
goodInfo
,
'share.shareDesc'
,
goodInfo
.
name
)
...
...
apps/product/models/resouces.js
View file @
58e1f82
...
...
@@ -14,10 +14,16 @@ const Resources = {
* 获取新品到着-列表页-banner 资源位
* @returns {Promise.<T>}
*/
newProductBanner
()
{
newProductBanner
(
channel
)
{
let
codes
=
{
men
:
'3d3127b220073fbcda738c8ba26561e5'
,
women
:
'2aaf9519b31d1f21c537032f496e7450'
,
lifestyle
:
'422bfdb9b410598e11c3e72bd4ee664e'
};
let
params
=
{
content_code
:
'a7989369aa86681c678bc40f171b8f1d'
content_code
:
codes
[
channel
]
};
return
api
.
get
(
'/operations/api/v5/resource/get'
,
params
).
then
(
result
=>
{
...
...
apps/product/views/action/newList.hbs
View file @
58e1f82
...
...
@@ -16,10 +16,10 @@
</div>
<div
class=
"right"
>
{{!-- 新品banner --}}
{{#
banner
}}
{{#
if
banner
.
src
}}
<div
class=
"banner-img"
style=
"height: 200px;margin-bottom:30px; background:url(
{{
image
src
850
200
2
}}
) no-repeat top center;"
></div>
{{/
banner
}}
style=
"height: 200px;margin-bottom:30px; background:url(
{{
image
banner
.
src
850
200
2
}}
) no-repeat top center;"
></div>
{{/if}}
{{!-- 已选中条件 --}}
{{#
filter
}}
{{>
list
/
filter-area
}}
...
...
doraemon/views/partial/nav-menu.hbs
View file @
58e1f82
...
...
@@ -5,7 +5,7 @@
<ul
class=
"main-nav-list"
>
{{#
navbars
}}
<li
class=
"nav-item
{{#if
cur
}}
cur
{{/if}}
"
>
<a
href=
"
{{
link
}}
"
>
<a
href=
"
{{
link
}}
"
{{#if
isNewPage
}}
target=
"_blank"
{{/if}}
>
<span
class=
"nav-en"
>
{{
en
}}
</span>
<span
class=
"nav-cn"
>
{{
cn
}}
</span>
</a>
...
...
public/js/brand/index.page.js
View file @
58e1f82
...
...
@@ -20,13 +20,27 @@ lazyLoad($('.brand-page img.lazy'));
// 品牌类别滚动事件
$
(
window
).
scroll
(
function
()
{
var
navLength
=
$
(
'.category-nav'
).
find
(
'a'
).
length
+
1
;
if
(
$
(
this
).
scrollTop
()
>=
categoryTop
)
{
$gory
.
addClass
(
'category-fix'
);
}
else
{
$gory
.
removeClass
(
'category-fix'
);
}
});
$
(
'.brand-key'
).
each
(
function
(
i
,
ele
)
{
if
(
$
(
ele
).
parent
().
attr
(
'style'
))
{
return
;
}
if
(
$
(
ele
).
offset
().
top
-
$
(
window
).
scrollTop
()
<
100
)
{
var
key
=
$
(
ele
).
html
().
charAt
(
$
(
ele
).
html
().
length
-
1
);
$
(
'.category-nav'
).
find
(
'.'
+
key
).
css
(
'color'
,
'#379ed6'
).
siblings
().
css
(
'color'
,
'#222'
);
}
});
});
// 点击字母,页面滚动到相关区域
$category
.
click
(
function
()
{
...
...
public/js/editorial/detail.page.js
View file @
58e1f82
...
...
@@ -193,3 +193,9 @@ if ($('.collocation').find('.good-info').length === 0) {
if
(
$
(
'.goods'
).
find
(
'.good-info'
).
length
===
0
)
{
$
(
'.related-group'
).
hide
();
}
// $('.left').click(function {
// $('.goods').animate({ left: '+50px' }, "slow");
// })
// console.log($('.goods').offsetWidth()
\ No newline at end of file
...
...
public/scss/editorial/_article-related.css
View file @
58e1f82
.article-title
{
position
:
relative
;
text-align
:
center
;
margin-left
:
30px
;
width
:
933px
;
.title-line
{
border-bottom
:
1px
solid
#bbb
;
...
...
public/scss/editorial/_detail.css
View file @
58e1f82
.editorial-detail-page
{
width
:
9
4
0px
;
width
:
9
9
0px
;
.detail-body
{
width
:
9
36
px
;
width
:
9
90
px
;
margin
:
0
auto
;
overflow
:
hidden
;
/*overflow: hidden;*/
}
.detail-title
{
...
...
@@ -94,18 +94,57 @@
}
.related-reco
{
width
:
100
0px
;
width
:
99
0px
;
padding-top
:
30px
;
overflow
:
hidden
;
position
:
relative
;
.btn
{
position
:
relative
;
}
.left
{
position
:
absolute
;
display
:
block
;
width
:
30px
;
height
:
50px
;
left
:
0
;
top
:
200px
;
color
:
#fff
;
background
:
#ccc
;
text-align
:
center
;
line-height
:
50px
;
}
.left
:hover
{
background
:
#7f7f7f
;
}
.right
:hover
{
background
:
#7f7f7f
;
}
.right
{
position
:
absolute
;
display
:
block
;
width
:
30px
;
height
:
50px
;
right
:
0
;
top
:
200px
;
color
:
#fff
;
background
:
#ccc
;
text-align
:
center
;
line-height
:
50px
;
}
}
.related-goods
{
padding
-top
:
6
0px
;
padding
:
60px
0
0
3
0px
;
.good-info
{
width
:
219px
;
float
:
left
;
margin
:
0
20
px
15px
0
;
margin
:
0
18
px
15px
0
;
img
{
width
:
219px
;
...
...
@@ -120,6 +159,7 @@
display
:
block
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
text-align
:
center
;
}
.price
{
...
...
@@ -131,6 +171,11 @@
}
}
.goods
{
height
:
420px
;
overflow
:
hidden
;
}
.related-brand
{
margin-top
:
30px
;
...
...
@@ -138,8 +183,9 @@
.brands
{
width
:
950px
;
padding
:
30px
0
;
padding
:
30px
0
30px
30px
;
overflow
:
hidden
;
}
.brand
{
...
...
@@ -252,11 +298,12 @@
.article-tag
{
float
:
left
;
width
:
100%
;
width
:
940px
;
border-top
:
1px
solid
#eee
;
border-bottom
:
1px
solid
#eee
;
padding
:
20px
0
;
padding
:
20px
0
20px
10px
;
overflow
:
hidden
;
margin-left
:
30px
;
.tag-icon
{
float
:
left
;
...
...
@@ -302,7 +349,8 @@
line-height
:
25px
;
border
:
1px
solid
#fff
;
overflow
:
hidden
;
width
:
100%
;
width
:
940px
;
margin-left
:
30px
;
a
{
color
:
#afafaf
;
...
...
@@ -319,6 +367,8 @@
.comment-area
{
margin-top
:
58px
;
width
:
935px
;
margin-left
:
30px
;
.comment-publish
{
height
:
48px
;
...
...
@@ -467,4 +517,9 @@
display
:
block
;
}
}
.share
{
padding-left
:
30px
;
width
:
330px
;
}
}
...
...
Please
register
or
login
to post a comment