Commit 349ac0d3 authored by 夏彬's avatar 夏彬

Merge remote-tracking branch 'origin/test' into test

parents 8504393b 107339d9
......@@ -307,6 +307,12 @@
.portal-news-info span.time {
padding-left: 0;
}
.portal-news-info span.time b {
font-weight: normal;
border: 1px solid #ccc;
padding: 2px 4px;
border-radius: 3px;
}
.pb-none {
padding-bottom: 0!important;
}
......@@ -336,7 +342,7 @@
color: #fff;
line-height: 50px;
text-align: center;
font-size: 24px;
font-size: 20px;
}
.hot-nav ul li a i {
......@@ -366,4 +372,17 @@
background-color: #ffa42f;
}
/*hot news*/
.related-news {
padding: 20px 0;
background-color: #f9f9f9;
border-bottom: 1px solid #e7e7e7;
}
.related-news > .news-item {
background-color: #f9f9f9;
}
.related-news > .news-item:last-child {
border-bottom: none;
}
......@@ -410,8 +410,9 @@
/*CONTENT*/
.main-content {
padding: 15px 15px 0;
padding: 15px;
background-color: #fff;
border-bottom: 1px solid #e7e7e7;
}
.main-content .tit h1 {
font-family: PingFang SC,Lantinghei SC,Helvetica Neue,Helvetica,Arial,Microsoft YaHei,\\5FAE\8F6F\96C5\9ED1,STHeitiSC-Light,simsun,\\5B8B\4F53,WenQuanYi Zen Hei,WenQuanYi Micro Hei,"sans-serif";
......
var newsid = $("input[name='newsid']").val();
//评论
$(".send-pl").click(function () {
var data = {
'newsid': newsid,
'content': $.trim($("textarea[name='content']").val())
};
var self = this;
if (!data['newsid']) {
pop('参数错误');
return false;
}
if (!data['content']) {
pop('评论内容不能为空');
return false;
}
$(self).attr("disabled", true);
$.post("/e/action/news/comment.php?mod=create", data, function (e) {
$(self).attr("disabled", false);
if (e.status) {
$("textarea[name='content']").val('');
var html = tpl(e.data);
$(".comment-list").prepend(html);
$(".comment-send-box").hide();
$('.mask').hide();
} else {
pop(e.msg, e.data);
}
}, 'json');
});
function comments() {
var lastplid = $(".comment-list li:last-child").attr('data-id');
lastplid = lastplid ? lastplid : 0;
$.post("/e/action/news/comment.php", {newsid: newsid, lastplid: lastplid}, function (e) {
if (!$.isEmptyObject(e.data)) {
var comments = e.data;
var html = '';
for (i in comments) {
html += tpl(comments[i]);
}
$(".comment-list").html(html);
}
}, 'json');
}
function tpl(comment) {
var html = '<li data-id="'+ comment.id +'">\
<img src="' + comment.avatar + '">\
<div class="name">' + comment.nickname + '</div>\
<div class="comment-main">' + comment.content + '</div>\
<div class="comment-footbar clearfix">\
<span>' + comment.created_at + '</span>\
<a href="javascript:popReplyComment(' + comment.id + ');" class="pl-reply"><i class="iconfont icon-comment_light"></i>回复</a> \
<a href="javascript:likeComment(' + comment.id + ', ' + comment.islike + ');" class="pl-zan"><i class="iconfont '+(comment.islike?"icon-zan-fill":"icon-zan")+'"></i>赞</a> \
</div>';
if (!$.isEmptyObject(comment.reply)) {
var replys = comment.reply;
html += '<div class="comment-replay">';
for (i in replys) {
html += '<div class="comment-replay-list"><span>'+replys[i].nickname+':</span>'+replys[i].content+' <span>'+replys[i].created_at+'</span></div>';
}
html += '</div>';
}
return html + '</li>';
}
//回复弹窗
function popReplyComment(id) {
var parent = $('.comment-list').find('> li[data-id='+id+']');
var name = parent.find('> .name').text() + ':';
var content = parent.find('> .comment-main').text();
$('#reply-name').text(name);
$('#reply-content').text(content);
$("#maskCommon").show();
$(".comment-reply").show();
$("input[name='plid']").val(id);
}
//回复评论
$(".reply-pl").click(function () {
var data = {
'newsid': newsid,
'plid': $("input[name='plid']").val(),
'content': $.trim($("textarea[name='replycontent']").val())
};
var self = this;
if (!data['newsid'] || !data['plid']) {
pop('参数错误');
return false;
}
if (!data['content']) {
pop('评论内容不能为空');
return false;
}
$(self).attr("disabled", true);
$.post("/e/action/news/comment.php?mod=reply", data, function (e) {
$(self).attr("disabled", false);
if (e.status) {
handelReplyComment(data.plid, e.data);
$("textarea[name='replycontent']").val('');
$(".comment-reply").hide();
$('.mask').hide();
} else {
pop(e.msg, e.data);
}
}, 'json');
});
function handelReplyComment(plid, comment) {
$.each( $('.comment-list li'), function(){
if ($(this).attr('data-id') == plid) {
var html = '';
if($(this).children(".comment-replay").html()) {
html = '<div class="comment-replay-list"><span>'+comment.nickname+':</span>'+comment.content+' <span>'+comment.created_at+'</span></div>';
$(this).children(".comment-replay").append(html);
} else {
html = '<div class="comment-replay">\
<div class="comment-replay-list"><span>'+comment.nickname+':</span>'+comment.content+' <span>'+comment.created_at+'</span></div>\
</div>';
$(this).append(html);
}
}
});
}
//评论点赞
function likeComment(plid, islike) {
if (islike) {
return false;
}
$.post("/e/action/news/comment.php?mod=like", {plid: plid}, function (e) {
if (e.status) {
$.each( $('.comment-list li'), function(){
if ($(this).attr('data-id') == plid) {
$(this).find(".icon-zan").addClass("icon-zan-fill").removeClass("icon-zan");
}
});
} else {
pop(e.msg, e.data);
}
}, 'json');
}
function pop(msg, islogin) {
if (islogin === 'nologin') {
location.href = "/e/member/login";
return false;
}
layer.msg(msg);
}
var isLoading = false;
var scrollLoad = $("#scrollLoad");
var spinner = "/skin/default/images/spinner-rosetta-blue-26x26.gif";
var preload = new Image();
preload.src = spinner;
function scrollLoading() {
var currentBottom = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
if ($(document).height() <= currentBottom) {
if (!isLoading) {
isLoading = true;
var lastplid = $(".comment-list li:last-child").attr('data-id');
lastplid = lastplid ? lastplid : 0;
scrollLoad.html("<img src='" + spinner + "'>");
$.post("/e/action/news/comment.php", {newsid:newsid, lastplid:lastplid}, function (e) {
if (!$.isEmptyObject(e.data)) {
var comments = e.data;
var html = '';
for (i in comments) {
html += tpl(comments[i]);
}
$(".comment-list").append(html);
} else {
scrollLoad.html("全部加载完毕");
$(window).off("scroll", scrollLoading);
setTimeout(function() {
scrollLoad.slideUp();
}, 1000);
}
isLoading = false;
}, 'json');
}
}
}
if (scrollLoad.length > 0) {
comments();
$(window).on("scroll", scrollLoading);
scrollLoading();
}
//init
$.post("/e/action/news/index.php?mod=init", {newsid: newsid}, function (e) {
//点赞
if (e.data.isdiggtop) {
$("#zan").find('i').removeClass('icon-zan').addClass('icon-zan-fill');
} else {
diggtop();
}
//收藏
if (e.data.isfava) {
$('#favor').find('i').removeClass('icon-favor').addClass('icon-favor-fill');
}
}, 'json');
//点赞
function diggtop() {
$('#zan').one('click',function () {
$.post("/e/action/news/index.php?mod=diggtop", {newsid: newsid}, function (e) {
if (e.status) {
$("#zan").find('i').removeClass('icon-zan').addClass('icon-zan-fill');
$('.zan-tip').animate({opacity: "1", top: "-=30"},500).animate({opacity: "0", top: "-30"}, "slow");
} else {
pop(e.msg, e.data);
}
}, 'json');
});
}
//收藏
$('#favor').click(function () {
var self = this;
var fill = $(self).find("i").hasClass("icon-favor");
$.post("/e/action/news/index.php?mod=favorite", {newsid: newsid}, function (e) {
if (e.status) {
if (fill) {
$(self).find('i').removeClass('icon-favor').addClass('icon-favor-fill');
} else {
$(self).find('i').removeClass('icon-favor-fill').addClass('icon-favor');
}
} else {
pop(e.msg, e.data);
}
}, 'json');
});
(function($) {
//加载乐视视频
$("div.lecloud-video").each(function() {
var width = 640, height = 360, rate = width / height;
var video = createVideoElement(width, height);
$("#videoPlayer").append(video);
//按设定的比例调整大小
var pNode = video.parentNode,
toWidth = pNode.clientWidth >= 1024 ? 1024 : pNode.clientWidth,
toHeight = toWidth / rate;
//视频浮动站位
$('.video-empty-block').height(toHeight);
setVideo(video, $(this).attr('vu'), toWidth, toHeight);
$(this).remove();
});
function createVideoElement(w, h) {
var node = document.createElement('iframe');
node.setAttribute("allowfullscreen", true);
node.setAttribute("allowtransparency", true);
node.setAttribute("frameborder", "0");
node.setAttribute("scrolling", "no");
//node.setAttribute("width", w);
//node.setAttribute("height", h);
node.style.maxWidth = "100%";
return node;
}
function setVideo(node, vu, w, h) {
node.setAttribute("width", w);
node.setAttribute("height", h);
node.src = 'http://yuntv.letv.com/bcloud.html?uu=pjseptwfce&vu=' + vu + '&pu=510360dfc7&auto_play=1&width=' + w + '&height=' + h + '&lang=zh_CN';
}
})(jQuery);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment