portal html css js resource

articalShow.js 29KB

    /*文章预览*/ var articleId = GetQueryString("articleId"); var userid = $.cookie("userid"); var zjreturnId; var wzreturnId; var experarray = []; var createTime,orderKey; $(function() { loginStatus();//判断个人是否登录 articleshow(); relevantExperts(); relevantResources(); //判断是否登录转态 if(userid && userid != "null" && userid != null){ $(".ifLoginOn").removeClass("displayNone"); }else{ $(".ifLoginUn").removeClass("displayNone"); } //最近文章 function recentlyArticle(num,obj) { var ourl=num==1?"/ajax/article/qaOrgPublish":"/ajax/article/qaProPublish"; $.ajax({ "url" :ourl , "type" : "GET" , "dataType" : "json", "data" :obj, "success" : function(data) { if (data.success){ var $data=data.data; var only=false; if($data.length>1){ $(".recentlyList").parents(".currentBlock").removeClass("displayNone"); var oLeng=$data.length<5?$data.length:5; for(var i=0;i<oLeng;i++) { if(articleId==$data[i].articleId) { only=true; continue; } if(only==true) { if(oLeng<5) { }else{ oLeng=6; } } var str='<li>'+ '<a href="articalShow.html?articleId='+$data[i].articleId+'"><p class="h2Font ellipsisSty-2"><em class="circlePre"></em>'+$data[i].articleTitle+'</p>'+ '<span class="smalltip">'+commenTime($data[i].publishTime)+'</span></a></li>' $(".recentlyList").append(str); } } } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } //初始化文章内容 function articleshow(){ $.ajax({ "url" : "/ajax/article/query", "type" : "GET" , "dataType" : "json", "data" :{"articleId":articleId}, "success" : function(data) { if (data.success){ $("#articleTitle").text(data.data.articleTitle); $("#pageViews").text("阅读量 "+data.data.pageViews); $("#publishTime").text(commenTime(data.data.publishTime)); $("#articleContent").html(data.data.articleContent); $("#articleImg").attr("style", "background-image: url(/data/article/" + data.data.articleImg + ");"); $("#tagList").text(industryShow(data.data.subject)); if (userid && userid != "null" && userid != null) { isAgree(data.data.articleAgree)//文章点赞 }else{ $(".thumbBtn").html("赞 <span>"+data.data.articleAgree+"</span>"); } ifcollectionAbout(articleId,$("#attention").find("em"), 3) if(data.data.articleType==1){ $("#expert").removeClass("displayNone"); relevantarticalList(data.data.professorId,1); expert(data.data.professorId); recentlyArticle(2,{"professorId":data.data.professorId}) } if(data.data.articleType==2){ $("#enterprise").removeClass("displayNone"); relevantarticalList(data.data.orgId,2); cmpFun(data.data.orgId); companylist(); recentlyArticle(1,{"orgId":data.data.orgId}); } var weibotitle = data.data.articleTitle; var weibourl =window.location.href; var weibopic ="http://"+window.location.host+"/data/article/" + data.data.articleImg; $("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+encodeURIComponent(weibotitle)+"&url="+encodeURIComponent(weibourl)+"&pic="+encodeURIComponent(weibopic)+"&content=utf-8"+"&ralateUid=6242830109&searchPic=false&style=simple"); } var articletitle = data.data.articleTitle + "-科袖网"; window.setTimeout(function() { document.title = articletitle; }, 500); }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } //专家信息 function expert(professorId){ $.ajax({ "url" : "/ajax/professor/baseInfo/"+professorId, "type" : "GET" , "dataType" : "json", "success" : function(data) { if (data.success && data.data){ if(data.data.hasHeadImage==1) { $("#Zimg,.userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);"); } if(data.data.title==""){ var title = data.data.office; }else{ var title = data.data.title; } $("#Zname,.username").text(data.data.name); $("#Zname").attr("dataid",data.data.id); $(".hrefgo,.useurl").attr("href", "userInforShow.html?professorId="+data.data.id); $("#Ztitle").text(title); $("#ZorgName").text(data.data.orgName); var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus); $("#ZauthFlag,.labels").attr("title", userType.title); $("#ZauthFlag,.labels").addClass(userType.sty); if(data.data.id!=userid){ $("#expert").find(".goSpan").removeClass("displayNone"); ifcollectionAbout(data.data.id,$("#expert").find(".attenSpan"), 1) } } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } /*企业用户信息*/ function cmpFun(orgId) { $.ajax({ "url": "/ajax/org/" + orgId, "type": "get", "dataType" : "json", "success": function(data) { if(data.success && data.data) { $(".userimg").removeClass("useHead"); if(data.data.forShort) { $("#Qname,.username").text(data.data.forShort); }else{ $("#Qname,.username").text(data.data.name); } $("#Qname").attr("dataid",data.data.id); $(".qiyego,.useurl").attr("href", "cmpInforShow.html?orgId="+data.data.id); if(data.data.hasOrgLogo) { $(".userimg").attr("style","background: #fff;") $(".userimg").html('<div class="boxBlock" style="width:50px;height:50px"><img class="boxBlockimg" src="" id="companyImg2"></div>'); $("#companyImg,#companyImg2").attr("src", "/images/org/" + data.data.id + ".jpg"); }else{ $("#companyImg,#companyImg2").attr("src", "/images/default-icon.jpg"); } if(data.data.authStatus==3){ $("#QauthFlag,.labels").addClass("authicon-com-ok").attr("title", "认证企业");; } $("#Qindustry").text(QindustryShow(data.data.industry)); $("#QorgType").text(orgTypeShow[data.data.orgType]) if(userid){ ifcollectionAbout(data.data.id,$("#enterprise").find(".attenSpan"), 6) } } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } //相关专家 function relevantExperts(){ $.ajax({ "url": "/ajax/article/ralatePro", "type": "get", "dataType" : "json", "data" :{"articleId":articleId}, "success": function(data) { if(data.success && data.data) { for(var i = 0; i < data.data.length; i++) { var professorId = data.data[i].professorId; relevantExpertsList(professorId) } } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } //相关专家信息 function relevantExpertsList(professorId){ $.ajax({ "url" : "/ajax/professor/info/"+professorId, "type" : "GET" , "dataType" : "json", "success" : function(data) { if (data.success && data.data!=""){ $("#relevantExperts").parent().parent().removeClass("displayNone"); var itemlist = ''; $("#trelevantExperts").html(""); var itemlist = '<li><a href="" class="flexCenter urlgo" style="min-height:80px;">'; itemlist += '<div class="madiaHead useHead" id="userimg"></div>'; itemlist += '<div class="madiaInfo">'; itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>'; itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>'; itemlist += '<p class="h2Font ellipsisSty" id="researchAreas"></p>'; itemlist += '</div></a></li>'; $itemlist = $(itemlist); $("#relevantExperts").append($itemlist); if(data.data.title) { if(data.data.orgName) { $itemlist.find("#usertitle").text(data.data.title +","+ data.data.orgName); }else{ $itemlist.find("#usertitle").text(data.data.title); } }else{ if(data.data.office) { if(data.data.orgName) { $itemlist.find("#usertitle").text(data.data.office +","+ data.data.orgName); }else{ $itemlist.find("#usertitle").text(data.data.office); } }else{ if(data.data.orgName) { $itemlist.find("#usertitle").text(data.data.orgName); } } } $itemlist.find("#userName").text(data.data.name); $itemlist.find(".urlgo").attr("href", "userInforShow.html?professorId="+data.data.id); /*获取研究方向信息*/ var researchAreas = data.data.researchAreas; if(researchAreas != ""){ var rlist = '研究方向:'; }else{ var rlist = ''; } for(var n = 0; n < researchAreas.length; n++) { //console.log(researchAreas[n].caption); rlist += researchAreas[n].caption if(n < researchAreas.length - 1) { rlist += ";" } } $itemlist.find("#researchAreas").text(rlist); if(data.data.hasHeadImage == 1) { $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);"); } var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus); $itemlist.find(".authiconNew").attr("title", userType.title); $itemlist.find(".authiconNew").addClass(userType.sty); }else{ $("#relevantExperts").parent().parent().style.display="none"; } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } //相关资源 function relevantResources(){ $.ajax({ "url": "/ajax/article/ralateRes", "type": "get", "dataType" : "json", "data" :{"articleId":articleId}, "success": function(data) { if(data.success && data.data) { for(var i = 0; i < data.data.length; i++) { var resourceId = data.data[i].resourceId; relevantResourcesList(resourceId) } } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } //相关资源信息 function relevantResourcesList(resourceId){ $.ajax({ "url" : "/ajax/resource/queryOne", "type" : "GET" , "dataType" : "json", "data" :{"resourceId":resourceId}, "success" : function(data) { console.log(data); if (data.success && data.data!=""){ $("#resources").parent().parent().removeClass("displayNone"); var itemlist = '<li><a href="" class="flexCenter urlgo">'; itemlist += '<div class="madiaHead resouseHead" id="userimg"></div>'; itemlist += '<div class="madiaInfo">'; itemlist += '<p class="h1Font ellipsisSty" id="resourceName"></p>'; itemlist += '<p><span class="h2Font uname"></span><em class="authiconNew" title="科袖认证专家"></em></p>'; itemlist += '<p class="h2Font ellipsisSty-2" id="Ytname"></p>'; itemlist += '</div></a></li>'; $itemlist = $(itemlist); $("#resources").append($itemlist); var datalist = data.data; $itemlist.find("#resourceName").text(datalist.resourceName); $itemlist.find("#Ytname").text("用途:"+datalist.supportedServices); $itemlist.find(".urlgo").attr("href", "resourceShow.html?resourceId="+datalist.resourceId); if(datalist.images.length > 0) { $itemlist.find("#userimg").attr("style", "background-image: url(/data/resource/" + datalist.images[0].imageSrc + ");"); } if(datalist.resourceType==1){ $itemlist.find(".uname").text(datalist.editProfessor.name); var userType = autho(datalist.editProfessor.authType, datalist.editProfessor.orgAuth, datalist.editProfessor.authStatus); $itemlist.find(".authiconNew").attr("title", userType.title); $itemlist.find(".authiconNew").addClass(userType.sty); } if(datalist.resourceType==2){ if(datalist.organization.forShort){ $itemlist.find(".uname").text(datalist.organization.forShort); }else{ $itemlist.find(".uname").text(datalist.organization.name); } if(datalist.organization.authStatus==3){ $itemlist.find(".authiconNew").addClass("authicon-com-ok").attr("title", "认证企业"); } } } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } function keysli() { $("#tagList li").each(function(i) { var liid = $(this).text(); experarray.push(liid); }); return $.unique(experarray); } //关键词标签点击进去搜索 $(".tagList").on("click","li",function(){ var tagText = $(this).find("p").text(); location.href = "searchNew.html?searchContent=" + tagText + "&tagflag=3"; }) //相关企业 function companylist() { $.ajax({ url:"/ajax/article/ralateOrg", dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 data: { "articleId": articleId, }, timeout: 10000, //超时设置 success: function(data) { if(data.success) { var $data=data.data; if($data.length) { $("#busList").parents(".form-item").show(); } for(var i=0;i<$data.length;i++) { angleBus.call($data[i]) } } }, error: function() { $.MsgBox.Alert('提示', '服务器请求失败') } }); } function angleBus() { $.ajax({ url: "/ajax/org/" +this.orgId, type: "GET", timeout: 10000, dataType: "json", context: $("#busList"), success: function(data) { if(data.success) { busfil.call(this,data.data); } }, error: function(XMLHttpRequest, textStats, errorThrown) { $.MsgBox.Alert('提示', '服务器请求失败') } }) } function busfil($data) { var itemlist = '<li><a href="" target="_blank" class="flexCenter urlgo">'; itemlist += '<div class="madiaHead cmpHead">'; itemlist += '<div class="boxBlock"><img class="boxBlockimg" src="" id="companyImg"></div></div>'; itemlist += '<div class="madiaInfo">'; itemlist += '<p class="h1Font"><span id="orgName"></span><em class="authiconNew"></em></p>'; itemlist += '<p class="h2Font ellipsisSty"><span id="orgTit"></span> <span id="orgOther"></span></p>'; itemlist += '</div></a></li>'; $itemlist = $(itemlist); this.append($itemlist); var datalist = $data; var companyType = datalist.authStatus; if(datalist.forShort) { $itemlist.find("#orgName").text(datalist.forShort); } else { $itemlist.find("#orgName").text(datalist.name); } $itemlist.find(".urlgo").attr("href", "cmpInforShow.html?orgId=" + datalist.id); if(datalist.hasOrgLogo) { $itemlist.find("#companyImg").attr("src", "/images/org/" + datalist.id + ".jpg"); } else { $itemlist.find("#companyImg").attr("src", "/images/default-icon.jpg"); } if(companyType == 3) { $itemlist.find(".authiconNew").addClass("authicon-com-ok").attr("title", "科袖认证企业");; } var orgOther = ""; if(datalist.industry) { orgOther = datalist.industry.replace(/,/gi, " | "); } $itemlist.find("#orgOther").text(orgOther); if(datalist.orgType == "2") { $("#orgTit").html(orgTypeShow[datalist.orgType] + "<span style='margin-right:10px;'></span>"); } } //相关文章信息 function relevantarticalList(id,num){ keysli(); if(num==1){ var data = {"keys":experarray,"professorId":id,"articleId":articleId,"rows":10} } if(num==2){ var data = {"keys":experarray,"orgId":id,"articleId":articleId,"rows":10} } $.ajax({ "url" : "/ajax/article/ralateArticles", "type" : "GET" , "dataType" : "json", "data" :data, //"async":false, "traditional": true, //传数组必须加这个 "success" : function(data) { console.log(data); if (data.success && data.data!=""){ $("#abutartical").parent().parent().removeClass("displayNone"); var itemlist = ''; $("#abutartical").html(""); for(var i = 0; i < data.data.length; i++) { var itemlist = '<li><a href="" class="flexCenter urlgo">'; itemlist += '<div class="madiaHead artHead" id="userimg"></div>'; itemlist += '<div class="madiaInfo">'; itemlist += '<p class="h1Font ellipsisSty" id="resourceName"></p>'; itemlist += '<p><span class="h2Font username2"></span><em class="authiconNew" id="relatedLabels" title="科袖认证专家"></em></p>'; itemlist += '</div></a></li>'; $itemlist = $(itemlist); $("#abutartical").append($itemlist); var datalist = data.data[i]; $itemlist.find("#resourceName").text(datalist.articleTitle); $itemlist.find(".urlgo").attr("href", "articalShow.html?articleId="+datalist.articleId); if(datalist.articleImg!=undefined){ $itemlist.find("#userimg").attr("style", "background-image: url(/data/article/" + datalist.articleImg + ");"); } if(datalist.articleType==1){ $.ajax({ "url" : "/ajax/professor/baseInfo/"+datalist.professorId, "type" : "GET" , "dataType" : "json", "async":false, "success" : function($data) { if ($data.success && $data.data){ $itemlist.find(".username2").text($data.data.name); var userType = autho($data.data.authType, $data.data.orgAuth, $data.data.authStatus); $itemlist.find("#relatedLabels").attr("title", userType.title); $itemlist.find("#relatedLabels").addClass(userType.sty); } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } if(datalist.articleType==2){ $.ajax({ "url" : "/ajax/org/"+datalist.orgId, "type" : "GET" , "dataType" : "json", "async":false, "success" : function($data) { console.log($data) if ($data.success && $data.data){ if($data.data.forShort){ $itemlist.find(".username2").text($data.data.forShort); }else{ $itemlist.find(".username2").text($data.data.name); } if($data.data.authStatus==3){ $itemlist.find("#relatedLabels").addClass("authicon-com-ok").attr("title", "认证企业"); } } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } } } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } //拆解关键字 function industryShow(data){ if(data != undefined && data.length != 0 ){ var subs = new Array(); if(data.indexOf(',')){ subs = data.split(','); }else{ subs[0] = data; } if(subs.length>0){ for (var i = 0; i < subs.length; i++) { $("#tagList").append('<li class="delkeylist"><p class="h2Font">'+ subs[i] +'</p></li>'); }; } } } //拆解企业应用行业 function QindustryShow(data){ if(data != undefined && data.length != 0 ){ var subs = new Array(); subs = data.replace(',',' | '); if(subs.length>0){ for (var i = 0; i < subs.length; i++) { $("#Qindustry").append(subs[i]); }; } } } }); //文章点击点赞 $('.thumbBlock').on("click",".thunbgo",function(){ if (userid && userid != "null" && userid != null) { addAgree(); }else{ $.MsgBox.Alert('提示',"请先登录再进行点赞"); $("#mb_btn_ok").val("去登录"); var aele = document.createElement('a'); $("#mb_btnbox").append(aele); $("#mb_btnbox a").css({ 'display': "block", 'width': '100%', 'height': '40px', 'position': 'absolute', 'bottom': '-6px', 'left': '0' }); aele.setAttribute('href', '../login.html'); } }) /*判断文章是否被赞*/ function isAgree(articleAgree) { var data = {"operateId": userid,"articleId": articleId} $.ajax({ url:"/ajax/article/isAgree", data:data, dataType: 'json', //数据格式类型 type: 'get', //http请求类型 timeout: 10000, async: false, success: function(data) { if(data.success){ if(data.data!= null){ $(".thumbBtn").html("已赞 <span>"+articleAgree+"</span>"); $(".thumbBtn").addClass("thumbedBtn"); }else{ $(".thumbBtn").html("赞 <span>"+articleAgree+"</span>"); $(".thumbBtn").addClass("thunbgo"); } } }, error: function() { $.MsgBox.Alert('提示',"服务器链接超时"); } }); } /*点赞*/ function addAgree() { var data = {"operateId": userid,"articleId": articleId} $.ajax({ url:"/ajax/article/agree", data:data, dataType: 'json', //数据格式类型 type: 'POST', //http请求类型 timeout: 10000, async: false, success: function(data) { if(data.success){ var articleAgreeval = $(".thumbBtn span").text(); $(".thumbBtn").html("已赞 <span>"+(parseInt(articleAgreeval)+1)+"</span>"); $(".thumbBtn").addClass("thumbedBtn"); $(".thumbBtn").removeClass("thunbgo"); } }, error: function() { $.MsgBox.Alert('提示',"服务器链接超时"); } }); } //点击专家关注 $("#expert").on('click','.attenSpan',function(){ if(userid && userid != null && userid != "null") { if($(this).is('.attenedSpan')){ cancelCollectionAbout($("#Zname").attr("dataid"),$(this), 1) } else { collectionAbout($("#Zname").attr("dataid"),$(this), 1); } }else{ $.MsgBox.Alert('提示',"请先登录再进行关注"); $("#mb_btn_ok").val("去登录"); var aele = document.createElement('a'); $("#mb_btnbox").append(aele); $("#mb_btnbox a").css({ 'display': "block", 'width': '100%', 'height': '40px', 'position': 'absolute', 'bottom': '-6px', 'left': '0' }); aele.setAttribute('href', '../login.html'); } }) $("#enterprise").on('click','.attenSpan',function(){ if(userid && userid != null && userid != "null") { if($(this).is('.attenedSpan')){ cancelCollectionAbout($("#Qname").attr("dataid"),$(this), 6) } else { collectionAbout($("#Qname").attr("dataid"),$(this),6); } }else{ $.MsgBox.Alert('提示',"请先登录再进行关注"); $("#mb_btn_ok").val("去登录"); var aele = document.createElement('a'); $("#mb_btnbox").append(aele); $("#mb_btnbox a").css({ 'display': "block", 'width': '100%', 'height': '40px', 'position': 'absolute', 'bottom': '-6px', 'left': '0' }); aele.setAttribute('href', '../login.html'); } }) //点击文章收藏 $('#attention').on("click","em",function(){ if (userid && userid != "null" && userid != null) { if($(this).is('.icon-collected')){ cancelCollectionAbout(articleId,$(this),3) }else{ collectionAbout(articleId,$(this),3) } }else{ $.MsgBox.Alert('提示',"请先登录再进行收藏"); $("#mb_btn_ok").val("去登录"); var aele = document.createElement('a'); $("#mb_btnbox").append(aele); $("#mb_btnbox a").css({ 'display': "block", 'width': '100%', 'height': '40px', 'position': 'absolute', 'bottom': '-6px', 'left': '0' }); aele.setAttribute('href', '../login.html'); } }) //文章浏览量 function pageViewsVal(){ $.ajax({ "url" : "/ajax/article/pageViews", "type" : "POST" , "dataType" : "json", "data" :{"articleId":articleId}, "success" : function(data) { console.log(data); if (data.success){ } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } ArticleMessagesNumbe(); //文章留言条数 function ArticleMessagesNumbe(){ $.ajax({ "url" : "/ajax/leaveWord/lwCount", "type" : "GET" , "dataType" : "json", "data" :{"articleId":articleId}, "success" : function(data) { console.log(data); if (data.success){ $(".message").text(data.data); } }, "error":function(){ $.MsgBox.Alert('提示','链接服务器超时') } }); } /*留言模块*/ limitObj(".msgCont",200) $("#meSendtt").on("click", function() { articleMsg(); }) //查看更多留言 $("#moreArtical").on("click",function(){ vcreateTime = $(".commentList li").last().attr("data-time"); orderKey = $(".commentList li").last().attr("data-key"); message(5,1); }) //删除留言 $(".commentList").on("click",".messageDel",function(){ var commenid = $(this).attr("data-id"); articledel(commenid) }) //发布留言 function articleMsg() { $.ajax({ url:"/ajax/leaveWord", dataType: 'json', //数据格式类型 type: 'POST', //http请求类型 data: { "articleId": articleId, "sender": userid, "content": $(".msgCont").val(), }, timeout: 10000, //超时设置 success: function(data) { var $info = data.data || {}; if(data.success && data.data) { message(5,2); } $(".msgCont").val(""); }, error: function() { $.MsgBox.Alert('提示', '服务器请求失败') } }); } message(5,2); function message(rows,num) { if(num==1){ var data = {"articleId": articleId,"createTime": vcreateTime,"orderKey": orderKey,"rows": rows} }else{ var data = {"articleId": articleId,"rows": rows} } $.ajax({ url: "/ajax/leaveWord/ql", dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 data: data, timeout: 10000, //超时设置 success: function(data) { if(data.success) { if(data.data != ""){ if(num==2){ $(".commentList").html(""); } if(data.data.length > 4){ $("#moreArtical").removeClass("displayNone"); }else{ $("#moreArtical").addClass("displayNone"); } for(var i = 0; i < data.data.length; i++) { var itemlist = '<li class="flexCenter" data-time="" data-key="">'; itemlist += '<a href class="userhref"> <div class="madiaHead useHead useHeadMsg"></div></a>'; itemlist += '<div class="madiaInfo">'; itemlist += '<p><a href class="userhref"><span class="h1Font messageName">张某某</span></a><em class="authiconNew" title="科袖认证专家"></em><span class="commenttime">9月30号 12:00</span></p>'; itemlist += '<p class="h2Font messageContent">sdfsdfs</p>'; itemlist += '<div class="operateSpan"><span class="callBack">回复</span><span class="messageDel">删除</span></div>'; itemlist += '</div></li>'; $itemlist = $(itemlist); $(".commentList").append($itemlist); var datalist = data.data[i]; $itemlist.find(".messageName").text(datalist.professor.name); $itemlist.find(".messageContent").text(datalist.content); var userType = autho(datalist.professor.authType, datalist.professor.orgAuth, datalist.professor.authStatus); $itemlist.find(".authiconNew").attr("title", userType.title); $itemlist.find(".authiconNew").addClass(userType.sty); if(datalist.professor.hasHeadImage==1) { $itemlist.find(".useHeadMsg").attr("style", "background-image: url(/images/head/" + datalist.professor.id + "_l.jpg);"); } if(datalist.professor.id==userid){ $itemlist.find(".messageDel").show(); } $itemlist.attr("data-time", datalist.createTime); $itemlist.attr("data-key", datalist.orderKey); $itemlist.find(".messageDel").attr("data-id", datalist.id); $itemlist.find(".userhref").attr("href", "userInforShow.html?professorId="+datalist.professor.id); var createtime = datalist.createTime; $itemlist.find(".commenttime").text(commenTime(createtime)); } }else{ if(num==2){ $(".commentList").html(""); }else{ $("#moreArtical").addClass("displayNone"); } } } }, error: function() { $.MsgBox.Alert('提示', '服务器请求失败') } }); } //删除自己的留言 function articledel(commenid) { $.ajax({ url:"/ajax/leaveWord/delete", dataType: 'json', //数据格式类型 type: 'POST', //http请求类型 data: { "id": commenid, }, timeout: 10000, //超时设置 success: function(data) { if(data.success) { message(5,2); } }, error: function() { $.MsgBox.Alert('提示', '服务器请求失败') } }); } window.onload=function(){ pageViewsVal();//文章浏览量 } //纠错反馈 $(".correctSubmit").on("click",function(){ var cntCon=$(this).siblings(".correctCon").val(); var cntUser=""; if(userid && userid != null && userid != "null") { cntUser = userid; } if(cntCon.length>500){ $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字'); return; }else{ $.ajax({ "url": "/ajax/feedback/error/article", "type": "POST", "dataType": "json", "async": true, "data": { "id": articleId, "cnt":cntCon, "user":cntUser }, "success": function(data) { if(data.success) { backSuccessed(); } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } })