...
|
...
|
@@ -28,19 +28,21 @@ require("./login"); |
|
|
publishUrl: '/writer/default/publish',
|
|
|
deleteUrl: '/writer/default/delete',
|
|
|
commentNum: $(".comment-num"),
|
|
|
commentItemTpl: '<li class="clearfix">' +
|
|
|
commentItemTpl: '\{{# comment}}' +
|
|
|
'<li class="clearfix">' +
|
|
|
'<div class="userimg">' +
|
|
|
'<img src="\{{userimg}}" alt="">' +
|
|
|
'<img src="\{{headpic}}" alt="">' +
|
|
|
'<i class="\{{partnerType}}"></i>' +
|
|
|
'</div>' +
|
|
|
'<div class="userinfo">' +
|
|
|
'<h6>\{{username}}</h6> ' +
|
|
|
'<h6>\{{nick}}</h6> ' +
|
|
|
'<p class="comment-text">\{{content}}</p>' +
|
|
|
'\{{# isSelf}}' +
|
|
|
'<a class="delete-comment" href="javascript:;" pid="{{id}}"></a>' +
|
|
|
'\{{/ isSelf}} ' +
|
|
|
'</div>' +
|
|
|
'</li>',
|
|
|
'</li>' +
|
|
|
'\{{/ comment}}',
|
|
|
thirdLogin: false,
|
|
|
isEdit: false,
|
|
|
isMobile: false,
|
...
|
...
|
@@ -80,7 +82,6 @@ require("./login"); |
|
|
dataType: 'jsonp',
|
|
|
jsonp: 'callback',
|
|
|
success: function(response) {
|
|
|
console.log(response);
|
|
|
var data = response.data, //返回数据的data
|
|
|
viewMoreNum = data.total - 5, //评论总数-5,除显示评论剩下的评论数量
|
|
|
moreString = viewMoreNum + '', //剩余评论数量转为字符串
|
...
|
...
|
@@ -345,18 +346,32 @@ require("./login"); |
|
|
var url = $(this).attr("href"),
|
|
|
pageHtml,
|
|
|
pageIcon,
|
|
|
commentListTop;
|
|
|
pageList,
|
|
|
pageData,
|
|
|
commentListTop,
|
|
|
pageTpl = '\{{# pageList}}' +
|
|
|
'<a class="pager-item \{{# isChoosen}}pager-item-choosen\{{/ isChoosen}}" href="\{{link}}">\{{text}}</a>' +
|
|
|
'\{{/ pageList}}'; //引入评论html模板
|
|
|
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
url: url + '?id=' + that.options.cid,
|
|
|
dataType: 'jsonp',
|
|
|
jsonp: 'callback',
|
|
|
success: function(response) {
|
|
|
$(".comments-list").empty();
|
|
|
pageHtml = mustache.render(that.options.commentItemTpl, response.data.comment);
|
|
|
pageList = {
|
|
|
comment: response.data.comment
|
|
|
}
|
|
|
pageHtml = mustache.render(that.options.commentItemTpl, pageList);
|
|
|
|
|
|
$(".comments-list").html(pageHtml);
|
|
|
|
|
|
pageIcon = $('<div class="channel-index-pager">' + response.data.page + '</div>');
|
|
|
$(".comment-pager-content").html(pageIcon);
|
|
|
pageData = {
|
|
|
pageList: response.data.page
|
|
|
}
|
|
|
pageIcon = mustache.render(pageTpl, pageData);
|
|
|
console.log(pageIcon);
|
|
|
$('.channel-index-pager').html($(pageIcon));
|
|
|
|
|
|
commentListTop = $(".comments-list").offset().top - $("#minEnterprise").outerHeight();
|
|
|
$(window).scrollTop(commentListTop);
|
...
|
...
|
|