portal html css js resource

paperList.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. 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='<li><span>赞 '+isAgreeNum($data[i].id)+'</span></li>';
  116. var lew='<li><span>留言 '+lewordNum($data[i].id)+'</span></li>';
  117. var oStr='<li '+oLi+'>'+
  118. '<a href="'+oHtml+'?paperId='+$data[i].id+'" target="_blank">'+
  119. '<div class="madiaHead paperHead"></div>' +
  120. '<div class="madiaInfo">'+
  121. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  122. '<ul class="h2Font clearfix">'+
  123. '<li><span>'+oTime+'</span></li>'+pageview+thub+lew+
  124. '</ul>'+
  125. '</div>'+
  126. '</a>'+
  127. '<ul class="madiaEdit">'+
  128. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  129. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  130. '</ul>'+
  131. '</li>'
  132. $("#paperList").append(oStr);
  133. }
  134. }
  135. /*点击修改跳转修改页面*/
  136. $("#paperList").on("click",".editThis",function(){
  137. location.href="paperModify.html?paperId="+$(this).attr("data-id")
  138. })
  139. /*点击删除跳转修改页面*/
  140. $("#paperList").on("click",".deteleThis2",function(){
  141. paperId=$(this).attr("data-id");
  142. $.MsgBox.Confirm("提示", "确认删除该论文?",delePaper);
  143. })
  144. /*删除函数*/
  145. function delePaper() {
  146. $.ajax({
  147. "url": "/ajax/ppaper/cAss",
  148. "type": "POST",
  149. "success": function(data) {
  150. if(data.success) {
  151. getPaperMe(1,false);
  152. }
  153. },
  154. "data": {
  155. "id":paperId,
  156. "uid":userid
  157. },
  158. "beforeSend": function() { /*console.log(this.data)*/ },
  159. "contentType": "application/x-www-form-urlencoded",
  160. dataType: "json"
  161. });
  162. }
  163. /*输入论文名称限制字数*/
  164. $("#paperName").bind({
  165. keyup: function() {
  166. if($(this).val().length > 50) {
  167. $(this).val($(this).val().substr(0, 50));
  168. }
  169. }
  170. });
  171. /*点击搜索*/
  172. $(".searchSpan").click(function(){
  173. $(".tcdPageCode").remove();
  174. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  175. getPaperMe(1,true);
  176. })
  177. getProfessorData(userid);
  178. function getProfessorData(professorId) {
  179. $.ajax({
  180. "url": "/ajax/professor/editBaseInfo/" + professorId,
  181. "type": "get",
  182. "async": true,
  183. "success": function(data) {
  184. if(data.success) {
  185. var oAuthType=data.data.authType;
  186. if(oAuthType==0){
  187. $("a:contains('需求')").attr("href","myDemand.html");
  188. }else if(oAuthType==1){
  189. $("a:contains('需求')").attr("href","needList.html");
  190. }
  191. } else {
  192. $.MsgBox.Alert("提示", "服务器连接失败");
  193. }
  194. },
  195. "error": function() {
  196. $.MsgBox.Alert('提示', '服务器连接失败');
  197. }
  198. })
  199. }
  200. })