portal html css js resource

inform.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. $(function() {
  2. $(".onlogin .headnavbtn li.myinform").addClass("navcurrent");
  3. var obj = {
  4. rows: 20,
  5. uid:$.cookie("userid")
  6. };
  7. var count = 1;
  8. informList(obj);
  9. module.lWord;
  10. loginStatus();//判断个人是否登录
  11. $("#feedback").hide();
  12. function informList(objec) {
  13. $.ajax({
  14. url: '/ajax/notify',
  15. data: objec,
  16. async: true,
  17. dataType: 'json', //服务器返回json格式数据
  18. type: 'GET', //HTTP请求类型
  19. traditional: true, //传数组必须加这个
  20. success: function(data) {
  21. if(data.success) {
  22. var $info = data.data;
  23. if($info.length == 0) {
  24. return;
  25. }
  26. readed({
  27. uid: obj.uid,
  28. mid: $info[0].id,
  29. time: $info[0].createTime
  30. })
  31. informHtml($info);
  32. if(data.data.length == obj.rows) {
  33. obj.time = $info[$info.length - 1].createTime;
  34. obj.mid = $info[$info.length - 1].id;
  35. $(".js-load-more").removeClass("displayNone");
  36. }else{
  37. $(".js-load-more").addClass("displayNone");
  38. }
  39. }
  40. }
  41. });
  42. }
  43. function informHtml($data) {
  44. for(var i = 0; i < $data.length; i++) {
  45. var str = '<li class="list-qa">' +
  46. '<div class="madiaInfo">' +
  47. '<div class="flexCenter qa-owner">' +
  48. '<div class="owner-head useHead" style="cursor:pointer"></div>' +
  49. '<div class="owner-info reWidth">' +
  50. '<div class="owner-tit h2Font cnt" style="cursor:pointer">' + $data[i].cnt + '</div></div>' +
  51. '<div class="creTime">' + commenTime($data[i].createTime) + '</div></div></div></li>'
  52. var $str = $(str);
  53. $str.data("obj", $data[i]);
  54. $("#curAnswers").append($str);
  55. uinfo($str, $data[i].uid)
  56. }
  57. }
  58. function uinfo(li, uid) {
  59. $.ajax({
  60. url:"/ajax/professor/editBaseInfo/" + uid,
  61. async: true,
  62. dataType: 'json', //服务器返回json格式数据
  63. type: 'GET', //HTTP请求类型
  64. traditional: true, //传数组必须加这个
  65. success: function(data) {
  66. if(data.success) {
  67. var $data = data.data;
  68. if($data.hasHeadImage == 1) {
  69. li.find(".useHead").css('background-image', "url(/images/head/" + $data.id + "_l.jpg");
  70. }
  71. }
  72. }
  73. });
  74. }
  75. function readed(objec) {
  76. $.ajax({
  77. url: '/ajax/notify/readed',
  78. data: objec,
  79. async: true,
  80. dataType: 'json', //服务器返回json格式数据
  81. type: 'POST', //HTTP请求类型
  82. traditional: true, //传数组必须加这个
  83. success: function(data) {
  84. if(data.success) {
  85. $(".myinform").eq(0).find(".badge").text("")
  86. }
  87. }
  88. });
  89. }
  90. $("#curAnswers").on("click", ".cnt", function() {
  91. var dobj = $(this).parents("li").data("obj");
  92. var our = "";
  93. if(dobj.opType == 0) {
  94. ourl = "userInforShow.html?professorId=" + dobj.uid;
  95. } else if(dobj.opType == 1) {
  96. ourl = 'userInforShow.html?professorId=' + dobj.pid + '&flag='+encodeURI(dobj.cnt.substring(dobj.cnt.indexOf(">") + 1, dobj.cnt.lastIndexOf("<")));
  97. } else if(dobj.opType == 2) {
  98. $.ajax({
  99. url: "/ajax/article/query?articleId="+dobj.pid
  100. }).done(function(data) {
  101. if(data.success) {
  102. window.open("shtml/a/"+data.data.createTime.substr(0,8)+"/"+data.data.shareId+".html");
  103. }
  104. });
  105. } else if(dobj.opType == 3 || dobj.opType == 4 ) {
  106. var arr=dobj.pid.split(":")
  107. ourl = "qa-show.html?id=" + arr[1]+"&topid="+arr[0];
  108. }else if(dobj.opType == 5){
  109. ourl = "qa-show.html?id=" + dobj.pid;
  110. } else if(dobj.opType == 6) {
  111. $.ajax({
  112. url: "ajax/ppatent/qo?id="+dobj.pid
  113. }).done(function(data) {
  114. if(data.success) {
  115. window.open("shtml/pt/"+data.data.createTime.substr(0,8)+"/"+data.data.shareId+".html");
  116. }
  117. });
  118. } else if(dobj.opType == 7) {
  119. $.ajax({
  120. url: "ajax/ppaper/qo?id="+dobj.pid
  121. }).done(function(data) {
  122. if(data.success) {
  123. window.open("shtml/pp/"+data.data.createTime.substr(0,8)+"/"+data.data.shareId+".html");
  124. }
  125. });
  126. } else {
  127. module.lWord.init({id:dobj.pid});
  128. $(".blackcover").removeClass("displayNone");
  129. return;
  130. }
  131. if(dobj.opType == 2 || dobj.opType == 6 || dobj.opType == 7)
  132. return;
  133. window.open(ourl);
  134. })
  135. $("#curAnswers").on("click", ".useHead", function() {
  136. var dobj = $(this).parents("li").data("obj");
  137. window.open("userInforShow.html?professorId=" + dobj.uid);
  138. return false;
  139. })
  140. $(".js-load-more").click(function(){
  141. informList(obj);
  142. })
  143. })