portal html css js resource

paperImport.js 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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/byAuthor",
  22. "type": "GET",
  23. "success": function(data) {
  24. if(data.success) {
  25. console.log(data);
  26. $(".importUl").html("");
  27. if(num==1) {
  28. if(data.data.data.length==0) {
  29. $("#noresource").removeClass("displayNone");
  30. $(".noContip").text("没有需要导入的论文");
  31. return;
  32. }else{
  33. $("#noresource").addClass("displayNone");
  34. }
  35. }else{
  36. if(data.data.data.length==0) {
  37. $("#noresource").removeClass("displayNone");
  38. $(".noContip").text("没有符合该搜索条件的内容");
  39. return;
  40. }else{
  41. $("#noresource").addClass("displayNone");
  42. }
  43. }
  44. paperHtml(data.data.data);
  45. if(isbind == true) {
  46. $(".tcdPageCode").createPage({
  47. pageCount: Math.ceil(data.data.total / data.data.pageSize),
  48. current: data.data.pageNo,
  49. backFn: function(p) {
  50. getPaperMe(p,false);
  51. }
  52. });
  53. }
  54. }
  55. },
  56. "data": $info,
  57. dataType: "json",
  58. 'error': function() {
  59. $.MsgBox.Alert('提示', '服务器连接超时!');
  60. }
  61. });
  62. }
  63. getPaperMe(1,true,1);
  64. function paperHtml($data) {
  65. console.log($data);
  66. for(var i = 0; i < $data.length; i++) {
  67. var oAuthors="";
  68. if($data[i].authors) {
  69. oAuthors="作者:"+$data[i].authors;
  70. }
  71. var moreInf=""
  72. if(!$data[i].cn4periodical){
  73. $data[i].cn4periodical="";
  74. }
  75. if(!$data[i].en4periodical){
  76. $data[i].en4periodical="";
  77. }
  78. if(!$data[i].pubDay){
  79. $data[i].pubDay="";
  80. }
  81. moreInf = "期刊:" + $data[i].cn4periodical+ " " +$data[i].en4periodical+ " " +$data[i].pubDay;
  82. var oName1=$data[i].name;
  83. var oId=$data[i].id;
  84. var oT,oText,cs;
  85. if($data[i].professorId.substring(0,1)!="#") {
  86. oT="importSpan-3";
  87. oText="已导入";
  88. cs="auto";
  89. }else{
  90. oT="importSpan-1";
  91. oText="导入";
  92. cs="pointer";
  93. }
  94. var oString = '<li>' +
  95. '<a class="flexCenter">' +
  96. '<div class="madiaHead paperHead"></div>' +
  97. '<div class="madiaInfo">' +
  98. '<p class="h1Font ellipsisSty">'+oName1+'</p>' +
  99. '<p class="h2Font ellipsisSty">'+oAuthors+'</p>' +
  100. '<p class="h2Font ellipsisSty">'+moreInf+'</p>' +
  101. '</div>' +
  102. '</a>' +
  103. '<div class="importBtn">' +
  104. '<span class="importResource '+oT+'" data-id="'+oId+'" flag="1" style="cursor:'+cs+'">'+oText+'</span>' +
  105. /*'<span class="importSpan-2">再次导入</span>' +
  106. '<span class="importSpan-3">已导入</span>' +*/
  107. '</div>' +
  108. '</li>'
  109. $(".importUl").append(oString);
  110. }
  111. }
  112. /*输入论文名称限制字数*/
  113. $("#paperName").bind({
  114. keyup: function() {
  115. if($(this).val().length > 50) {
  116. $(this).val($(this).val().substr(0, 50));
  117. }
  118. }
  119. });
  120. /*点击搜索*/
  121. $(".searchSpan").click(function(){
  122. $(".tcdPageCode").remove();
  123. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  124. getPaperMe(1,true);
  125. })
  126. /*导入论文*/
  127. $(".importUl").on("click",".importResource",function(){
  128. var oF=$(this).attr("flag");
  129. if(oF!=1) return;
  130. var $this=$(this);
  131. $.ajax({
  132. "url": "/ajax/ppaper/ass",
  133. "type": "POST",
  134. "success": function(data) {
  135. if(data.success) {
  136. if(data.data){
  137. $this.text("导入成功").addClass("importSpan-3").removeClass("importSpan-1").removeClass("importSpan-2").attr("flag","2").css("cursor","auto");
  138. }
  139. }
  140. },
  141. "data": {
  142. id:$(this).attr("data-id"),
  143. uid:userid,
  144. author: userName
  145. },
  146. dataType: "json",
  147. 'error': function() {
  148. $.MsgBox.Alert('提示', '服务器连接超时!');
  149. }
  150. });
  151. });
  152. })