portal html css js resource

patentImport.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. $(document).ready(function() {
  2. $(".onlogin .headnavbtn li.mywork").addClass("navcurrent");
  3. $(".workmenu>ul>li:contains('成果')").addClass("nowLi");
  4. loginStatus(); //判断个人是否登录
  5. valUser();
  6. var userid = $.cookie("userid");
  7. console.log(userid)
  8. var userName = $.cookie("userName");
  9. /*资源列表查询*/
  10. function getRecourceMe(n, isbind, num) {
  11. var resourceNameVa = $("#patentName").val();
  12. var $info = {};
  13. $info.id = userid;
  14. $info.author = userName;
  15. $info.pageSize = 10;
  16. if(resourceNameVa != "") {
  17. $info.name = resourceNameVa;
  18. }
  19. $info.pageNo = n;
  20. $.ajax({
  21. "url": "/ajax/ppatent/byAuthor",
  22. "type": "GET",
  23. "success": function(data) {
  24. if(data.success) {
  25. $(".importUl").html("");
  26. if(num == 1) {
  27. if(data.data.data.length == 0) {
  28. $("#noresource").removeClass("displayNone");
  29. $(".noContip").text("没有需要导入的专利");
  30. return;
  31. } else {
  32. $("#noresource").addClass("displayNone");
  33. }
  34. } else {
  35. if(data.data.data.length == 0) {
  36. $("#noresource").removeClass("displayNone");
  37. $(".noContip").text("没有符合该搜索条件的内容");
  38. return;
  39. } else {
  40. $("#noresource").addClass("displayNone");
  41. }
  42. }
  43. resourceHtml(data.data.data);
  44. if(isbind == true) {
  45. $(".tcdPageCode").createPage({
  46. pageCount: Math.ceil(data.data.total / data.data.pageSize),
  47. current: data.data.pageNo,
  48. backFn: function(p) {
  49. getRecourceMe(p, false);
  50. document.body.scrollTop = document.documentElement.scrollTop = 0;
  51. }
  52. });
  53. }
  54. }
  55. },
  56. "data": $info,
  57. dataType: "json",
  58. 'error': function() {
  59. $.MsgBox.Alert('提示', '服务器连接超时!');
  60. }
  61. });
  62. }
  63. getRecourceMe(1, true,1);
  64. function resourceHtml($data) {
  65. for(var i = 0; i < $data.length; i++) {
  66. var oSpec = "",
  67. comp = "";
  68. if($data[i].authors) {
  69. oSpec = "发明人:" + $data[i].authors;
  70. }
  71. if($data[i].code) {
  72. comp = "专利号:" + $data[i].code;
  73. }
  74. var oT, oText,cs;
  75. if($data[i].professorId.substring(0,1)!="#") {
  76. oT = "importSpan-3";
  77. oText = "已导入";
  78. cs="auto"
  79. } else {
  80. oT = "importSpan-1";
  81. oText = "导入";
  82. cs="pointer";
  83. }
  84. var oString = '<li>' +
  85. '<a class="flexCenter">' +
  86. '<div class="madiaHead patentHead"></div>' +
  87. '<div class="madiaInfo">' +
  88. '<p class="h1Font ellipsisSty">' + $data[i].name + '</p>' +
  89. '<p class="h2Font ellipsisSty">' + oSpec.substring(0,oSpec.length-2) + '</p>' +
  90. '<p class="h2Font ellipsisSty">' + comp + '</p>' +
  91. '</div>' +
  92. '</a>' +
  93. '<div class="importBtn">' +
  94. '<span class="importResource ' + oT + '" data-id="' + $data[i].id + '" style="cursor:'+cs+'">' + oText + '</span>' +
  95. /*'<span class="importSpan-2">再次导入</span>' +
  96. '<span class="importSpan-3">已导入</span>' +*/
  97. '</div>' +
  98. '</li>'
  99. var $st=$(oString);
  100. $(".importUl").append(oString);
  101. }
  102. }
  103. /*输入资源名称限制字数*/
  104. $("#resouceName").bind({
  105. keyup: function() {
  106. if($(this).val().length > 30) {
  107. $(this).val($(this).val().substr(0, 30));
  108. }
  109. }
  110. });
  111. /*点击搜索*/
  112. $(".searchSpan").click(function() {
  113. $(".tcdPageCode").remove();
  114. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  115. getRecourceMe(1, true);
  116. })
  117. /*导入资源*/
  118. $(".importUl").on("click", ".importSpan-1", function() {
  119. var oF = $(this).attr("flag");
  120. var $this = $(this);
  121. $.ajax({
  122. "url": "/ajax/ppatent/ass",
  123. "type": "POST",
  124. "success": function(data) {
  125. if(data.success) {
  126. if(data.data > 0) {
  127. $this.text("导入成功").addClass("importSpan-3").removeClass("importSpan-1").removeClass("importSpan-2").css("cursor", "auto");
  128. }
  129. }
  130. },
  131. "data": {
  132. id: $(this).attr("data-id"),
  133. uid: userid,
  134. author: userName,
  135. },
  136. dataType: "json",
  137. 'error': function() {
  138. $.MsgBox.Alert('提示', '服务器连接超时!');
  139. }
  140. });
  141. });
  142. })