portal html css js resource

resourceInfo.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. $(document).ready(function() {
  2. /*获取资源ID*/
  3. var resourceId = GetQueryString("resourceId");
  4. /*判断是否登录*/
  5. loginStatus();
  6. //填充学术领域
  7. var subjectShow = function(data) {
  8. if(data != undefined && data.length != 0) {
  9. var subs = new Array();
  10. if(data.indexOf(',')) {
  11. subs = data.split(',');
  12. } else {
  13. subs[0] = data;
  14. }
  15. if(subs.length > 0) {
  16. for(var i = 0; i < subs.length; i++) {
  17. $("#subjectList").append("<li>" + subs[i] + "</li>")
  18. };
  19. }
  20. }
  21. }
  22. //填充应用行业
  23. var industryShow = function(data) {
  24. if(data != undefined && data.length != 0) {
  25. var subs = new Array();
  26. if(data.indexOf(',')) {
  27. subs = data.split(',');
  28. } else {
  29. subs[0] = data;
  30. }
  31. if(subs.length > 0) {
  32. for(var i = 0; i < subs.length; i++) {
  33. $("#industryList").append("<li>" + subs[i] + "</li>")
  34. };
  35. }
  36. }
  37. }
  38. /*获取资源的数据的函数*/
  39. var resourceData = function() {
  40. $.ajax({
  41. "url": "/ajax/resource/resourceInfo",
  42. data: {
  43. 'resourceId': resourceId
  44. },
  45. "type": "get",
  46. "async": true,
  47. "success": function(info) {
  48. if(info.success) {
  49. var $info = info.data;
  50. console.log(info);
  51. $(".h2Font").text($info.resourceName);
  52. $("#application").text($info.supportedServices);
  53. if($info.subject) {
  54. subjectShow($info.subject)
  55. }else{
  56. $("span:contains('学术领域')").hide();
  57. }
  58. if($info.industry) {
  59. industryShow($info.industry)
  60. }else{
  61. $("span:contains('应用行业')").hide();
  62. }
  63. if($info.cooperationNotes) {
  64. $("#cooperationNote").text($info.cooperationNotes);
  65. }else{
  66. $("span:contains('合作备注')").hide();
  67. }
  68. if(!$info.subject&&!$info.industry&&!$info.cooperationNotes){
  69. $(".resAbout").hide();
  70. }
  71. if($info.images) {
  72. $("#resouImg").attr("src", "/images/resource/" + $info.resourceId + ".jpg")
  73. }
  74. if($info.descp) {
  75. $(".resMore").html($info.descp)
  76. }
  77. $("#nameS").text($info.professor.name);
  78. if($info.professor.title) {
  79. if($info.professor.office) {
  80. $("#title").text($info.professor.title + ",");
  81. } else {
  82. $("#title").text($info.professor.title);
  83. }
  84. }
  85. if($info.professor.office) {
  86. $("#office").text($info.professor.office);
  87. }
  88. if($info.professor.department) {
  89. $("#department").text($info.professor.department);
  90. }
  91. if($info.professor.orgName) {
  92. $("#orgName").text($info.professor.orgName);
  93. }
  94. if($info.professor.address) {
  95. $("#address").text($info.professor.address);
  96. }
  97. if($info.professor.hasHeadImage) {
  98. $("#headImg").attr("src", "/images/head/" + $info.professorId + "_l.jpg")
  99. }
  100. } else {
  101. $.MsgBox.Alert('消息提醒', "系统异常!");
  102. }
  103. },
  104. "error": function() {
  105. $.MsgBox.Alert('message', 'failed')
  106. }
  107. });
  108. }
  109. resourceData();
  110. })