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
f41947c14893254cef964a50f2030fc11d98fb9b
1 parent
c7bc6df9
editorial
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
14 deletions
apps/editorial/controllers/editorial.js
apps/editorial/models/editorial.js
apps/editorial/views/action/detail.hbs
apps/editorial/controllers/editorial.js
View file @
f41947c
...
...
@@ -175,10 +175,13 @@ const detail = (req, res, next) => {
userInfo
:
result
.
head
,
comment
:
result
.
comment
,
brands
:
result
.
brands
,
article
:
{
nextChapter
:
'来来来,让我们好好聊聊'
,
lastChapter
:
'除了黑白灰'
},
// article: {
// nextChapter: '来来来,让我们好好聊聊',
// lastChapter: '除了黑白灰'
// },
nextArticle
:
result
.
nextArticle
,
perArticle
:
result
.
perArticle
,
share
:
{
shareImg
:
result
.
content
.
shareImg
,
shareDesc
:
result
.
head
.
title
,
...
...
apps/editorial/models/editorial.js
View file @
f41947c
...
...
@@ -190,8 +190,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
;
...
...
@@ -447,13 +447,57 @@ const _getArticlePre = (id, appType) => {
id
:
id
,
app_type
:
appType
}).
then
((
result
)
=>
{
//console.log(result.message)
if
(
result
&&
result
.
code
===
200
)
{
//console.log(result)
return
camelCase
(
result
.
data
);
let
perArticle
=
{};
perArticle
.
href
=
`
$
{
config
.
siteUrl
}
/editorial/
$
{
result
.
data
.
articleIdPre
}.
html
`
;
_getHeadData
(
result
.
data
.
articleIdPre
,
appType
).
then
((
list
)
=>
{
perArticle
.
lastChapter
=
list
.
title
;
}).
then
(()
=>
{
return
perArticle
;
});
return
perArticle
;
}
else
{
logger
.
error
(
'In the previous is not 200'
);
return
{};
}
});
};
/**
* 获取详情页下一篇
* @param id
* @returns {*}
*/
const
_getArticleNext
=
(
id
,
appType
)
=>
{
return
serviceAPI
.
get
(
'/guang/api/*/article/getArticleNext'
,
{
id
:
id
,
app_type
:
appType
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
let
nextArticle
=
{};
nextArticle
.
href
=
`
$
{
config
.
siteUrl
}
/editorial/
$
{
result
.
data
.
articleIdNext
}.
html
`
;
_getHeadData
(
result
.
data
.
articleIdNext
,
appType
).
then
((
list
)
=>
{
nextArticle
.
lastChapter
=
list
.
title
;
}).
then
(()
=>
{
return
nextArticle
;
});
return
nextArticle
;
}
else
{
logger
.
error
(
'
上一篇
is not 200'
);
logger
.
error
(
'
The next article
is not 200'
);
return
{};
}
});
...
...
@@ -573,6 +617,7 @@ const getDetailData = (id, appType) => {
_getContentData
(
id
),
_getCommentsData
(
id
),
_getArticlePre
(
id
,
appType
),
_getArticleNext
(
id
,
appType
),
_getRelateBrand
(
id
)]);
let
res
=
yield
_processHeadData
([
result
[
0
],
result
[
1
],
result
[
3
]]);
...
...
@@ -581,7 +626,9 @@ const getDetailData = (id, appType) => {
tags
:
res
.
tags
,
content
:
result
[
2
],
comment
:
result
[
3
],
brands
:
result
[
5
]
brands
:
result
[
6
],
nextArticle
:
result
[
4
],
perArticle
:
result
[
5
]
};
})();
};
...
...
apps/editorial/views/action/detail.hbs
View file @
f41947c
...
...
@@ -141,16 +141,22 @@
</div>
<div
class=
"chapter"
>
{{#
article
}}
<p
class=
"chapter-right"
>
<span>
下一篇
</span><br>
{{#
nextArticle
}}
<a
href=
"
{{
href
}}
"
>
{{
nextChapter
}}
</a>
{{/
nextArticle
}}
</p>
<p
class=
"chapter-left"
>
<span>
上一篇
</span><br>
{{#
perArticle
}}
<a
href=
"
{{
href
}}
"
>
{{
lastChapter
}}
</a>
{{/
perArticle
}}
</p>
{{/
article
}}
</div>
<div
id=
"comment-area"
class=
"comment-area"
>
...
...
Please
register
or
login
to post a comment