portal html css js resource

attention-list.js 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*我的关注列表*/
  2. $(function() {
  3. var userid = $.cookie("userid");
  4. expertAttention();
  5. followResources();
  6. $("#fixbtn li").on("click",function(){
  7. var indexLi=$(this).index();
  8. $("#fixbtn li").removeClass("liactive");
  9. $(".attentsCon .attentList").hide();
  10. $("#fixbtn li").eq(indexLi).addClass("liactive");
  11. $(".attentsCon .attentList").eq(indexLi).show();
  12. });
  13. $("#lookMyAttention").click(function(){
  14. $("body").css("position","fixed");
  15. $("#attentCover").fadeIn();
  16. })
  17. //关闭按钮
  18. $("#workclose").click(function(){
  19. $("#attentCover").fadeOut();
  20. $("body").css("position","");
  21. });
  22. /*关注专家*/
  23. function expertAttention() {
  24. var data = {
  25. "professorId": userid,
  26. "watchType": 1,
  27. "pageNo": 1,
  28. "pageSize": 1000
  29. }
  30. $.ajax({
  31. url: "/ajax/watch/qaPro",
  32. data: data,
  33. dataType: 'json', //数据格式类型
  34. type: 'get', //http请求类型
  35. success: function(data) {
  36. $("#expert").html("");
  37. if(data.success && data.data.data != "") {
  38. var datalist = data.data.data;
  39. datalistEach(datalist);
  40. }
  41. },
  42. error: function() {
  43. $.MsgBox.Alert('提示', "服务器链接超时");
  44. }
  45. });
  46. }
  47. /*关注资源*/
  48. function followResources() {
  49. var data = {
  50. "professorId": userid,
  51. "watchType": 2,
  52. "pageNo": 1,
  53. "pageSize": 1000
  54. }
  55. $.ajax({
  56. url: "/ajax/watch/qaPro",
  57. data: data,
  58. dataType: 'json', //数据格式类型
  59. type: 'get', //http请求类型
  60. success: function(data) {
  61. $("#resources").html("");
  62. if(data.success && data.data.data != "") {
  63. var datalistd = data.data.data;
  64. ResourcesEach(datalistd);
  65. }
  66. },
  67. error: function() {
  68. $.MsgBox.Alert('提示', "服务器链接超时");
  69. }
  70. });
  71. }
  72. /*专家数据遍历*/
  73. function datalistEach(datalist) {
  74. $.each(datalist, function(index, item) {
  75. /*获取头像*/
  76. //console.log(JSON.stringify(item));
  77. if(item.professor.hasHeadImage == 1) {
  78. var img = "/images/head/" + item.professor.id + "_l.jpg";
  79. } else {
  80. var img = "../images/default-photo.jpg";
  81. }
  82. /*获取研究方向信息*/
  83. var researchAreas = item.professor.researchAreas;
  84. //console.log(JSON.stringify(item.professor.researchAreas))
  85. var rlist = '';
  86. for(var n = 0; n < researchAreas.length; n++) {
  87. //console.log(researchAreas[n].caption);
  88. rlist += '<span>' + researchAreas[n].caption
  89. if(n < researchAreas.length - 1) {
  90. rlist += " , "
  91. }
  92. rlist += '</span>';
  93. }
  94. /*获取资源信息*/
  95. var resources = item.professor.resources;
  96. var zlist = '';
  97. for(var m = 0; m < resources.length; m++) {
  98. //console.log(resources[m].caption);
  99. zlist += '<span>' + resources[m].resourceName
  100. if(m < resources.length - 1) {
  101. zlist += " , "
  102. }
  103. zlist += '</span>';
  104. }
  105. var title = item.professor.title || "";
  106. var office = item.professor.office || "";
  107. var orgName = item.professor.orgName || "";
  108. var address = item.professor.address || "";
  109. if(title != "") {
  110. title = title + " , ";
  111. }
  112. if(office != "") {
  113. office = office + " , ";
  114. }
  115. if(orgName != "") {
  116. orgName = orgName;
  117. }
  118. if(address != "") {
  119. address = " | " + address;
  120. }
  121. var li = document.createElement('li');
  122. li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="information-brow.html?professorId=' + item.professor.id + '">' +
  123. '<div class="headblock floatL"><img id="proHead" class="headimg userRadius" src="' + img + '"></div>' +
  124. '<div class="mediaBody">' +
  125. '<span class="listtit">' + item.professor.name + '<em class="authicon authicon-cu" style="position:absolute;margin:4px 0 0 2px ;"></em></span>' +
  126. '<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' +
  127. '<p class="ellipsisSty listtit3">' + rlist + '</p>' +
  128. '<p class="ellipsisSty listtit3">' + zlist + '</p>' +
  129. '</div></a></li>';
  130. $("#expert").append(li);
  131. });
  132. }
  133. /*资源数据遍历*/
  134. function ResourcesEach(datalistd) {
  135. $.each(datalistd, function(index, item) {
  136. /*获取头像*/
  137. if(item.resource.images.length) {
  138. var img = "/images/resource/" + item.resource.resourceId + "_s.jpg";
  139. } else {
  140. var img = "../images/default-resource.jpg";
  141. }
  142. var title = item.resource.editProfessor.title || "";
  143. var office = item.resource.editProfessor.office || "";
  144. var orgName = item.resource.editProfessor.orgName || "";
  145. var address = item.resource.editProfessor.address || "";
  146. if(title != "") {
  147. title = title + " , ";
  148. }
  149. if(office != "") {
  150. office = office + " , ";
  151. }
  152. if(orgName != "") {
  153. orgName = orgName;
  154. }
  155. if(address != "") {
  156. address = " | " + address;
  157. }
  158. var li = document.createElement('li');
  159. li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="resourceShow.html?resourceId=' + item.resource.resourceId + '">' +
  160. '<div class="headblock floatL ResImgBox"><img id="proHead" class="resImg" src="' + img + '"></div>' +
  161. '<div class="mediaBody" style="float:left;width:450px;overflow:hidden;">' +
  162. '<span class=" ellipsisSty listtit">' + item.resource.resourceName + '</span>' +
  163. '<p class="ellipsisSty listtit2">' + item.resource.supportedServices + '</p>' +
  164. '<span class="listtit">' + item.resource.editProfessor.name + '<em class="authicon authicon-cu" style="position:absolute;margin:4px 0 0 2px ;"></em></span>' +
  165. '<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' +
  166. '</div></a></li>';
  167. $("#resources").append(li);
  168. });
  169. }
  170. /*文章列表*/
  171. function article() {
  172. var data = {
  173. "professorId": userid,
  174. "watchType": 3,
  175. "pageNo": 1,
  176. "pageSize": 1000
  177. }
  178. $.ajax({
  179. url: "/ajax/watch/qaPro",
  180. data: data,
  181. dataType: 'json', //数据格式类型
  182. type: 'get', //http请求类型
  183. success: function(data) {
  184. if(data.success && data.data.data != "") {
  185. var $info=data.data.data;
  186. for(var i = 0; i < $info.length; i++) {
  187. var img='../images/default-artical.jpg';
  188. var oName,oString,ohref;
  189. if($info[i].article.articleImg) {
  190. img="/data/article/"+$info[i].article.articleImg;
  191. }
  192. if($info[i].article.articleType==1){
  193. oName=$info[i].article.professor.name;
  194. oString='<em class="authiconNew authicon-pro" title="科袖认证专家"></em>';
  195. ohref="articalShow.html?articleId="+$info[i].article.articleId;
  196. }else{
  197. oName=$info[i].article.organization.name;
  198. ohref="articalShow.html?articleId="+$info[i].article.articleId;
  199. if($info[i].article.organization.authStatus==3){
  200. oString='<em class="authiconNew authicon-com-ok" title="认证企业"></em>';
  201. }
  202. }
  203. var li = document.createElement('li');
  204. li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="'+ohref+'">' +
  205. '<div class="headblock floatL ResImgBox"><img id="proHead" class="resImg" src="' + img + '"></div>' +
  206. '<div class="mediaBody">' +
  207. '<span class="listtit" style="display:block;">' + $info[i].article.articleTitle + '</span>' +
  208. '<span class="listtit">' + oName+oString+'</span>' +
  209. '</div></a></li>';
  210. $("#article").append(li);
  211. }
  212. }
  213. },
  214. error: function() {
  215. $.MsgBox.Alert('提示', "服务器链接超时");
  216. }
  217. });
  218. }
  219. article();
  220. })