portal html css js resource

attention-list.js 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. console.log(data);
  62. $("#resources").html("");
  63. if(data.success && data.data.data != "") {
  64. var datalistd = data.data.data;
  65. ResourcesEach(datalistd);
  66. }
  67. },
  68. error: function() {
  69. $.MsgBox.Alert('提示', "服务器链接超时");
  70. }
  71. });
  72. }
  73. /*专家数据遍历*/
  74. function datalistEach(datalist) {
  75. $.each(datalist, function(index, item) {
  76. /*获取头像*/
  77. //console.log(JSON.stringify(item));
  78. if(item.professor.hasHeadImage == 1) {
  79. var img = "/images/head/" + item.professor.id + "_l.jpg";
  80. } else {
  81. var img = "../images/default-photo.jpg";
  82. }
  83. /*获取研究方向信息*/
  84. var researchAreas = item.professor.researchAreas;
  85. //console.log(JSON.stringify(item.professor.researchAreas))
  86. var rlist = '';
  87. for(var n = 0; n < researchAreas.length; n++) {
  88. //console.log(researchAreas[n].caption);
  89. rlist += '<span>' + researchAreas[n].caption
  90. if(n < researchAreas.length - 1) {
  91. rlist += " , "
  92. }
  93. rlist += '</span>';
  94. }
  95. /*获取资源信息*/
  96. var resources = item.professor.resources;
  97. var zlist = '';
  98. for(var m = 0; m < resources.length; m++) {
  99. //console.log(resources[m].caption);
  100. zlist += '<span>' + resources[m].resourceName
  101. if(m < resources.length - 1) {
  102. zlist += " , "
  103. }
  104. zlist += '</span>';
  105. }
  106. var title = item.professor.title || "";
  107. var office = item.professor.office || "";
  108. var orgName = item.professor.orgName || "";
  109. var address = item.professor.address || "";
  110. if(title != "") {
  111. title = title + " , ";
  112. }
  113. if(office != "") {
  114. office = office + " , ";
  115. }
  116. if(orgName != "") {
  117. orgName = orgName;
  118. }
  119. if(address != "") {
  120. address = " | " + address;
  121. }
  122. var li = document.createElement('li');
  123. li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="information-brow.html?professorId=' + item.professor.id + '">' +
  124. '<div class="headblock floatL"><img id="proHead" class="headimg userRadius" src="' + img + '"></div>' +
  125. '<div class="mediaBody">' +
  126. '<span class="listtit">' + item.professor.name + '<em class="authicon authicon-cu" style="position:absolute;margin:4px 0 0 2px ;"></em></span>' +
  127. '<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' +
  128. '<p class="ellipsisSty listtit3">' + rlist + '</p>' +
  129. '<p class="ellipsisSty listtit3">' + zlist + '</p>' +
  130. '</div></a></li>';
  131. $("#expert").append(li);
  132. });
  133. }
  134. /*资源数据遍历*/
  135. function ResourcesEach(datalistd) {
  136. $.each(datalistd, function(index, item) {
  137. var oName;
  138. /*获取头像*/
  139. if(item.resource.images.length) {
  140. var img ='/data/resource/' + item.resource.images[0].imageSrc
  141. } else {
  142. var img = "../images/default-resource.jpg";
  143. }
  144. if(item.resource.editProfessor) {
  145. var stl = autho(item.resource.editProfessor.authType,item.resource.editProfessor.orgAuth, item.resource.editProfessor.authStatus);
  146. oName=item.resource.editProfessor.name;
  147. }else {
  148. var stl={};
  149. stl.sty="";
  150. stl.title="";
  151. if(item.resource.organization.authStatus==3) {
  152. stl.sty="authicon-com-ok";
  153. stl.title="认证企业";
  154. }
  155. oName=item.resource.organization.name;
  156. }
  157. /*var title = item.resource.editProfessor.title || "";
  158. var office = item.resource.editProfessor.office || "";
  159. var orgName = item.resource.editProfessor.orgName || "";
  160. var address = item.resource.editProfessor.address || "";
  161. if(title != "") {
  162. title = title + " , ";
  163. }
  164. if(office != "") {
  165. office = office + " , ";
  166. }
  167. if(orgName != "") {
  168. orgName = orgName;
  169. }
  170. if(address != "") {
  171. address = " | " + address;
  172. }*/
  173. var li = document.createElement('li');
  174. li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="resourceShow.html?resourceId=' + item.resource.resourceId + '">' +
  175. '<div class="headblock floatL ResImgBox"><img id="proHead" class="resImg" src="' + img + '"></div>' +
  176. '<div class="mediaBody" style="float:left;width:450px;overflow:hidden;">' +
  177. '<span class=" ellipsisSty listtit">' + item.resource.resourceName + '</span>' +
  178. '<p class="ellipsisSty listtit2">' + item.resource.supportedServices + '</p>' +
  179. '<span class="listtit">' +oName+ '<em class="authiconNew '+stl.sty+'" title="'+stl.title+'"></em></span>' +
  180. //'<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' +
  181. '</div></a></li>';
  182. $("#resources").append(li);
  183. });
  184. }
  185. /*文章列表*/
  186. function article() {
  187. var data = {
  188. "professorId": userid,
  189. "watchType": 3,
  190. "pageNo": 1,
  191. "pageSize": 1000
  192. }
  193. $.ajax({
  194. url: "/ajax/watch/qaPro",
  195. data: data,
  196. dataType: 'json', //数据格式类型
  197. type: 'get', //http请求类型
  198. success: function(data) {
  199. if(data.success && data.data.data != "") {
  200. var $info=data.data.data;
  201. for(var i = 0; i < $info.length; i++) {
  202. var img='../images/default-artical.jpg';
  203. var oName,oString,ohref;
  204. if($info[i].article.articleImg) {
  205. img="/data/article/"+$info[i].article.articleImg;
  206. }
  207. if($info[i].article.articleType==1){
  208. oName=$info[i].article.professor.name;
  209. oString='<em class="authiconNew authicon-pro" title="科袖认证专家"></em>';
  210. ohref="articalShow.html?articleId="+$info[i].article.articleId;
  211. }else{
  212. oName=$info[i].article.organization.name;
  213. ohref="articalShow.html?articleId="+$info[i].article.articleId;
  214. if($info[i].article.organization.authStatus==3){
  215. oString='<em class="authiconNew authicon-com-ok" title="认证企业"></em>';
  216. }
  217. }
  218. var li = document.createElement('li');
  219. li.innerHTML = '<a class="proinfor clearfix" target="_blank" href="'+ohref+'">' +
  220. '<div class="headblock floatL ResImgBox"><img id="proHead" class="resImg" src="' + img + '"></div>' +
  221. '<div class="mediaBody">' +
  222. '<span class="listtit" style="display:block;">' + $info[i].article.articleTitle + '</span>' +
  223. '<span class="listtit">' + oName+oString+'</span>' +
  224. '</div></a></li>';
  225. $("#article").append(li);
  226. }
  227. }
  228. },
  229. error: function() {
  230. $.MsgBox.Alert('提示', "服务器链接超时");
  231. }
  232. });
  233. }
  234. article();
  235. })