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
Plain Diff
Browse Files
Authored by
周少峰
8 years ago
Commit
1399a789b3c214376c769c26d5517ae0bd4ad354
2 parents
7d25d84d
46c8bed6
Merge branch 'hotfix/guangComment'
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
apps/guang/controllers/index.js
apps/guang/views/action/guang/detail.hbs
config/cache.js
public/js/guang/detail.page.js
apps/guang/controllers/index.js
View file @
1399a78
...
...
@@ -12,6 +12,7 @@ const guangModel = require('../models/index');
const
headerModel
=
require
(
'../../../doraemon/models/header'
);
const
ghelper
=
require
(
'../models/guang-helper'
);
const
querystring
=
require
(
'querystring'
);
const
helpers
=
global
.
yoho
.
helpers
;
/**
* 首页文章列表 类型列表
...
...
@@ -205,6 +206,7 @@ exports.detail = (req, res, next) => {
if
(
pjax
)
{
guangModel
.
getArticleComments
(
id
,
page
,
pageSize
).
then
(
ret
=>
{
res
.
set
(
'Cache-Control'
,
'no-cache'
);
res
.
render
(
'guang/detail-comment'
,
{
layout
:
false
,
comment
:
ret
...
...
@@ -288,7 +290,11 @@ exports.detail = (req, res, next) => {
shareImg
:
info
.
shareImg
,
sharedTitle
:
info
.
title
,
shareDesc
:
info
.
desc
,
weixinUrl
:
info
.
weixinUrl
weixinUrl
:
info
.
weixinUrl
,
commentFirstPageUrl
:
helpers
.
urlFormat
(
'/info/index'
,
{
id
:
id
,
pageSize
:
10
},
'guang'
)
}
},
{
title
:
`
$
{
info
.
title
}
|
YOHO
!
BUY
有货
|
年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证`
,
...
...
apps/guang/views/action/guang/detail.hbs
View file @
1399a78
...
...
@@ -142,6 +142,7 @@
<div
id=
"pjax-container"
class=
"comments-wrap"
>
{{>
comment
}}
</div>
<a
href=
"
{{
commentFirstPageUrl
}}
"
data-role=
"comment-first-url"
class=
"hide"
></a>
</div>
{{/
unless
}}
</div>
...
...
config/cache.js
View file @
1399a78
...
...
@@ -17,7 +17,8 @@ const cachePage = {
// 逛
'/guang/'
:
1
*
MINUTE
,
'/guang/info/index'
:
10
*
MINUTE
,
// '/guang/info/index': 10 * MINUTE,
'/guang/detail/:id'
:
10
*
MINUTE
,
'/guang/Index/editor'
:
1
*
MINUTE
,
'/guang/tags/index'
:
1
*
MINUTE
,
...
...
public/js/guang/detail.page.js
View file @
1399a78
...
...
@@ -15,7 +15,8 @@ var $commentList = $commentArea.find('.comments-wrap'),
locating
=
false
,
// 评论页面正在跳转
$commentBtn
=
$
(
'#comment-btn'
),
MAX_COMMENTS_WORDS
=
100
,
$wordCountTip
=
$
(
'#word-count-tip'
);
$wordCountTip
=
$
(
'#word-count-tip'
),
commentLoaded
=
false
;
require
(
'../common'
);
require
(
'./right-side'
);
...
...
@@ -213,10 +214,21 @@ $commentBtn.click(function(e) {
// comment pager pjax
$
(
document
).
pjax
(
'.comment-pager a'
,
'#pjax-container'
,
{
$
(
document
).
pjax
(
'.comment-pager a
, [data-role="comment-first-url"]
'
,
'#pjax-container'
,
{
timeout
:
5000
});
if
(
$
(
'#comment-area'
).
length
)
{
$
(
document
).
on
(
'scroll'
,
function
()
{
if
(
!
commentLoaded
&&
(
$
(
document
).
scrollTop
()
+
$
(
window
).
height
())
>
$
(
'#comment-area'
).
offset
().
top
)
{
commentLoaded
=
true
;
$
(
'[data-role="comment-first-url"]'
).
click
();
}
});
}
// 分页后移动到评论框的位置
$
(
document
).
on
(
'pjax:end'
,
function
()
{
showComment
();
...
...
Please
register
or
login
to post a comment