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
lijing
9 years ago
Commit
dccb6ce1a85cd913057cd9f1401b7ae3273602c1
1 parent
bc737480
逛
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
129 additions
and
16 deletions
apps/activity/models/market.js
apps/guang/controllers/index.js
apps/guang/models/index.js
apps/guang/views/action/index.hbs
public/js/guang/index.page.js
apps/activity/models/market.js
0 → 100644
View file @
dccb6ce
/**
* 市场推广
* <jing.li@yoho.cn>
* 2016/09/07
*/
'use strict'
;
const
service
=
global
.
yoho
.
ServiceAPI
;
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
const
index
=
()
=>
{
return
service
.
get
(
'/operations/api/v5/resource/home'
,
{
content_code
:
'5a9b5bcfd2e13d56c9ba6b867a325dc1'
,
gender
:
1
,
limit
:
1000
,
page
:
1
,
debug
:
'XYZ'
}).
then
(
result
=>
{
let
resu
=
{
swiper
:
[],
floorAdList
:
[],
newsList
:
[],
download
:
[]
};
if
(
result
.
data
.
list
[
0
])
{
let
headerTip
=
result
.
data
.
list
[
0
].
data
.
text
;
resu
=
Object
.
assign
(
resu
,
{
headerTip
});
}
if
(
result
.
data
.
list
[
1
])
{
let
adList
=
result
.
data
.
list
[
1
].
data
.
list
;
let
build
=
[];
adList
.
forEach
(
ad
=>
{
build
.
push
({
img
:
helpers
.
image
(
ad
.
src
,
640
,
310
),
url
:
ad
.
url
});
});
resu
.
swiper
=
build
;
let
floorList
=
result
.
data
.
list
[
1
].
data
.
list
;
let
floorAdListTitle
=
result
.
data
.
list
[
1
].
data
.
title
.
title
;
resu
=
_
.
assign
(
resu
,
{
floorAdListTitle
});
let
floor
=
[];
let
i
=
0
;
floorList
.
forEach
(
ad
=>
{
if
(
i
<
12
)
{
// 控制显示条数,默认1-12
floor
.
push
({
img
:
helpers
.
image
(
ad
.
src
,
640
,
170
),
url
:
ad
.
url
,
title
:
ad
.
title
});
i
++
;
}
});
resu
.
floorAdList
=
floor
;
}
if
(
result
.
data
.
list
[
2
])
{
let
newsList
=
result
.
data
.
list
[
2
].
data
.
list
[
0
];
let
news
=
[{
img
:
helpers
.
image
(
newsList
.
src
,
640
,
370
),
url
:
newsList
.
url
,
title
:
newsList
.
title
,
alt
:
newsList
.
alt
}];
resu
.
newsList
=
news
;
}
if
(
result
.
data
.
list
[
3
])
{
let
downlist
=
result
.
data
.
list
[
3
].
data
[
0
];
let
down
=
[{
img
:
helpers
.
image
(
downlist
.
src
,
640
,
275
),
url
:
downlist
.
url
,
alt
:
downlist
.
alt
}];
resu
.
download
=
down
;
}
return
resu
;
});
};
module
.
exports
=
{
index
};
...
...
apps/guang/controllers/index.js
View file @
dccb6ce
...
...
@@ -78,12 +78,12 @@ const _page = (req, res, next) => {
/* 判断参数是否有效 */
let
tag
=
req
.
query
.
tag
,
sortId
=
req
.
query
.
type
,
sortId
=
req
.
query
.
type
||
0
,
page
=
req
.
query
.
page
,
gender
=
req
.
query
.
gender
,
authorId
=
req
.
query
.
authorId
,
isApp
=
req
.
query
.
isApp
,
isTab
=
req
.
query
.
isTab
,
isApp
=
req
.
yoho
.
isApp
||
false
,
isTab
=
req
.
query
.
isTab
||
false
,
showAuthor
=
true
;
let
uid
=
req
.
user
.
uid
,
...
...
apps/guang/models/index.js
View file @
dccb6ce
...
...
@@ -38,7 +38,7 @@ const _category = () => {
return
serviceAPI
.
get
(
'/guang/api/v1/category/get'
,
{
},
{
cache
:
true
,
code
:
200
});
};
...
...
@@ -139,11 +139,12 @@ const _article = (param) => {
page
:
param
.
page
||
1
,
uid
:
param
.
uid
,
udid
:
param
.
udid
,
sort_id
:
param
.
type
?
param
.
type
:
1
,
sort_id
:
param
.
type
===
0
?
param
.
type
:
1
,
tag
:
param
.
tag
?
param
.
tag
:
null
,
author_id
:
param
.
authorId
?
param
.
authorId
:
null
,
limit
:
param
.
limit
?
param
.
limit
:
null
,
},
{
cache
:
true
,
code
:
200
}).
then
(
result
=>
{
...
...
@@ -159,8 +160,8 @@ const _article = (param) => {
*/
const
getArticle
=
(
param
)
=>
{
let
page
=
param
.
page
?
param
.
page
:
1
;
let
page
=
param
.
page
?
param
.
page
:
1
;
Object
.
assign
(
param
,
{
page
:
page
});
return
api
.
all
([
...
...
@@ -172,17 +173,16 @@ const getArticle = (param) => {
let
resu
=
{
guang
:
{
swiper
:
true
}
};
// 顶部的分类列表
let
curIndex
=
0
;
// 当前tab顺序
let
indexTmp
=
0
;
if
(
result
[
0
]
&&
result
[
0
].
data
)
{
if
(
result
[
0
]
&&
result
[
0
].
data
&&
result
[
0
].
data
)
{
indexTmp
=
0
;
...
...
@@ -219,7 +219,7 @@ const getArticle = (param) => {
}
if
(
result
[
1
].
data
.
list
.
adlist
)
{
if
(
result
[
1
].
data
.
list
.
adlist
&&
result
[
1
].
data
)
{
let
swp
=
[];
...
...
@@ -235,11 +235,9 @@ const getArticle = (param) => {
resu
.
guang
.
swiper
=
swp
;
}
if
(
result
[
1
].
data
.
list
.
artList
)
{
if
(
result
[
1
].
data
.
list
.
artList
&&
result
[
1
].
data
)
{
let
inf
=
[];
...
...
@@ -253,7 +251,7 @@ const getArticle = (param) => {
}
console
.
log
(
resu
.
guang
);
// console.log(resu
);
return
resu
;
...
...
apps/guang/views/action/index.hbs
View file @
dccb6ce
...
...
@@ -16,14 +16,14 @@
{{#if
..
/
swiper
}}
<div
class=
"swiper-container swiper-cont-
{{
typeId
}}
"
>
<div
class=
"swiper-wrapper swiper-wrap-
{{
typeId
}}
"
>
{{#
swiper
}}
{{#
..
/
swiper
}}
<div
class=
"swiper-slide"
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"swiper-lazy"
data-src=
"
{{
img
}}
"
>
</a>
<div
class=
"swiper-lazy-preloader"
></div>
</div>
{{/
swiper
}}
{{/
..
/
swiper
}}
</div>
<div
class=
"swiper-pagination swiper-pagi-
{{
typeId
}}
"
></div>
</div>
...
...
public/js/guang/index.page.js
View file @
dccb6ce
...
...
@@ -49,6 +49,8 @@ info.initInfosEvt($infoList);
end
:
false
};
});
console
.
log
(
state
);
}());
$nav
.
bind
(
'contextmenu'
,
function
(
e
)
{
return
false
;
...
...
Please
register
or
login
to post a comment