portal html css js resource

paperList.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 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. function isAgreeNum(pId) {
  65. var num;
  66. var data = {"id": pId}
  67. $.ajax({
  68. url:"/ajax/ppaper/agreeCount",
  69. data:data,
  70. dataType: 'json', //数据格式类型
  71. type: 'get', //http请求类型
  72. timeout: 10000,
  73. async: false,
  74. success: function(data) {
  75. if(data.success){
  76. num=data.data
  77. }
  78. },
  79. error: function() {
  80. $.MsgBox.Alert('提示',"服务器链接超时");
  81. }
  82. });
  83. return num;
  84. }
  85. getPaperMe(1,true,1);
  86. function paperHtml($data) {
  87. for(var i=0;i<$data.length;i++) {
  88. var oTime,pageview="",oHtml,oLi='';
  89. oTime="导入于 "+TimeTr($data[i].assTime);
  90. pageview='<li><span>阅读量 '+$data[i].pageViews+'</span></li>';
  91. oHtml="paperShow.html"
  92. var thub="";
  93. if(isAgreeNum($data[i].id)!=0){
  94. thub='<li><span>赞 '+isAgreeNum($data[i].id)+'</span></li>';
  95. }
  96. var oStr='<li '+oLi+'>'+
  97. '<a href="'+oHtml+'?paperId='+$data[i].id+'" target="_blank">'+
  98. '<div class="madiaHead paperHead"></div>' +
  99. '<div class="madiaInfo">'+
  100. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  101. '<ul class="showliTop h2Font clearfix">'+
  102. '<li><span>'+oTime+'</span></li>'+pageview+thub+'<li><span class="leaveMsgCount"></span></li>'+
  103. '</ul>'+
  104. '</div>'+
  105. '</a>'+
  106. '<ul class="madiaEdit">'+
  107. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  108. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  109. '</ul>'+
  110. '</li>'
  111. var $oStr = $(oStr);
  112. $("#paperList").append($oStr);
  113. leaveMsgCount($data[i].id,2,$oStr);
  114. }
  115. }
  116. /*点击修改跳转修改页面*/
  117. $("#paperList").on("click",".editThis",function(){
  118. location.href="paperModify.html?paperId="+$(this).attr("data-id")
  119. })
  120. /*点击删除跳转修改页面*/
  121. $("#paperList").on("click",".deteleThis2",function(){
  122. paperId=$(this).attr("data-id");
  123. $.MsgBox.Confirm("提示", "确认删除该论文?",delePaper);
  124. })
  125. /*删除函数*/
  126. function delePaper() {
  127. $.ajax({
  128. "url": "/ajax/ppaper/cAss",
  129. "type": "POST",
  130. "success": function(data) {
  131. if(data.success) {
  132. getPaperMe(1,false);
  133. }
  134. },
  135. "data": {
  136. "id":paperId,
  137. "uid":userid
  138. },
  139. "beforeSend": function() { /*console.log(this.data)*/ },
  140. "contentType": "application/x-www-form-urlencoded",
  141. dataType: "json"
  142. });
  143. }
  144. /*输入论文名称限制字数*/
  145. $("#paperName").bind({
  146. keyup: function() {
  147. if($(this).val().length > 50) {
  148. $(this).val($(this).val().substr(0, 50));
  149. }
  150. }
  151. });
  152. /*点击搜索*/
  153. $(".searchSpan").click(function(){
  154. $(".tcdPageCode").remove();
  155. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  156. getPaperMe(1,true);
  157. })
  158. // getProfessorData(userid);
  159. // function getProfessorData(professorId) {
  160. // $.ajax({
  161. // "url": "/ajax/professor/editBaseInfo/" + professorId,
  162. // "type": "get",
  163. // "async": true,
  164. // "success": function(data) {
  165. // if(data.success) {
  166. // var oAuthType=data.data.authType;
  167. // if(oAuthType==0){
  168. // $("a:contains('需求')").attr("href","myDemand.html");
  169. // }else if(oAuthType==1){
  170. // $("a:contains('需求')").attr("href","needList.html");
  171. // }
  172. //
  173. //
  174. // } else {
  175. // $.MsgBox.Alert("提示", "服务器连接失败");
  176. // }
  177. // },
  178. // "error": function() {
  179. // $.MsgBox.Alert('提示', '服务器连接失败');
  180. // }
  181. // })
  182. // }
  183. })