portal html css js resource

inform.js 4.4KB

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