portal html css js resource

paperList.js 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. function lewordNum(pId) {
  86. var num;
  87. var data = {"paperId": pId}
  88. $.ajax({
  89. url:"/ajax/leaveWord/lwCount/paper",
  90. data: data,
  91. dataType: 'json', //服务器返回json格式数据
  92. type: 'get', //HTTP请求类型
  93. timeout: 10000, //超时时间设置为10秒;
  94. async:false,
  95. traditional: true,
  96. success: function(data) {
  97. if(data.success) {
  98. num=data.data;
  99. }
  100. },
  101. error: function(xhr, type, errorThrown) {
  102. //异常处理;
  103. $.MsgBox.Alert('提示',"服务器链接超时");
  104. }
  105. });
  106. return num;
  107. }
  108. getPaperMe(1,true,1);
  109. function paperHtml($data) {
  110. for(var i=0;i<$data.length;i++) {
  111. var oTime,pageview="",oHtml,oLi='';
  112. oTime="导入于 "+TimeTr($data[i].assTime);
  113. pageview='<li><span>阅读量 '+$data[i].pageViews+'</span></li>';
  114. oHtml="paperShow.html"
  115. var thub="";
  116. if(isAgreeNum($data[i].id)!=0){
  117. thub='<li><span>赞 '+isAgreeNum($data[i].id)+'</span></li>';
  118. }
  119. var lew="";
  120. if(lewordNum($data[i].id)!=0){
  121. lew='<li><span>留言 '+lewordNum($data[i].id)+'</span></li>';
  122. }
  123. var oStr='<li '+oLi+'>'+
  124. '<a href="'+oHtml+'?paperId='+$data[i].id+'" target="_blank">'+
  125. '<div class="madiaHead paperHead"></div>' +
  126. '<div class="madiaInfo">'+
  127. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  128. '<ul class="showliTop h2Font clearfix">'+
  129. '<li><span>'+oTime+'</span></li>'+pageview+thub+lew+
  130. '</ul>'+
  131. '</div>'+
  132. '</a>'+
  133. '<ul class="madiaEdit">'+
  134. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  135. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  136. '</ul>'+
  137. '</li>'
  138. $("#paperList").append(oStr);
  139. }
  140. }
  141. /*点击修改跳转修改页面*/
  142. $("#paperList").on("click",".editThis",function(){
  143. location.href="paperModify.html?paperId="+$(this).attr("data-id")
  144. })
  145. /*点击删除跳转修改页面*/
  146. $("#paperList").on("click",".deteleThis2",function(){
  147. paperId=$(this).attr("data-id");
  148. $.MsgBox.Confirm("提示", "确认删除该论文?",delePaper);
  149. })
  150. /*删除函数*/
  151. function delePaper() {
  152. $.ajax({
  153. "url": "/ajax/ppaper/cAss",
  154. "type": "POST",
  155. "success": function(data) {
  156. if(data.success) {
  157. getPaperMe(1,false);
  158. }
  159. },
  160. "data": {
  161. "id":paperId,
  162. "uid":userid
  163. },
  164. "beforeSend": function() { /*console.log(this.data)*/ },
  165. "contentType": "application/x-www-form-urlencoded",
  166. dataType: "json"
  167. });
  168. }
  169. /*输入论文名称限制字数*/
  170. $("#paperName").bind({
  171. keyup: function() {
  172. if($(this).val().length > 50) {
  173. $(this).val($(this).val().substr(0, 50));
  174. }
  175. }
  176. });
  177. /*点击搜索*/
  178. $(".searchSpan").click(function(){
  179. $(".tcdPageCode").remove();
  180. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  181. getPaperMe(1,true);
  182. })
  183. // getProfessorData(userid);
  184. // function getProfessorData(professorId) {
  185. // $.ajax({
  186. // "url": "/ajax/professor/editBaseInfo/" + professorId,
  187. // "type": "get",
  188. // "async": true,
  189. // "success": function(data) {
  190. // if(data.success) {
  191. // var oAuthType=data.data.authType;
  192. // if(oAuthType==0){
  193. // $("a:contains('需求')").attr("href","myDemand.html");
  194. // }else if(oAuthType==1){
  195. // $("a:contains('需求')").attr("href","needList.html");
  196. // }
  197. //
  198. //
  199. // } else {
  200. // $.MsgBox.Alert("提示", "服务器连接失败");
  201. // }
  202. // },
  203. // "error": function() {
  204. // $.MsgBox.Alert('提示', '服务器连接失败');
  205. // }
  206. // })
  207. // }
  208. })