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
Email Patches
Plain Diff
Browse Files
Authored by
zhangxiaoru
9 years ago
Commit
8570a9696824129f2b3a94ac853367deb9241c6e
1 parent
93a02fd4
master
...
develop
feature/catch
feature/docker
feature/login-msg
feature/login-ua-ip
feature/removCamel
feature/safe-bug
feature/sessionKey
feature/setting
feature/vip
feature/webpack2
feature/wsl5.3
gray
release/2.0
release/fontBack2.0
editorial
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
28 deletions
apps/brand/controllers/brand.js
apps/editorial/controllers/editorial.js
apps/editorial/models/editorial.js
apps/editorial/views/partial/msg.hbs
public/scss/editorial/_detail.css
apps/brand/controllers/brand.js
View file @
8570a96
...
...
@@ -13,7 +13,7 @@ const brand = require('../models/brand');
* @param res
*/
const
index
=
(
req
,
res
,
next
)
=>
{
let
channel
=
req
.
cookies
.
_C
hannel
||
'men'
;
let
channel
=
req
.
yoho
.
c
hannel
||
'men'
;
let
contentCode
=
''
;
let
name
=
''
;
...
...
apps/editorial/controllers/editorial.js
View file @
8570a96
...
...
@@ -19,11 +19,22 @@ const index = (req, res, next) => {
let
pageNum
=
req
.
query
.
page
||
1
;
let
limit
=
req
.
query
.
limit
||
20
;
let
appType
=
1
;
let
udid
=
md5
(
req
.
ip
);
let
channel
=
req
.
cookies
.
_Channel
||
'men'
;
let
gender
=
''
;
if
(
channel
===
'men'
)
{
gender
=
'1,3'
;
}
else
if
(
channel
===
'women'
)
{
gender
=
'2,3'
;
}
else
{
gender
=
'3,3'
;
}
console
.
log
(
gender
)
// let gender = req.query.brand || 1;
editorialModel
.
getIndexData
(
pageNum
,
limit
,
appType
,
udid
,
gender
).
then
((
result
)
=>
{
editorialModel
.
getIndexData
(
pageNum
,
limit
,
appType
).
then
((
result
)
=>
{
// console.log(result.msg)
res
.
display
(
'index'
,
{
module
:
'editorial'
,
page
:
'index'
,
...
...
@@ -67,8 +78,9 @@ const list = (req, res) => {
let
limit
=
req
.
query
.
limit
||
20
;
let
tag
=
req
.
query
.
query
;
let
authorId
=
req
.
query
.
authorId
;
let
udid
=
md5
(
req
.
ip
);
editorialModel
.
getListData
(
pageNum
,
limit
,
tag
,
authorId
).
then
((
result
)
=>
{
editorialModel
.
getListData
(
pageNum
,
limit
,
tag
,
authorId
,
udid
).
then
((
result
)
=>
{
res
.
display
(
'list'
,
{
module
:
'editorial'
,
...
...
@@ -116,10 +128,10 @@ const list = (req, res) => {
*/
const
detail
=
(
req
,
res
,
next
)
=>
{
let
id
=
req
.
params
.
id
;
let
appType
=
1
;
// let clientType = 'pc';
editorialModel
.
getDetailData
(
id
).
then
((
result
)
=>
{
editorialModel
.
getDetailData
(
id
,
appType
).
then
((
result
)
=>
{
res
.
display
(
'detail'
,
{
module
:
'editorial'
,
page
:
'detail'
,
...
...
apps/editorial/models/editorial.js
View file @
8570a96
...
...
@@ -35,8 +35,6 @@ const _processListData = (list) => {
total
:
list
.
total
});
// console.log(list)
_
.
forEach
(
list
.
list
.
artList
,
(
data
)
=>
{
if
(
data
.
author
)
{
...
...
@@ -47,12 +45,13 @@ const _processListData = (list) => {
data
.
publishTime
=
data
.
publishTime
.
replace
(
/年|月/g
,
'/'
);
data
.
publishTime
=
data
.
publishTime
.
replace
(
/日/g
,
''
);
console
.
log
(
data
)
data
.
isPraise
=
data
.
isPraise
===
'Y'
;
});
listData
.
tabs
=
list
.
list
.
artList
;
//console.log(listData)
return
listData
;
};
...
...
@@ -65,13 +64,16 @@ const _processListData = (list) => {
* @param limit
* @returns {*}
*/
const
getIndexData
=
(
pageNum
,
limit
,
appType
)
=>
{
const
getIndexData
=
(
pageNum
,
limit
,
appType
,
udid
,
gender
)
=>
{
return
serviceAPI
.
get
(
'guang/api/*/article/getList'
,
{
page
:
pageNum
,
limit
:
limit
,
app_type
:
appType
app_type
:
appType
,
udid
:
udid
,
gender
:
gender
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
// console.log(result)
return
_processListData
(
result
.
data
);
}
else
{
logger
.
error
(
'Information page list data return code is not 200'
);
...
...
@@ -88,10 +90,11 @@ const getIndexData = (pageNum, limit, appType) => {
* @param authorId
* @returns {*}
*/
const
getListData
=
(
pageNum
,
limit
,
tag
,
authorId
)
=>
{
const
getListData
=
(
pageNum
,
limit
,
tag
,
authorId
,
udid
)
=>
{
let
param
=
{
page
:
pageNum
,
limit
:
limit
limit
:
limit
,
udid
:
udid
};
if
(
tag
)
{
...
...
@@ -188,8 +191,8 @@ const _processHeadData = (list) => {
}
});
newData
.
headData
.
time
=
newData
.
headData
.
time
.
replace
(
/-/g
,
'/'
);
newData
.
headData
.
time
=
newData
.
headData
.
time
.
replace
(
':00'
,
''
,
2
);
// newData.headData.time = newData.headData.time.replace(/-/g, '/');
// newData.headData.time = newData.headData.time.replace(':00', '', 2);
let
id
=
newData
.
headData
.
authorId
;
...
...
@@ -341,9 +344,10 @@ const _processContentData = (list) => {
* @param id
* @returns {*}
*/
const
_getHeadData
=
(
id
)
=>
{
const
_getHeadData
=
(
id
,
appType
)
=>
{
return
serviceAPI
.
get
(
'/guang/api/*/article/getArticleBaseInfo'
,
{
id
:
id
id
:
id
,
app_type
:
appType
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
return
result
.
data
;
...
...
@@ -400,6 +404,10 @@ const _getCommentsData = (id) => {
article_id
:
id
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
_
.
forEach
(
result
.
data
.
list
,
function
(
data
)
{
data
.
create_time
=
data
.
create_time
.
replace
(
/月/g
,
'/'
);
data
.
create_time
=
data
.
create_time
.
replace
(
/日/g
,
''
);
});
return
camelCase
(
result
.
data
);
}
else
{
logger
.
error
(
'Review data return code is not 200'
);
...
...
@@ -433,12 +441,15 @@ const _getRelateBrand = (id) => {
});
};
const
_getArticlePre
=
(
id
)
=>
{
const
_getArticlePre
=
(
id
,
appType
)
=>
{
return
serviceAPI
.
get
(
'guang/api/*/article/getArticlePre'
,
{
id
:
id
id
:
id
,
app_type
:
appType
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
// console.log(result);
// console.log(1)
// let id = result.data.articleIdPre;
// _getHeadData(id, appType);
return
result
;
}
else
{
logger
.
error
(
'上一篇不是200'
);
...
...
@@ -554,13 +565,13 @@ const shareData = () => {
* @param id
* @returns {*}
*/
const
getDetailData
=
(
id
)
=>
{
const
getDetailData
=
(
id
,
appType
)
=>
{
return
co
(
function
*
()
{
let
result
=
yield
Promise
.
all
([
_getHeadData
(
id
),
let
result
=
yield
Promise
.
all
([
_getHeadData
(
id
,
appType
),
_getArticleData
(
id
),
_getContentData
(
id
),
_getCommentsData
(
id
),
_getArticlePre
(
id
),
_getArticlePre
(
id
,
appType
),
_getRelateBrand
(
id
)]);
let
res
=
yield
_processHeadData
([
result
[
0
],
result
[
1
],
result
[
3
]]);
...
...
apps/editorial/views/partial/msg.hbs
View file @
8570a96
...
...
@@ -8,7 +8,7 @@
<div
class=
"content"
>
{{
intro
}}
</div>
<div
class=
"msg-app"
>
<span
class=
"like-comment"
>
<i
class=
"iconfont like-icon
{{#if
isPraise
}}
liked
{{/if}}
"
>

</i>
<i
class=
"iconfont like-icon
{{#if
isPraise
}}
liked
{{/if}}
"
>

</i>
<b
class=
"like-num"
>
{{
praiseNum
}}
</b>
</span>
</div>
...
...
public/scss/editorial/_detail.css
View file @
8570a96
...
...
@@ -414,9 +414,9 @@
display
:
inline-block
;
height
:
48px
;
line-height
:
48px
;
font-size
:
12px
;
color
:
#c8c8c8
;
float
:
right
;
.exceed-count
{
color
:
#f00
;
...
...
@@ -425,7 +425,7 @@
.publish-btn
{
margin-top
:
10px
;
float
:
righ
t
;
float
:
lef
t
;
width
:
100px
;
height
:
30px
;
line-height
:
33px
;
...
...
Please
register
or
login
to post a comment