portal html css js resource

unPatentList.js 5.2KB

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