+1
下载客户端

苹果IOS

安卓

弹幕
冰晶 中国大熊猫保护研究中心
分享:
评论

加载中

手机访问
返回顶部

我来说两句

我要评论取消

提交

微笑
机智
捂脸
惊恐
奸笑
疑问
抓狂
耶
抠鼻
亲亲

'+content[i].author+'

'+tranMessage(content[i].message)+'

查看全文
'+getDateDiff(content[i].dateline)+'回复
'; } zanurl+='&jsonp_callback=?&r='+new Date().getTime(); //获取评论点赞数 $.ajax({ url:zanurl, type:"get", dataType:"jsonp", jsonp:"cb", jsonpCallback:"hqpldz", cache:true, success: function(data){ var zanobj=data.data; for(var b in zanobj){ $("#"+b).html(unitConversion(zanobj[b])) } }, timeout:8000, error:function(){} }); $(".ind_pinlun ul").append(contentHtml); //评论模块评论回复功能 $(".ind_pinlun ul li .content .plinfo .reply").click(function(){//点击评论窗口判断是否登录 if(userid == null){ location.href = "//www.ipanda.com/xm/include/mobledeng/index.shtml?service="+ encodeURIComponent(window.location.href); }else{ yemianScrollTop=(document.documentElement.scrollTop || document.body.scrollTop); var zhuNickName=$(this).parents("li").find(".people p").text(); if(isReal==0){ $('#pl_textarea').attr('placeholder','根据法律法规要求,请您绑定手机号完成后台实名认证后发表评论。感谢您的理解和支持!'); }else{ $('#pl_textarea').attr('placeholder','回复'+zhuNickName); //登录之后要获取登录名 } // $('.page_wrap').hide();//2018年11月26日zht修改hide为定位 $('.page_wrap').css({'position':'absolute','top':'0','left':'-9999'}) $('.ind_footersearch2_xq18058').css({'position':'absolute','bottom':'0','left':'-9999'}) $(".allcontent").css("display","none"); $(".XUQIU18897_pinglun").css("display","none"); $(".XUQIU18897_tonglan").css("display","none"); $(".footer").css("display","none"); $('#ind_pinglunlayer_xq18058').show(); $(".ind_pinglunlayer_xq18058").removeClass('ind_pinglun_18058_click').addClass("reply_click"); immediately("pl_textarea"); tid=$(this).attr("tid"); replyid=$(this).attr("pid"); initSwiperbiaoqing();//表清包默认加载 } }) //评论模块点赞绑定点击 $(".ind_pinlun ul li .content .plinfo .pointnumber").click(function(){ var num=parseInt($(this).html()); if ($(this).hasClass("cur")) { return; }else{ $(this).addClass("cur"); num=num+1; addDianZanNum($(this).attr("id")); $(this).html(unitConversion(num)); } $(this).addClass("yinying"); }) for (var i=0; iliuyanLineheight) { liuyanHeight=$(lis).eq(i).find(".content").find(".text").addClass("chakan"); }else{ $(lis).eq(i).find(".content").find(".text").removeClass("chakan"); $(lis).eq(i).find(".content").find(".textall").css("display","none"); } } $(".ind_pinlun ul li .content .textall").click(function(){ if($(this).hasClass("chakan")){ $(this).removeClass("chakan").addClass("shouqi"); $(this).parent().find(".text").removeClass("chakan"); $(this).text("收起全文"); }else{ $(this).removeClass("shouqi").addClass("chakan"); $(this).parent().find(".text").addClass("chakan"); $(this).text("查看全文"); } }) }else{ $(".playingCon .gongneng .share a").html("评论"); $("#comment").css("display","none"); $(".XUQIU18897_pinglun .comment").css("display","none"); if(window.innerWidth <= 1024){ $("#content").css("padding-bottom","0.35rem"); } $("#pinglunNum").text("评论");//没有评论的时候显示评论不显示0 } } }); } //替换图片 function tranMessage(message){ var arrbiaoqing = [ '微笑', '机智', '捂脸', '惊恐', '奸笑', '疑问', '抓狂', '耶', '抠鼻', '亲亲' ]; var message = message.replace(/\[\/([\u4E00-\u9FA5A-Za-z0-9]+)\]/g, function(item, index){ switch(index){ case "微笑": return arrbiaoqing[0] break; case "机智": return arrbiaoqing[1] break; case "捂脸": return arrbiaoqing[2] break; case "惊恐": return arrbiaoqing[3] break; case "奸笑": return arrbiaoqing[4] break; case "疑问": return arrbiaoqing[5] break; case "抓狂": return arrbiaoqing[6] break; case "耶": return arrbiaoqing[7] break; case "抠鼻": return arrbiaoqing[8] break; case "亲亲": return arrbiaoqing[9] break; default : return index } }); return message; } //点赞数值转换 function unitConversion(n){ var num=n; if(n>10000 && n<100000000){ num= (n/10000).toFixed(1)+'万'; //小数点后一位四舍五入 } if(n>100000000){ num = (n/100000000).toFixed(1)+"亿"; } return num } //增加点赞数 function addDianZanNum(id){ var url = '//api.itv.cntv.cn/praise/add?type=other&id='+id+'&num=1&jsonp_callback=cb' $.ajax({ url:url, dataType:"jsonp", jsonp:"jsonp_callback",// 重写回调函数名字 jsonpCallback:"dianzan", cache:true, error:function(){}, success:function(data){ } }); } /*--登录取Cookie-*/ function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return unescape(arr[2]); else return null } //获取用户昵称 var userid = getCookie('userSeqId');//用户id var verifycode = getCookie('verifycode');//验证码 var itemtype = 2; var namecookie = "";//用户昵称 var tid,replyid;//tid和replyid if(verifycode != "" && verifycode != null && verifycode != undefined) { //当code存在时检查登录状态 checklogn() }else{ getuseid() } function checklogn() { $.ajax({ type: "get", url: "//reg.cctv.com/openapi/v2/user/checkLogin", dataType: "json", data: { "timestamp": timestamp, //当前时间戳 "appid": "SFHdfcuLDsJzgjmP" //管理员分配给业务线应用的唯一标识 }, headers: { "verifycode": verifycode }, success: function(data) { if(data.code == 0) { getuseid() } else { } } }); } function getuseid() { //用户id不存在获取ticket,在获取用户id var tlurl = "//reg.cctv.com/openapi/v2/user/getTicket"; $.ajax({ type: "get", url: tlurl, dataType: "json", data: { "timestamp": timestamp, //当前时间戳 "appid": "SFHdfcuLDsJzgjmP" //管理员分配给业务线应用的唯一标识 }, headers: { "verifycode": verifycode }, success: function(data) { if(data.code == "0") { var ticket = data.data; var utlurl = "//reg.cctv.com/openapi/v2/user/userInfoByTicket"; $.ajax({ type: "get", url: utlurl, dataType: "json", data: { "timestamp": timestamp, //当前时间戳 "appid": "dgtGyfXwN9Gcr7ow", //管理员分配给业务线应用的唯一标识 "ticket": ticket }, headers: { "verifycode": verifycode }, success: function(data) { if(data.code == "0") { uid = data.data.user_id; getNickNameAndFace() var expires = new Date().getTime() + 24 * 60 * 60 * 1000 * 15; document.cookie = "userSeqId" + "=" + uid + "; expires=" + expires + "; domain=" + ".ipanda.com" + "; path=/"; } } }) } } }) } function getNickNameAndFace(){ muurl='//reg.cctv.cn/openapi/v2/user/getNickNameAndFace'; $.ajax({ url : muurl, type : 'GET', dataType : 'json', data:{ "timestamp":timestamp, "appid":"dgtGyfXwN9Gcr7ow", "verifycode":verifycode, "type":"ALL" }, xhrFields: { withCredentials: true }, crossDomain: true, cache:true, success : function(data) { if(data.code ==0){ namecookie = data.data.nickname; } } }) isAuthrl() } function isAuthrl(){ $.ajax({ type: "post", url: "//reg.cctv.cn/openapi/v2/user/isAuth", dataType: "json", data: { "timestamp": timestamp, //当前时间戳 "appid": "dgtGyfXwN9Gcr7ow" //管理员分配给业务线应用的唯一标识 }, xhrFields: { withCredentials: true }, crossDomain: true, //添加跨域参数是为了将登录标识(token)带过去验证 success: function(data) { if(data.data == 0) { //不是 } else { isReal=1; } } }); } //实名验证 $(".ind_pinglunlayer_xq18058 .ZWind_pingluninput .pl_textarea").focus(function(){ if(isReal==0){ $(".ind_pinglunlayer_xq18058 .ZWind_pingluninput .pl_textarea").blur(); window.location.href= "//reg.cctv.com/authentication?formFlag=3&flag=H5&userSeqId="+userid+"&service="+window.location.href; }else{ return; } }) //评论取消功能 $("#ind_pinglunlayer_xq18058 .cancel").bind("click",function(){ //$('#pl_textarea').val(""); //$('#ind_pinglunlayer_xq18058 .tijiao').removeClass("cur"); $("#ind_pinglunlayer_xq18058").hide(); $(".XUQIU18897_fuceng").siblings("div").show() $(".allcontent").css("display","block"); $(".XUQIU18897_pinglun").css("display","block"); $(".ind_footersearch2_xq18058_cemg").css("display","block"); $(".xmpdgqqt17036_cover_box").css("display","none"); $(".shoucangFloat").css("display","none"); // $(".page_wrap").show(); $('.ind_footersearch2_xq18058').css({'position':'fixed','bottom':'0','left':'0','right':'0'}) $('.page_wrap').css({'position':'relative','top':'0','left':'0'}) document.body.scrollTop = document.documentElement.scrollTop =yemianScrollTop; }) //评论提交功能 $("#ind_pinglunlayer_xq18058 .tijiao.cur").live("click",function(){ var $inputarea=$("#ind_pinglunlayer_xq18058 .pl_textarea"); var text_val=$inputarea.val(); if(verifycode!=null&&verifycode!=""){ if(text_val.length>100){ $("#ind_pinglun_fuceng_xq18058").find("p").html("回复字数最多100字符") $("#ind_pinglun_fuceng_xq18058").css("display","block"); setTimeout(function(){ $("#ind_pinglun_fuceng_xq18058").css("display","none"); },1000); return; } if($(".ind_pinglunlayer_xq18058").hasClass("reply_click")){ var datas= {"app":barrageApp,"itemid":itemid,"itemtype":itemtype,"tid":tid,"replyid":replyid,"message":text_val,"authorid":userid,"author":namecookie,"jsonp_callback":"liuyan_callback"}; }else{ var datas= {"app":barrageApp,"itemid":itemid,"itemtype":itemtype,"message":text_val,"verifycode":verifycode,"authorid":userid,"author":namecookie,"jsonp_callback":"liuyan_callback"}; } var url=" //newcomment.cctv.com/comment/post?"+$.param(datas); var scriptid="liuyan_callback"; loadJsnew(scriptid,url); } $inputarea.blur(); $(this).removeClass("cur"); //shuRuNotNull(); }) //判断评论框是否为空 function isNull(str){ var resultStr = str.replace(/[ ]/g, ""); //去掉空格 resultStr = resultStr.replace(/[\r\n]/g, ""); //去掉回车换行 if ( resultStr == "" ) return true; } //监听评论框是否有内容 function immediately(textareaid){ if($("#"+textareaid).length>0){ var element = document.getElementById(textareaid); if("\v"=="v") { element.onpropertychange = webChange; }else{ element.addEventListener("input",webChange,false); } function webChange(){ if(element.value!="" && !isNull(element.value)){ $("#"+textareaid).next(".tijiao").addClass("cur"); }else{ $("#"+textareaid).next(".tijiao").removeClass("cur"); } } } } //加载接口数据 function loadJsnew(id,newJS){ var oldjs = document.getElementById(id); if(oldjs) oldjs.parentNode.removeChild(oldjs); var scriptObj = document.createElement("script"); scriptObj.src = newJS; scriptObj.type = "text/javascript"; scriptObj.id = id; document.getElementsByTagName("head")[0].appendChild(scriptObj); } //留言回调函数 function liuyan_callback(data){ var code = data.code; if(code=="20927"){ window.location.href= "//reg.cctv.com/authentication?formFlag=3&flag=H5&userSeqId="+userid+"&service="+window.location.href; }else if(code=='0') { $("textarea").val(""); shuRuNotNull(); }else if(code=="20000"){ if(data.msg=="留言数据不符合要求"){ $("#ind_pinglun_fuceng_xq18058").find("p").html("回复字数最多100字符") $("#ind_pinglun_fuceng_xq18058").css("display","block"); setTimeout(function(){ $("#ind_pinglun_fuceng_xq18058").css("display","none"); },1000); }else if(data.msg=="必须登录才能留言"){ location.href = "//www.ipanda.com/xm/include/mobledeng/index.shtml?service=" + encodeURIComponent(window.location.href); } } } //评论成功提示语 function shuRuNotNull(){ $("#ind_pinglun_fuceng_xq18058").find("p").html("评论发布成功
审核通过后即可看见您的评论"); $("#ind_pinglun_fuceng_xq18058").show(); setTimeout(function(){ $(".XUQIU18897_fuceng").siblings("div").show() $(".allcontent").css("display","block"); $(".XUQIU18897_pinglun").css("display","block"); $(".XUQIU18897_tonglan").css("display","block"); $(".allcontent").css("display","block"); $(".XUQIU18897_pinglun").css("display","block"); $(".XUQIU18897_tonglan").css("display","block"); $(".ind_pinglunlayer_xq18058").css("display","none"); $(".footer").css("display","block"); $("#ind_pinglun_fuceng_xq18058").hide(); $("#ind_pinglunlayer_xq18058").hide(); // $(".page_wrap").show(); $(".XUQIU18897_fuceng").siblings("div").show() $(".allcontent").css("display","block"); $(".XUQIU18897_pinglun").css("display","block"); $(".ind_footersearch2_xq18058_cemg").css("display","block"); $(".xmpdgqqt17036_cover_box").css("display","none"); $(".shoucangFloat").css("display","none"); $('.ind_footersearch2_xq18058').css({'position':'fixed','bottom':'0','left':'0'}) $('.page_wrap').css({'position':'relative','top':'0','left':'0'}) document.body.scrollTop = document.documentElement.scrollTop =yemianScrollTop; },1000) } //底部浮层评论 $(".ind_footersearch2_xq18058 .pinglun").bind("click",function(){ window.open("//v.cctv.com/bhy/pinglun/index.shtml?id="+itemid+"-"+barrageApp,'_self'); }) //底部浮层-我来说两句 $('.ind_footersearch2_xq18058 p').click(function(event){ if(verifycode == null){ location.href= "//www.ipanda.com/xm/include/mobledeng/index.shtml?service="+ encodeURIComponent(window.location.href); }else{ yemianScrollTop=(document.documentElement.scrollTop || document.body.scrollTop); $('.ind_footersearch2_xq18058').css({'position':"absolute",'bottom':'0','left':'-9999'}); $(".page_wrap").css({'position':"absolute",'top':'0','left':'-9999'}); if(isReal==0){ $('#pl_textarea').attr('placeholder','根据法律法规要求,请您绑定手机号完成后台实名认证后发表评论。感谢您的理解和支持!'); }else{ $('#pl_textarea').attr('placeholder','请理性评论,文明发言'); } $(".ind_pinglunlayer_xq18058").addClass("ind_pinglun_18058_click").removeClass("reply_click"); $('#ind_pinglunlayer_xq18058').show(); immediately("pl_textarea"); $(".XUQIU18897_fuceng").siblings("div").hide() $(".allcontent").css("display","none"); $(".XUQIU18897_pinglun").css("display","none"); $(".XUQIU18897_tonglan").css("display","none"); $(".ind_footersearch2_xq18058_cemg").css("display","none"); $(".footer").css("display","none"); initSwiperbiaoqing();//表清包默认加载 } }); $("#pl_textarea").on('select',function () { focusidex= getCursortPosition(this); }).on('click',function () { focusidex= getCursortPosition(this); }).on('keyup',function () { focusidex= getCursortPosition(this); })