portal html css js resource

unPatentList.js 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 resourceId;
  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', '2'];
  18. $info.id = userid
  19. $.ajax({ //获取全部非专数据
  20. // /ajax/resResult/pq/creator
  21. "url": "/ajax/resResult/pq/researcher",
  22. "type": "GET",
  23. "success": function (data) {
  24. console.log(data)
  25. if (data.success) {
  26. $("#patentList").html("");
  27. if (num == 1) {
  28. if (data.data.data.length == 0) {
  29. $("#noresource").removeClass("displayNone");
  30. $(".noContip").text("您还未发布任何非专利成果");
  31. return;
  32. } else {
  33. $("#noresource").addClass("displayNone");
  34. }
  35. } else {
  36. if (data.data.data.length == 0) {
  37. $("#noresource").removeClass("displayNone");
  38. $(".noContip").text("没有符合该搜索条件的内容");
  39. return;
  40. } else {
  41. $("#noresource").addClass("displayNone");
  42. }
  43. }
  44. resourceHtml(data.data.data);
  45. if (isbind == true) {
  46. $(".tcdPageCode").createPage({
  47. pageCount: Math.ceil(data.data.total / data.data.pageSize),
  48. current: data.data.pageNo,
  49. backFn: function (p) {
  50. getRecourceMe(p, false);
  51. }
  52. });
  53. }
  54. }
  55. },
  56. "data": $info,
  57. dataType: "json",
  58. traditional: true,
  59. 'error': function () {
  60. $.MsgBox.Alert('提示', '服务器连接超时!');
  61. }
  62. });
  63. }
  64. getRecourceMe(1, true, 1);
  65. function resourceHtml($data) {
  66. for (var i = 0; i < $data.length; i++) {
  67. var oTime, pageview = "",
  68. draftLable = "",
  69. oHtml, oLi = '',
  70. gl = ''
  71. mg = '';
  72. if ($data[i].pic)
  73. var imgSrc = "/data/researchResult" + $data[i].pic.split(",")[0];
  74. if ($data[i].status == '2') {
  75. $('.deteleThis3').css('display', 'none')
  76. oTime = "修改于 " + TimeTr($data[i].modifyTime);
  77. draftLable = '<span class="draftLable " style="margin-left: 20px;">草稿</span>';
  78. oHtml = "unPatentIssue.html";
  79. oLi = "class='draftList'"
  80. mg = '<li><span>' + oTime + '</span>' + draftLable + '</li>'
  81. } else if ($data[i].status == '1') {
  82. oHtml = "unPatentShow.html"
  83. gl = '<li><span class="deteleThis3" data-id="' + $data[i].id + '">取消关联</span></li>'
  84. }
  85. var oStr = '<li ' + oLi + '>' +
  86. '<a href="' + oHtml + '?id=' + $data[i].id + '&flag=' + $data[i].state + '" target="_blank">' +
  87. '<div class="madiaHead resouseHead" style="background-image: url(' + imgSrc + ');"></div>' +
  88. '<div class="madiaInfo">' +
  89. '<p class="h1Font ellipsisSty">' + $data[i].name + '</p>' +
  90. '<ul class="showliTop h2Font clearfix hu2">' +
  91. mg +
  92. '</ul>' +
  93. '<ul class="showliTop h2Font clearfix hu1">' +
  94. '</ul>' +
  95. '</div>' +
  96. '</a>' +
  97. '<ul class="madiaEdit">' +
  98. gl +
  99. '<li><span class="editThis" data-id="' + $data[i].id + '"></span></li>' +
  100. '<li><span class="deteleThis2" data-id="' + $data[i].id + '"></span></li>' +
  101. '</ul>' +
  102. '</li>'
  103. var $oStr = $(oStr);
  104. $("#patentList").append($oStr);
  105. if ($data[i].status == '1') {
  106. proList($data[i].id, $oStr, $data[i].orgId || '')
  107. }
  108. $oStr.find(".editThis").attr("data-state", $data[i].status);
  109. }
  110. }
  111. function proList(par, $pa, p3) {
  112. $.ajax({
  113. "url": "/ajax/resResult/researcher",
  114. "type": "GET",
  115. "data": {
  116. id: par
  117. },
  118. "success": function (data) {
  119. if (data.success) {
  120. var $da = data.data
  121. if ($da.length) {
  122. var arr = [];
  123. var dom = [];
  124. for (var i = 0; i < $da.length; i++) {
  125. arr.push($da[i].name)
  126. dom.push($da[i].id)
  127. }
  128. $pa.find('.hu2').append('<li>研究者:' + arr.join(',') + '</li>')
  129. if (p3)
  130. orgname(p3, $pa)
  131. $.ajax({
  132. 'url': '/ajax/resResult/selectbyidandPid',
  133. 'type': 'get',
  134. 'data': {
  135. pid: userid,
  136. id: par
  137. },
  138. 'success': function (res) {
  139. var $info = res.data
  140. for (var i = 0; i < $info.length; i++) {
  141. console.log($info[i].name)
  142. if ($info[i].name == '######' || $info[i].status == 0) {
  143. $pa.find('.deteleThis3').css('display', 'none')
  144. } else {
  145. $pa.find('.deteleThis2').css('display', 'none')
  146. $pa.find('.editThis').css('display', 'none')
  147. }
  148. }
  149. }
  150. })
  151. }
  152. }
  153. },
  154. "data": {
  155. "id": par
  156. },
  157. dataType: "json",
  158. 'error': function () {
  159. $.MsgBox.Alert('提示', '服务器连接超时!');
  160. }
  161. });
  162. }
  163. function orgname(par, $pa) {
  164. $.ajax({
  165. "url": "ajax/org/" + par,
  166. "type": "GET",
  167. "success": function (data) {
  168. if (data.success) {
  169. $pa.find('.hu1').append('<li>所属机构:' + data.data.name + '</li>')
  170. }
  171. },
  172. "data": {
  173. "id": par
  174. },
  175. dataType: "json",
  176. 'error': function () {
  177. $.MsgBox.Alert('提示', '服务器连接超时!');
  178. }
  179. });
  180. }
  181. /*点击修改跳转修改页面*/
  182. $("#patentList").on("click", ".editThis", function () {
  183. location.href = "unPatentIssue.html?id=" + $(this).attr("data-id") + "&flag=" + $(this).attr("data-state");
  184. })
  185. /*点击删除跳转修改页面*/
  186. $("#patentList").on("click", ".deteleThis2", function () {
  187. resourceId = $(this).attr("data-id");
  188. $.MsgBox.Confirm("提示", "确认删除该成果?", deleResource);
  189. })
  190. //点击取消关联
  191. $("#patentList").on("click", ".deteleThis3", function () {
  192. resourceId = $(this).attr("data-id");
  193. $.MsgBox.Confirm("提示", "确认取消该成果?", cancel);
  194. })
  195. //取消关联函数
  196. function cancel() {
  197. $.ajax({
  198. 'url': '/ajax/resResult/deleteContact',
  199. 'type': 'post',
  200. 'data': {
  201. id: resourceId,
  202. uid: userid
  203. },
  204. 'success': function (res) {
  205. console.log(res)
  206. getRecourceMe(1, true);
  207. }
  208. })
  209. }
  210. /*删除函数*/
  211. function deleResource() {
  212. $.ajax({
  213. "url": "/ajax/resResult/delete",
  214. "type": "POST",
  215. "success": function (data) {
  216. if (data.success) {
  217. getRecourceMe(1, true);
  218. }
  219. },
  220. "data": {
  221. "id": resourceId
  222. },
  223. "beforeSend": function () {},
  224. "contentType": "application/x-www-form-urlencoded",
  225. dataType: "json"
  226. });
  227. }
  228. /*输入资源名称限制字数*/
  229. $("#patentList").bind({
  230. keyup: function () {
  231. if ($(this).val().length > 30) {
  232. $(this).val($(this).val().substr(0, 30));
  233. }
  234. }
  235. });
  236. /*点击搜索*/
  237. $(".searchSpan").click(function () {
  238. $(".tcdPageCode").remove();
  239. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  240. getRecourceMe(1, true);
  241. })
  242. })