portal html css js resource

attention-list.js 7.5KB

    /*我的关注列表*/ $(function() { var userid = $.cookie("userid"); expertAttention(); followResources(); $("#fixbtn li").on("click",function(){ var indexLi=$(this).index(); $("#fixbtn li").removeClass("liactive"); $(".attentsCon .attentList").hide(); $("#fixbtn li").eq(indexLi).addClass("liactive"); $(".attentsCon .attentList").eq(indexLi).show(); }); $("#lookMyAttention").click(function(){ $("body").css("position","fixed"); $("#attentCover").fadeIn(); }) //关闭按钮 $("#workclose").click(function(){ $("#attentCover").fadeOut(); $("body").css("position",""); }); /*关注专家*/ function expertAttention() { var data = { "professorId": userid, "watchType": 1, "pageNo": 1, "pageSize": 1000 } $.ajax({ url: "/ajax/watch/qaPro", data: data, dataType: 'json', //数据格式类型 type: 'get', //http请求类型 success: function(data) { $("#expert").html(""); if(data.success && data.data.data != "") { var datalist = data.data.data; datalistEach(datalist); } }, error: function() { $.MsgBox.Alert('提示', "服务器链接超时"); } }); } /*关注资源*/ function followResources() { var data = { "professorId": userid, "watchType": 2, "pageNo": 1, "pageSize": 1000 } $.ajax({ url: "/ajax/watch/qaPro", data: data, dataType: 'json', //数据格式类型 type: 'get', //http请求类型 success: function(data) { console.log(data); $("#resources").html(""); if(data.success && data.data.data != "") { var datalistd = data.data.data; ResourcesEach(datalistd); } }, error: function() { $.MsgBox.Alert('提示', "服务器链接超时"); } }); } /*专家数据遍历*/ function datalistEach(datalist) { $.each(datalist, function(index, item) { /*获取头像*/ //console.log(JSON.stringify(item)); if(item.professor.hasHeadImage == 1) { var img = "/images/head/" + item.professor.id + "_l.jpg"; } else { var img = "../images/default-photo.jpg"; } /*获取研究方向信息*/ var researchAreas = item.professor.researchAreas; //console.log(JSON.stringify(item.professor.researchAreas)) var rlist = ''; for(var n = 0; n < researchAreas.length; n++) { //console.log(researchAreas[n].caption); rlist += '<span>' + researchAreas[n].caption if(n < researchAreas.length - 1) { rlist += " , " } rlist += '</span>'; } /*获取资源信息*/ var resources = item.professor.resources; var zlist = ''; for(var m = 0; m < resources.length; m++) { //console.log(resources[m].caption); zlist += '<span>' + resources[m].resourceName if(m < resources.length - 1) { zlist += " , " } zlist += '</span>'; } var title = item.professor.title || ""; var office = item.professor.office || ""; var orgName = item.professor.orgName || ""; var address = item.professor.address || ""; if(title != "") { title = title + " , "; } if(office != "") { office = office + " , "; } if(orgName != "") { orgName = orgName; } if(address != "") { address = " | " + address; } var li = document.createElement('li'); li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="information-brow.html?professorId=' + item.professor.id + '">' + '<div class="headblock floatL"><img id="proHead" class="headimg userRadius" src="' + img + '"></div>' + '<div class="mediaBody">' + '<span class="listtit">' + item.professor.name + '<em class="authicon authicon-cu" style="position:absolute;margin:4px 0 0 2px ;"></em></span>' + '<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' + '<p class="ellipsisSty listtit3">' + rlist + '</p>' + '<p class="ellipsisSty listtit3">' + zlist + '</p>' + '</div></a></li>'; $("#expert").append(li); }); } /*资源数据遍历*/ function ResourcesEach(datalistd) { $.each(datalistd, function(index, item) { /*获取头像*/ if(item.resource.images.length) { var img = "/images/resource/" + item.resource.resourceId + "_s.jpg"; } else { var img = "../images/default-resource.jpg"; } var title = item.resource.editProfessor.title || ""; var office = item.resource.editProfessor.office || ""; var orgName = item.resource.editProfessor.orgName || ""; var address = item.resource.editProfessor.address || ""; if(title != "") { title = title + " , "; } if(office != "") { office = office + " , "; } if(orgName != "") { orgName = orgName; } if(address != "") { address = " | " + address; } var li = document.createElement('li'); li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="resourceShow.html?resourceId=' + item.resource.resourceId + '">' + '<div class="headblock floatL ResImgBox"><img id="proHead" class="resImg" src="' + img + '"></div>' + '<div class="mediaBody" style="float:left;width:450px;overflow:hidden;">' + '<span class=" ellipsisSty listtit">' + item.resource.resourceName + '</span>' + '<p class="ellipsisSty listtit2">' + item.resource.supportedServices + '</p>' + '<span class="listtit">' + item.resource.editProfessor.name + '<em class="authicon authicon-cu" style="position:absolute;margin:4px 0 0 2px ;"></em></span>' + '<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' + '</div></a></li>'; $("#resources").append(li); }); } /*文章列表*/ function article() { var data = { "professorId": userid, "watchType": 3, "pageNo": 1, "pageSize": 1000 } $.ajax({ url: "/ajax/watch/qaPro", data: data, dataType: 'json', //数据格式类型 type: 'get', //http请求类型 success: function(data) { if(data.success && data.data.data != "") { var $info=data.data.data; for(var i = 0; i < $info.length; i++) { var img='../images/default-artical.jpg'; var oName,oString,ohref; if($info[i].article.articleImg) { img="/data/article/"+$info[i].article.articleImg; } if($info[i].article.articleType==1){ oName=$info[i].article.professor.name; oString='<em class="authiconNew authicon-pro" title="科袖认证专家"></em>'; ohref="articalShow.html?articleId="+$info[i].article.articleId; }else{ oName=$info[i].article.organization.name; ohref="articalShow.html?articleId="+$info[i].article.articleId; if($info[i].article.organization.authStatus==3){ oString='<em class="authiconNew authicon-com-ok" title="认证企业"></em>'; } } var li = document.createElement('li'); li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="'+ohref+'">' + '<div class="headblock floatL ResImgBox"><img id="proHead" class="resImg" src="' + img + '"></div>' + '<div class="mediaBody">' + '<span class="listtit" style="display:block;">' + $info[i].article.articleTitle + '</span>' + '<span class="listtit">' + oName+oString+'</span>' + '</div></a></li>'; $("#article").append(li); } } }, error: function() { $.MsgBox.Alert('提示', "服务器链接超时"); } }); } article(); })