portal html css js resource

unPatentImport.js 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. var userName = $.cookie("userName");
  8. /*资源列表查询*/
  9. function getRecourceMe(n, isbind, num) {
  10. var resourceNameVa = $("#patentName").val();
  11. var $info = {};
  12. $info.pageSize = 10;
  13. if (resourceNameVa != "") {
  14. $info.key = resourceNameVa;
  15. }
  16. $info.pageNo = n;
  17. $info.status = 1;
  18. $info.id = userid
  19. $.ajax({ // 获取所有非专数据
  20. "url": "/ajax/resResult/pq",
  21. "type": "GET",
  22. "success": function (data) {
  23. if (data.success) {
  24. $(".importUl").html("");
  25. if (num == 1) {
  26. if (data.data.data.length == 0) {
  27. $("#noresource").removeClass("displayNone");
  28. $(".noContip").text("没有需要导入的非专");
  29. return;
  30. } else {
  31. $("#noresource").addClass("displayNone");
  32. }
  33. } else {
  34. if (data.data.data.length == 0) {
  35. $("#noresource").removeClass("displayNone");
  36. $(".noContip").text("没有符合该搜索条件的内容");
  37. return;
  38. } else {
  39. $("#noresource").addClass("displayNone");
  40. }
  41. }
  42. resourceHtml(data.data.data);
  43. if (isbind == true) {
  44. $(".tcdPageCode").createPage({
  45. pageCount: Math.ceil(data.data.total / data.data.pageSize),
  46. current: data.data.pageNo,
  47. backFn: function (p) {
  48. getRecourceMe(p, false);
  49. document.body.scrollTop = document.documentElement.scrollTop = 0;
  50. }
  51. });
  52. }
  53. }
  54. },
  55. "data": $info,
  56. 'type': "get",
  57. 'error': function () {
  58. $.MsgBox.Alert('提示', '服务器连接超时!');
  59. }
  60. });
  61. }
  62. getRecourceMe(1, true, 1);
  63. function resourceHtml($data) { //导入数据
  64. for (var i = 0; i < $data.length; i++) {
  65. test($data[i])
  66. }
  67. }
  68. function test($data) { //获取专家名称
  69. $.ajax({
  70. 'url': '/ajax/resResult/researcher',
  71. 'type': 'get',
  72. 'data': {
  73. id: $data.id
  74. },
  75. success: function (res) {
  76. var arr = [] //研究者名
  77. var dom = [] //判断导入的id
  78. for (var i = 0; i < res.data.length; i++) {
  79. arr.push(res.data[i].name)
  80. dom.push(res.data[i].professorId)
  81. }
  82. $.ajax({ //导入状态数据
  83. 'url': '/ajax/resResult/selectbyidandPid',
  84. 'data': {
  85. id: $data.id,
  86. pid: userid
  87. },
  88. 'type': 'get',
  89. success: function (res) {
  90. console.log(res)
  91. var cc = res.data //状态值 []
  92. if ($data.name) { //分隔数组[]
  93. oSpec = "研究者:" + arr.join(',');
  94. }
  95. // var cc = dom.join(',')
  96. var oT, oText, cs;
  97. if (cc.length != 0) { //判断状态如果长度不等于0证明已经导入
  98. oT = "importSpan-3";
  99. oText = "已导入";
  100. cs = "auto"
  101. } else {
  102. oT = "importSpan-1";
  103. oText = "导入";
  104. cs = "pointer";
  105. }
  106. var oString = '<li>' +
  107. '<a class="flexCenter">' +
  108. '<div class="madiaHead patentHead"></div>' +
  109. '<div class="madiaInfo">' +
  110. '<p class="h1Font ellipsisSty">' + $data.name + '</p>' +
  111. '<p class="h2Font ellipsisSty">' + oSpec + '</p>' +
  112. '<p class="h2Font ellipsisSty">' + '</p>' +
  113. '</div>' +
  114. '</a>' +
  115. '<div class="importBtn">' +
  116. '<span class="importResource ' + oT + '" data-id="' + $data.id + '" style="cursor:' + cs + '">' + oText + '</span>' +
  117. /*'<span class="importSpan-2">再次导入</span>' +
  118. '<span class="importSpan-3">已导入</span>' +*/
  119. '</div>' +
  120. '</li>'
  121. $(".importUl").append(oString);
  122. }
  123. })
  124. }
  125. })
  126. }
  127. /*输入资源名称限制字数*/
  128. $("#resouceName").bind({
  129. keyup: function () {
  130. if ($(this).val().length > 30) {
  131. $(this).val($(this).val().substr(0, 30));
  132. }
  133. }
  134. });
  135. /*点击搜索*/
  136. $(".searchSpan").click(function () {
  137. $(".tcdPageCode").remove();
  138. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  139. getRecourceMe(1, true);
  140. })
  141. /*导入资源*/
  142. $(".importUl").on("click", ".importSpan-1", function () {
  143. var oF = $(this).attr("flag");
  144. var $this = $(this);
  145. $.ajax({
  146. "url": "/ajax/resResult/ass",
  147. "type": "POST",
  148. "success": function (data) {
  149. console.log(data)
  150. if (data.success) {
  151. if (data.data > 0) {
  152. $this.text("导入成功").addClass("importSpan-3").removeClass("importSpan-1").removeClass("importSpan-2").css("cursor", "auto");
  153. }
  154. }
  155. },
  156. "data": {
  157. id: $(this).attr("data-id"),
  158. // uid: userid,
  159. // author: userName,
  160. researcher: userid
  161. },
  162. dataType: "json",
  163. 'error': function () {
  164. $.MsgBox.Alert('提示', '服务器连接超时!');
  165. }
  166. });
  167. });
  168. })