portal html css js resource

patentList.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 patentId;
  8. /*资源列表查询*/
  9. function getPatentMe(n,isbind,num) {
  10. var patentNameVa=$("#patentName").val();
  11. var $info={};
  12. $info.id=userid;
  13. $info.pageSize=10;
  14. if(patentNameVa !="") {
  15. $info.name=patentNameVa;
  16. }
  17. $info.pageNo=n;
  18. $.ajax({
  19. "url": "/ajax/ppatent/byProfessor",
  20. "type": "GET",
  21. "data": $info,
  22. "dataType": "json",
  23. "success": function(data) {
  24. console.log(data)
  25. if(data.success) {
  26. var dataStr = data.data.data;
  27. $("#patentList").html("");
  28. if(num==1) {
  29. if(dataStr.length==0) {
  30. $("#noresource").removeClass("displayNone");
  31. $(".noContip").text("您还未导入任何专利");
  32. return;
  33. }else{
  34. $("#noresource").addClass("displayNone");
  35. }
  36. }else{
  37. if(dataStr.length==0) {
  38. $("#noresource").removeClass("displayNone");
  39. $(".noContip").text("没有符合该搜索条件的内容");
  40. return;
  41. }else{
  42. $("#noresource").addClass("displayNone");
  43. }
  44. }
  45. patentHtml(dataStr);
  46. if(isbind == true) {
  47. $(".tcdPageCode").createPage({
  48. pageCount: Math.ceil(data.data.total / data.data.pageSize),
  49. current: data.data.pageNo,
  50. backFn: function(p) {
  51. getPatentMe(p,false);
  52. }
  53. });
  54. }
  55. }
  56. },
  57. 'error': function() {
  58. $.MsgBox.Alert('提示', '服务器连接超时!');
  59. }
  60. });
  61. }
  62. function isAgreeNum(pId) {
  63. var num;
  64. var data = {"id": pId}
  65. $.ajax({
  66. url:"/ajax/ppatent/agreeCount",
  67. data:data,
  68. dataType: 'json', //数据格式类型
  69. type: 'get', //http请求类型
  70. timeout: 10000,
  71. async: false,
  72. success: function(data) {
  73. if(data.success){
  74. num=data.data
  75. }
  76. },
  77. error: function() {
  78. $.MsgBox.Alert('提示',"服务器链接超时");
  79. }
  80. });
  81. return num;
  82. }
  83. getPatentMe(1,true,1);
  84. function patentHtml($data) {
  85. for(var i=0;i<$data.length;i++) {
  86. var oTime,pageview="",oHtml,oLi='';
  87. oTime="导入于 "+TimeTr($data[i].assTime);
  88. pageview='<li><span>阅读量 '+$data[i].pageViews+'</span></li>';
  89. oHtml="patentShow.html"
  90. var thub="";
  91. if(isAgreeNum($data[i].id)!=0){
  92. thub='<li><span>赞 '+isAgreeNum($data[i].id)+'</span></li>';
  93. }
  94. var oStr='<li '+oLi+'>'+
  95. '<a href="'+oHtml+'?patentId='+$data[i].id+'" target="_blank">'+
  96. '<div class="madiaHead patentHead"></div>' +
  97. '<div class="madiaInfo">'+
  98. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  99. '<ul class="showliTop h2Font clearfix">'+
  100. '<li><span>'+oTime+'</span></li>'+pageview+thub+'<li><span class="leaveMsgCount"></span></li>'+
  101. '</ul>'+
  102. '</div>'+
  103. '</a>'+
  104. '<ul class="madiaEdit">'+
  105. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  106. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  107. '</ul>'+
  108. '</li>'
  109. var $oStr = $(oStr);
  110. $("#patentList").append($oStr);
  111. leaveMsgCount($data[i].id,3,$oStr);
  112. }
  113. }
  114. /*点击修改跳转修改页面*/
  115. $("#patentList").on("click",".editThis",function(){
  116. location.href="patentShow.html?patentId="+$(this).attr("data-id")+"&flag=1"
  117. })
  118. /*点击删除跳转修改页面*/
  119. $("#patentList").on("click",".deteleThis2",function(){
  120. patentId=$(this).attr("data-id");
  121. $.MsgBox.Confirm("提示", "确认删除该资源?",deleResource);
  122. })
  123. /*删除函数*/
  124. function deleResource() {
  125. $.ajax({
  126. "url": "/ajax/ppatent/cAss",
  127. "type": "POST",
  128. "success": function(data) {
  129. if(data.success) {
  130. getPatentMe(1,false);
  131. }
  132. },
  133. "data": {
  134. "id":patentId,
  135. "uid":userid
  136. },
  137. "beforeSend": function() { /*console.log(this.data)*/ },
  138. "contentType": "application/x-www-form-urlencoded",
  139. dataType: "json"
  140. });
  141. }
  142. /*输入资源名称限制字数*/
  143. $("#patentName").bind({
  144. keyup: function() {
  145. if($(this).val().length > 30) {
  146. $(this).val($(this).val().substr(0, 30));
  147. }
  148. }
  149. });
  150. /*点击搜索*/
  151. $(".searchSpan").click(function(){
  152. $(".tcdPageCode").remove();
  153. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  154. getPatentMe(1,true);
  155. })
  156. // getProfessorData(userid);
  157. // function getProfessorData(professorId) {
  158. // $.ajax({
  159. // "url": "/ajax/professor/editBaseInfo/" + professorId,
  160. // "type": "get",
  161. // "async": true,
  162. // "success": function(data) {
  163. // if(data.success) {
  164. // var oAuthType=data.data.authType;
  165. // if(oAuthType==0){
  166. // $("a:contains('需求')").attr("href","myDemand.html");
  167. // }else if(oAuthType==1){
  168. // $("a:contains('需求')").attr("href","needList.html");
  169. // }
  170. //
  171. //
  172. // } else {
  173. // $.MsgBox.Alert("提示", "服务器连接失败");
  174. // }
  175. // },
  176. // "error": function() {
  177. // $.MsgBox.Alert('提示', '服务器连接失败');
  178. // }
  179. // })
  180. // }
  181. })