/*我的关注列表*/ $(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) { $("#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 += '' + researchAreas[n].caption if(n < researchAreas.length - 1) { rlist += " , " } rlist += ''; } /*获取资源信息*/ var resources = item.professor.resources; var zlist = ''; for(var m = 0; m < resources.length; m++) { //console.log(resources[m].caption); zlist += '' + resources[m].resourceName if(m < resources.length - 1) { zlist += " , " } zlist += ''; } 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 = '' + '' + '' + '' + item.professor.name + '' + '' + title + '' + office + '' + orgName + '' + address + '' + '' + rlist + '' + '' + zlist + '' + ''; $("#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 = '' + '' + '' + '' + item.resource.resourceName + '' + '' + item.resource.supportedServices + '' + '' + item.resource.editProfessor.name + '' + '' + title + '' + office + '' + orgName + '' + address + '' + ''; $("#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=''; ohref="articalInfo.html?articleId="+$info[i].article.articleId+"&professorId="+$info[i].article.professorId; }else{ oName=$info[i].article.organization.name; ohref="articalInfo.html?oFlag=1&articleId="+$info[i].article.articleId+"&professorId="+$info[i].article.orgId; if($info[i].article.organization.authStatus==3){ oString=''; } } var li = document.createElement('li'); li.innerHTML = '' + '' + '' + '' + $info[i].article.articleTitle + '' + '' + oName+oString+'' + ''; $("#article").append(li); } } }, error: function() { $.MsgBox.Alert('提示', "服务器链接超时"); } }); } article(); })
' + title + '' + office + '' + orgName + '' + address + '
' + rlist + '
' + zlist + '
' + item.resource.supportedServices + '