portal html css js resource

patentList.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. $(document).ready(function(){
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. $(".workmenu>ul>li").eq(3).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(patentName !="") {
  15. $info.key=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. getPatentMe(1,true,1);
  63. function patentHtml($data) {
  64. for(var i=0;i<$data.length;i++) {
  65. var oTime,pageview="",oHtml,oLi='';
  66. oTime="导入于 "+TimeTr($data[i].assTime);
  67. pageview='<li><span>阅读量 '+$data[i].pageViews+'</span></li>';
  68. oHtml="patentShow.html"
  69. var oStr='<li '+oLi+'>'+
  70. '<a href="'+oHtml+'?patentId='+$data[i].id+'" target="_blank">'+
  71. '<div class="madiaHead resouseHead"></div>' +
  72. '<div class="madiaInfo">'+
  73. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  74. '<ul class="h2Font clearfix">'+
  75. '<li><span>'+oTime+'</span></li>'+pageview+
  76. '</ul>'+
  77. '</div>'+
  78. '</a>'+
  79. '<ul class="madiaEdit">'+
  80. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  81. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  82. '</ul>'+
  83. '</li>'
  84. $("#patentList").append(oStr);
  85. }
  86. }
  87. /*点击修改跳转修改页面*/
  88. $("#patentList").on("click",".editThis",function(){
  89. location.href="patentShow.html?patentId="+$(this).attr("data-id")+"&flag=1"
  90. })
  91. /*点击删除跳转修改页面*/
  92. $("#patentList").on("click",".deteleThis2",function(){
  93. patentId=$(this).attr("data-id");
  94. $.MsgBox.Confirm("提示", "确认删除该资源?",deleResource);
  95. })
  96. /*删除函数*/
  97. function deleResource() {
  98. $.ajax({
  99. "url": "/ajax/ppatent/cAss",
  100. "type": "POST",
  101. "success": function(data) {
  102. if(data.success) {
  103. getPatentMe(1,false);
  104. }
  105. },
  106. "data": {
  107. "id":patentId,
  108. "uid":userid
  109. },
  110. "beforeSend": function() { /*console.log(this.data)*/ },
  111. "contentType": "application/x-www-form-urlencoded",
  112. dataType: "json"
  113. });
  114. }
  115. /*输入资源名称限制字数*/
  116. $("#patentName").bind({
  117. keyup: function() {
  118. if($(this).val().length > 30) {
  119. $(this).val($(this).val().substr(0, 30));
  120. }
  121. }
  122. });
  123. /*点击搜索*/
  124. $(".searchSpan").click(function(){
  125. $(".tcdPageCode").remove();
  126. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  127. getPatentMe(1,true);
  128. })
  129. getProfessorData(userid);
  130. function getProfessorData(professorId) {
  131. $.ajax({
  132. "url": "/ajax/professor/editBaseInfo/" + professorId,
  133. "type": "get",
  134. "async": true,
  135. "success": function(data) {
  136. if(data.success) {
  137. var oAuthType=data.data.authType;
  138. if(oAuthType==0){
  139. $("a:contains('需求')").attr("href","myDemand.html");
  140. }else if(oAuthType==1){
  141. $("a:contains('需求')").attr("href","needList.html");
  142. }
  143. } else {
  144. $.MsgBox.Alert("提示", "服务器连接失败");
  145. }
  146. },
  147. "error": function() {
  148. $.MsgBox.Alert('提示', '服务器连接失败');
  149. }
  150. })
  151. }
  152. })