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
hongweigao
8 years ago
Commit
9e127a374aa8fb4f53bf3277e0ac53d80327963b
1 parent
77c1a5ae
修改最新速报,数据处理
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
49 deletions
apps/channel/models/index.js
apps/channel/views/partial/newreport-floor.hbs
apps/channel/models/index.js
View file @
9e127a3
...
...
@@ -115,12 +115,12 @@ const _getSlideData = srcData => {
* @param {Object} srcData 原始数据
* @return {Object} 转换后的数据
*/
const
_getNewReportFloorData
=
args
=>
{
const
_getNewReportFloorData
=
(
args
,
type
)
=>
{
const
title
=
args
[
0
].
data
.
text
;
let
item
=
args
[
1
].
data
;
let
secondItem
=
args
[
2
].
data
;
let
thirdItem
=
args
[
3
].
data
;
let
forthItem
=
args
[
4
]
;
let
forthItem
=
args
.
length
===
5
?
args
[
4
]
:
{}
;
let
list
=
[];
...
...
@@ -135,7 +135,6 @@ const _getNewReportFloorData = args => {
let
adData
;
let
floorDatas
=
[];
list
.
push
(
item
[
0
]);
_
.
forEach
(
secondItem
,
(
floorData
)
=>
{
...
...
@@ -148,11 +147,16 @@ const _getNewReportFloorData = args => {
floorDatas
.
push
(
data
);
if
(
forthItem
.
template_name
===
'single_image'
)
{
// 广告位
if
(
forthItem
.
template_name
&&
forthItem
.
template_name
===
'single_image'
)
{
adData
=
_getadbannerData
(
forthItem
.
data
[
0
]);
floorDatas
.
push
(
adData
);
}
// logo列表
if
(
forthItem
.
template_name
&&
forthItem
.
template_name
===
'floor'
)
{
data
.
newReport
.
brandUrl
=
'/getbrandFloorDataAjax?channelType='
+
type
;
}
return
floorDatas
;
};
...
...
@@ -471,15 +475,16 @@ const _processFloorDataWithQueryReusult = (rawData, originQuery, queryResult, ti
* return obj
*/
const
_getNewGoodsFloorData
=
args
=>
{
const
data
=
{
newArrivls
:
{
const
data
=
{};
if
(
!
_
.
isEmpty
(
args
))
{
data
.
newArrivls
=
{
name
:
args
[
0
].
data
.
text
,
navs
:
[]
}
};
data
.
newArrivls
.
navs
=
args
[
1
].
data
;
};
data
.
newArrivls
.
navs
=
args
[
1
].
data
||
{};
}
return
data
;
};
...
...
@@ -590,22 +595,20 @@ const _processFloorData = (rawData, type) => {
const
normalFloorLength
=
3
;
const
hotCategoryLength
=
2
;
_
.
forEach
(
rawData
,
(
data
,
index
)
=>
{
let
floorData
=
null
;
let
queryParam
=
''
;
if
(
data
.
template_name
===
'recommend_content_three'
||
if
(
data
&&
data
.
template_name
===
'recommend_content_three'
||
(
data
.
template_intro
===
'焦点图'
&&
index
===
0
))
{
// 处理banner
floorData
=
floorMap
.
slide
.
call
(
null
,
data
.
data
);
}
else
if
(
data
.
template_intro
===
'热门品类'
)
{
// 处理热门品类
}
else
if
(
data
&&
data
.
template_intro
===
'热门品类'
)
{
// 处理热门品类
floorData
=
floorMap
.
hot
.
call
(
null
,
rawData
.
slice
(
index
,
index
+
hotCategoryLength
),
type
);
}
else
if
(
data
.
data
&&
data
.
data
.
text
)
{
// 处理一般楼层
}
else
if
(
data
&&
data
.
data
&&
data
.
data
.
text
)
{
// 处理一般楼层
let
text
=
_getText
(
data
.
data
.
text
);
let
lastIndex
=
index
+
bigFloorLength
<
rawData
.
length
?
index
+
bigFloorLength
:
index
+
(
rawData
.
length
-
index
-
1
);
floorData
=
floorMap
[
text
]
&&
floorMap
[
text
].
call
(
null
,
rawData
.
slice
(
index
,
lastIndex
),
type
);
...
...
@@ -616,7 +619,7 @@ const _processFloorData = (rawData, type) => {
}
}
}
else
if
(
data
.
template_name
===
'debrisSlider'
)
{
// 处理girls的banner
}
else
if
(
data
&&
data
.
template_name
===
'debrisSlider'
)
{
// 处理girls的banner
floorData
=
floorMap
.
debrisSlide
.
call
(
null
,
data
.
data
);
}
...
...
@@ -650,7 +653,6 @@ const _processFloorData = (rawData, type) => {
floorList
.
push
(
floorData
);
}
});
return
{
floors
:
floorList
,
promise
:
_
.
reverse
(
searchPromise
),
...
...
@@ -904,10 +906,19 @@ const getbrandFloorDataAjax = type => {
logoBrand
:
[],
moreBrand
:
''
};
_
.
forEach
(
contentData
,
(
d
,
index
)
=>
{
let
logoIndex
=
index
;
// 频道页,有两处logo列表,一处优选品牌后面;一处最新速报后面,此处判断
if
(
d
.
data
&&
d
.
data
.
text
&&
d
.
data
.
text
.
indexOf
(
'优选品牌'
)
>=
0
)
{
_
.
forEach
(
contentData
[
index
+
2
].
data
,
(
floorData
)
=>
{
logoIndex
=
index
+
2
;
}
else
if
(
d
.
data
&&
d
.
data
.
text
&&
d
.
data
.
text
.
indexOf
(
'最新速报'
)
>=
0
)
{
logoIndex
=
index
+
4
;
}
if
(
logoIndex
!==
index
)
{
_
.
forEach
(
contentData
[
logoIndex
].
data
,
(
floorData
)
=>
{
let
o
=
{};
o
.
href
=
floorData
.
url
;
...
...
@@ -917,7 +928,10 @@ const getbrandFloorDataAjax = type => {
});
data
.
moreBrand
=
contentData
[
index
+
3
].
data
[
0
].
url
;
return
false
;
}
});
return
data
;
...
...
apps/channel/views/partial/newreport-floor.hbs
View file @
9e127a3
<div
class=
"new-report imgopacity clearfix"
>
{{>
common
/
floor-header
}}
<ul
class=
"report-list clearfix"
>
{{#
list
}}
{{#
unless
@last
}}
<li>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
{{#if
@first
}}
<img
class=
"lazy"
data-original=
"
{{
image
src
377
504
}}
"
alt=
""
>
{{^}}
<img
class=
"lazy"
data-original=
"
{{
image
src
185
248
}}
"
alt=
""
>
{{/if}}
</a>
</li>
{{/
unless
}}
{{/
list
}}
</ul>
{{#
list
}}
{{#if
@last
}}
<div
class=
"last-item"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image
src
377
504
}}
"
alt=
""
>
</a>
</div>
{{/if}}
{{/
list
}}
</div>
<div
class=
"new-report imgopacity clearfix"
>
{{>
common
/
floor-header
}}
<ul
class=
"report-list clearfix"
>
{{#
list
}}
{{#
unless
@last
}}
<li>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
{{#if
@first
}}
<img
class=
"lazy"
data-original=
"
{{
image
src
377
504
}}
"
alt=
""
>
{{^}}
<img
class=
"lazy"
data-original=
"
{{
image
src
185
248
}}
"
alt=
""
>
{{/if}}
</a>
</li>
{{/
unless
}}
{{/
list
}}
</ul>
{{#
list
}}
{{#if
@last
}}
<div
class=
"last-item"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image
src
377
504
}}
"
alt=
""
>
</a>
</div>
{{/if}}
{{/
list
}}
{{#if
brandUrl
}}
<div
class=
"logo-brand"
data-url=
"
{{
brandUrl
}}
"
></div>
{{/if}}
</div>
...
...
Please
register
or
login
to post a comment