portal html css js resource

paperList.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. $(document).ready(function(){
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. $(".workmenu>ul>li").eq(4).addClass("nowLi");
  4. loginStatus(); //判断个人是否登录
  5. valUser();
  6. var userid = $.cookie("userid");
  7. var userName = $.cookie("userName");
  8. var paperId;
  9. /*论文列表查询*/
  10. function getPaperMe(n,isbind,num) {
  11. var paperNameVa=$("#paperName").val();
  12. var $info={};
  13. $info.id=userid;
  14. $info.author = userName;
  15. $info.pageSize=10;
  16. if(paperNameVa !="") {
  17. $info.name=paperNameVa;
  18. }
  19. $info.pageNo=n;
  20. $.ajax({
  21. "url": "/ajax/ppaper/byProfessor",
  22. "type": "GET",
  23. "data": $info,
  24. "dataType": "json",
  25. "success": function(data) {
  26. console.log(data)
  27. if(data.success) {
  28. var dataStr = data.data.data;
  29. $("#paperList").html("");
  30. if(num==1) {
  31. if(dataStr.length==0) {
  32. $("#noresource").removeClass("displayNone");
  33. $(".noContip").text("您还未导入任何论文");
  34. return;
  35. }else{
  36. $("#noresource").addClass("displayNone");
  37. }
  38. }else{
  39. if(dataStr.length==0) {
  40. $("#noresource").removeClass("displayNone");
  41. $(".noContip").text("没有符合该搜索条件的内容");
  42. return;
  43. }else{
  44. $("#noresource").addClass("displayNone");
  45. }
  46. }
  47. paperHtml(dataStr);
  48. if(isbind == true) {
  49. $(".tcdPageCode").createPage({
  50. pageCount: Math.ceil(data.data.total / data.data.pageSize),
  51. current: data.data.pageNo,
  52. backFn: function(p) {
  53. getPaperMe(p,false);
  54. }
  55. });
  56. }
  57. }
  58. },
  59. 'error': function() {
  60. $.MsgBox.Alert('提示', '服务器连接超时!');
  61. }
  62. });
  63. }
  64. getPaperMe(1,true,1);
  65. function paperHtml($data) {
  66. for(var i=0;i<$data.length;i++) {
  67. var oTime,pageview="",oHtml,oLi='';
  68. oTime="导入于 "+TimeTr($data[i].assTime);
  69. pageview='<li><span>阅读量 '+$data[i].pageViews+'</span></li>';
  70. oHtml="paperShow.html"
  71. var oStr='<li '+oLi+'>'+
  72. '<a href="'+oHtml+'?paperId='+$data[i].id+'" target="_blank">'+
  73. '<div class="madiaHead paperHead"></div>' +
  74. '<div class="madiaInfo">'+
  75. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  76. '<ul class="h2Font clearfix">'+
  77. '<li><span>'+oTime+'</span></li>'+pageview+
  78. '</ul>'+
  79. '</div>'+
  80. '</a>'+
  81. '<ul class="madiaEdit">'+
  82. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  83. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  84. '</ul>'+
  85. '</li>'
  86. $("#paperList").append(oStr);
  87. }
  88. }
  89. /*点击修改跳转修改页面*/
  90. $("#paperList").on("click",".editThis",function(){
  91. location.href="paperModify.html?paperId="+$(this).attr("data-id")
  92. })
  93. /*点击删除跳转修改页面*/
  94. $("#paperList").on("click",".deteleThis2",function(){
  95. paperId=$(this).attr("data-id");
  96. $.MsgBox.Confirm("提示", "确认删除该论文?",delePaper);
  97. })
  98. /*删除函数*/
  99. function delePaper() {
  100. $.ajax({
  101. "url": "/ajax/ppaper/cAss",
  102. "type": "POST",
  103. "success": function(data) {
  104. if(data.success) {
  105. getPaperMe(1,false);
  106. }
  107. },
  108. "data": {
  109. "id":paperId,
  110. "uid":userid
  111. },
  112. "beforeSend": function() { /*console.log(this.data)*/ },
  113. "contentType": "application/x-www-form-urlencoded",
  114. dataType: "json"
  115. });
  116. }
  117. /*输入论文名称限制字数*/
  118. $("#paperName").bind({
  119. keyup: function() {
  120. if($(this).val().length > 50) {
  121. $(this).val($(this).val().substr(0, 50));
  122. }
  123. }
  124. });
  125. /*点击搜索*/
  126. $(".searchSpan").click(function(){
  127. $(".tcdPageCode").remove();
  128. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  129. getPaperMe(1,true);
  130. })
  131. getProfessorData(userid);
  132. function getProfessorData(professorId) {
  133. $.ajax({
  134. "url": "/ajax/professor/editBaseInfo/" + professorId,
  135. "type": "get",
  136. "async": true,
  137. "success": function(data) {
  138. if(data.success) {
  139. var oAuthType=data.data.authType;
  140. if(oAuthType==0){
  141. $("a:contains('需求')").attr("href","myDemand.html");
  142. }else if(oAuthType==1){
  143. $("a:contains('需求')").attr("href","needList.html");
  144. }
  145. } else {
  146. $.MsgBox.Alert("提示", "服务器连接失败");
  147. }
  148. },
  149. "error": function() {
  150. $.MsgBox.Alert('提示', '服务器连接失败');
  151. }
  152. })
  153. }
  154. })